#discord-bots

1 messages Β· Page 1122 of 1

unkempt canyonBOT
#

await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits until the client’s internal cache is all ready.

Warning

Calling this inside [`setup_hook()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.setup_hook "discord.ext.commands.Bot.setup_hook") can lead to a deadlock.
jovial urchin
#

Whats the difference between that and on_ready?

#

and what is discord.ext?

slate swan
slate swan
hardy wing
#

how do you install the latest version of the discord.py API

jovial urchin
sick birch
#

The latter

slate swan
slate swan
hardy wing
#

so to put it in it'd just be pip install discord?

frozen patio
#

Like, it says the same thing twice, why

#

It didn't do it before I added a new cog

frozen patio
#

Ok so my afk file is causing problems, why is that here? If I do not load it the other files are fine

Code: https://srcb.in/RzJOfMDTOq

dusky pine
#

if you're talking about latest latest

#

as in 2.0

hardy wing
#

yeah need the version that makes the gui work

slate swan
still swan
#

how to remove a button when clicking it? maybe someone help me please?

slate swan
#

what library

still swan
dusky pine
slate swan
slate swan
still swan
# slate swan what library
class Button(discord.ui.Button):
    async def callback(buttonSelf: "Button", interaction: discord.Interaction) -> Any:
        if buttonSelf.label == 'Cancel':
            for item in view.children:
                if isinstance(item, discord.ui.Button):
                    view.remove_item(item)
                else:
                    item.disabled = True
            await view.message.edit(view=view)
        else:
            view.remove_item(buttonSelf) # <---
            await view.message.edit(embed=embed, view=view)
still swan
#

but its not working

slate swan
#

you can just self.children.pop( that button's index ) and edit the message with new view

#

why the f is list.pop not documented

still swan
#

;c

slate swan
#

its list.pop im very sure

still swan
#

both XD

slate swan
#

yeah both of them exist

still swan
#
from typing import Optional
@bot.command()
async def rmbr(ctx, arg: Optional[str etc]):
  ...
prisma prism
#

oh thank you!!

still swan
slate swan
still swan
slate swan
#

you can just ```py
class MyView(ui.View):
@ui.button(**kwargs)
async def button_callback(self, button: ui.Buttom, inter: Interaction):
self.children.pop(self.children.index(button))
# edit message to this view (self)

slate swan
still swan
still swan
# slate swan you probably have an error handler which is not allowing the error to raise
class Button(discord.ui.Button):
    async def callback(buttonSelf: "Button", interaction: discord.Interaction) -> Any:
        if buttonSelf.label == 'Cancel':
            for item in view.children:
                if isinstance(item, discord.ui.Button):
                    view.remove_item(item)
                else:
                    item.disabled = True
            await view.message.edit(view=view)
        else:
            view.remove_item(buttonSelf)
            await view.message.edit(embed=embed, view=view)

class Select(discord.ui.Select):
    async def callback(selectSelf: "Select", interaction: discord.Interaction) -> Any:
        if True not in map(lambda item: item.label == 'Return back to main command', filter(lambda item: isinstance(item, discord.ui.Button), view.children)):
            view.add_item(Button(label='Return back to main command', style=discord.ButtonStyle.blurple))
            await view.message.edit(view=view)
        await interaction.response.send_message(selectSelf.values[0])

class View(discord.ui.View):
    async def on_timeout(viewSelf: "View") -> None:
        try:
            await viewSelf.message.edit(view=None)
        except: # msg got deleted
            pass

    def __init__(viewSelf: "View") -> None:
        super().__init__()
        viewSelf.add_item(
            Select(
                max_values=1, min_values=1, placeholder='Commands List', 
                options=[
                    discord.SelectOption(label=command.name) for command in group.walk_commands()
            ]))
        viewSelf.add_item(Button(label='Cancel', style=discord.ButtonStyle.red))
        
view = View()
view.message = await self.context.reply(embed=embed, view=view)

thats the full code...

still swan
maiden fable
#

I am just saying that u got a syntax error in that example

still swan
pliant gulch
#

Optional :drakeno: None | T :drakeyes:

maiden fable
#

In the Button class

still swan
#

its giving me that

maiden fable
#

Do you have an error handler?

still swan
#

yea

#
@bot.event
async def on_command_error(ctx: commands.Context, error: Any) -> Optional[NoReturn]:
    # cooldown error
    if isinstance(error, commands.errors.CommandOnCooldown):
        await on_cooldown(ctx)
        return None

    if not hasattr(ctx.command, 'on_error'):
        raise error
    return None
maiden fable
#

Instead of the second if statement, do:

else:
   raise error
still swan
#

thx

maiden fable
#

The return type is always None and error type is CommandInvokeError iirc

#

!d discord.ext.commands.Bot.on_command_error

unkempt canyonBOT
#

await on_command_error(context, exception, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The default command error handler provided by the bot.

By default this logs to the library logger, however it could be overridden to have a different implementation.

This only fires if you do not specify any listeners for command error.

Changed in version 2.0: `context` and `exception` parameters are now positional-only. Instead of writing to `sys.stderr` this now uses the library logger.
still swan
#

thxx

still swan
maiden fable
#

Can u show yr code?

#

Error handler

#

Weird

robust fulcrum
#

Hi

still swan
#

hi

maiden fable
#

U are adding the Button, but haven't defined any callback

maiden fable
#

The view.add_item

still swan
maiden fable
#

Oh nvm

still swan
#

xd

maiden fable
#

In the else statement of the call back method, where u r checking for button label

#

In the else, add a debug print statement to see if it's even triggering

still swan
#

okay 1sec

#
view.remove_item(buttonSelf)
await view.message.edit(embed=embed, view=view)
print('x')
#

its printing x

maiden fable
#

Weird

#

Oh wait wait wait

#

U ain't responding to the interaction

#

!d discord.Interaction.response

unkempt canyonBOT
#

Returns an object responsible for handling responding to the interaction.

A response can only be done once. If secondary messages need to be sent, consider using followup instead.

still swan
#

OH

maiden fable
#

Bruhhh it was that easy smh

#

Damn it

still swan
#

omg

#

i just need to add await interaction.response.edit_message() right?

maiden fable
#

No

#

Wait, yea

#

Wait

#

Is that gonna work? Try it out

still swan
#

OMG

#

IT WORKED

#

YAY TYSM <333

#

i tried for more than 2 hours to fix that command 😭 thx for help <333

maiden fable
#

It's fine

#

@still swan one thing I like to do whenever I work with buttons or context commands is that add an interaction.response to the function

#

So that u can remember that u gotta use that at least once in the code

still swan
#

yea xD

#

thx for helping tho <33

slate swan
maiden fable
#

That can become confusing for a newbie since technically he's already using view.message.edit

slate swan
still swan
robust fulcrum
#

Guys can anyone here help me at sqlite in #databases ?

still swan
#

thx

slate swan
still swan
maiden fable
maiden fable
#

Then u can go with the first one

still swan
#

ty

slate swan
# still swan yes

you can always use interaction.edit_original_message which uses a webhook but can raise an error and cause webhook 404 problems so the first option is better

slate swan
#

πŸ‘

sick wadi
#

is it possible to run a python app using JS? i built my entire discord bot using discordjs and don't really want to rewrite it but it'd be cool to intertwine it with a python webscraper or whatever else

slate swan
#

why do you want to use python, js provides you those features already?

#

just use that until you want to rewrite it completely

#

python app using JS
running a python file with js's interpreter thats like making @maiden fable understand me, it doesnt work

robust fulcrum
#

Guys i am getting this error when i run my bot
Can anyone help fix it pls?

#

Pls help me this error is insane

robust fulcrum
#

@maiden fable can you help me?

maiden fable
#

Can u paste the error here?

robust fulcrum
#

Ok

robust fulcrum
maiden fable
#

Like, the whole traceback

robust fulcrum
#

That's very huge

maiden fable
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

robust fulcrum
#

And i cant copy on mobile

robust fulcrum
#

I'll send link to my repl

maiden fable
#

Nope

robust fulcrum
#

I dont even have max_workers thing in my discord bot

maiden fable
#

Yea

robust fulcrum
maiden fable
#

Ig

robust fulcrum
#

Really a insane error

robust fulcrum
shrewd apex
#

max_workers if i am not wrong is from concurrent.futures

maiden fable
#

Yea

shrewd apex
#

Threadpoolexecutor needs max_wormers

#

workers*

#

!d concurrent.futures.ThreadPoolExecutor

unkempt canyonBOT
#

class concurrent.futures.ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())```
An [`Executor`](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor "concurrent.futures.Executor") subclass that uses a pool of at most *max\_workers* threads to execute calls asynchronously.

*initializer* is an optional callable that is called at the start of each worker thread; *initargs* is a tuple of arguments passed to the initializer. Should *initializer* raise an exception, all currently pending jobs will raise a [`BrokenThreadPool`](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.thread.BrokenThreadPool "concurrent.futures.thread.BrokenThreadPool"), as well as any attempt to submit more jobs to the pool.

Changed in version 3.5: If *max\_workers* is `None` or not given, it will default to the number of processors on the machine, multiplied by `5`, assuming that [`ThreadPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor "concurrent.futures.ThreadPoolExecutor") is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for [`ProcessPoolExecutor`](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor "concurrent.futures.ProcessPoolExecutor").
slate swan
robust fulcrum
#

🀯

shrewd apex
#

it's repl so just do max_workers=4

#

in the ()

robust fulcrum
shrewd apex
#

check Google first smh

robust fulcrum
shrewd apex
#

🀦

#

in the ()

#

of the executor statement

robust fulcrum
#

They gave me a good help
They told Idk sorry

shrewd apex
#

it's a kwarg

slate swan
#

that's an asyncio error Asher

#

and iirc replit doesnt allow you to open files of default libraries

shrewd apex
#

it says max_workers missingπŸ‘€

slate swan
#

....?

shrewd apex
#

u have to change that somehow

robust fulcrum
#

What would I do now 😭

slate swan
#

inbuilt libraries...deprecated? god or what?

shrewd apex
shrewd apex
robust fulcrum
slate swan
#

Asher read the tb

shrewd apex
#

i just read missing arg

slate swan
#

smh

shrewd apex
#

where are u using asyncio in ur code? can u send that fragment which is causing error?

slate swan
#

aiohttp is erroring, try updating it

robust fulcrum
#

Ok

robust fulcrum
#

Poetry?

#

Or pip

slate swan
#

just try to pip it for now

robust fulcrum
#

Ok

shrewd apex
#

dosent repl auto updateπŸ‘€

robust fulcrum
#

Still

shrewd apex
#

send code whenπŸ‘€

robust fulcrum
#

All?

#

I have a lot of files

robust fulcrum
#

I used in 3 files ig

shrewd apex
#

no which part is causing error

#

it will show in error πŸ‘€ see and send

robust fulcrum
shrewd apex
#

btw i just remembered

#

aiohttp dosent work with replit

#

so πŸ’€

#

so use requests + run_in_executor

torn sail
#

I’ve used it before in replit

shrewd apex
#

idk it didn't for me either

#

i don't use replit much

torn sail
#

Idk I haven’t used it in a long time

shrewd apex
#

some other guy told me abt this

#

it didn't work for me when i tried it caused some bug or something

slate swan
robust fulcrum
#

@shrewd apex but discord py not work without aiohttp

shrewd apex
slate swan
shrewd apex
#

i tried using aiohttp get() it didn't work it probably was interfering with replit operation

shrewd apex
#

but when i use aiohttp explicitly

slate swan
#

I'll test

shrewd apex
#

like
async with aiohttp.Client...

#

it gives errors

shrewd apex
robust fulcrum
#

@slate swan

#

But me get this error

slate swan
#

Error says all

robust fulcrum
#

Idk it never came first

robust fulcrum
#

I don't have any max_workers thing

slate swan
#

Missing argument

slate swan
robust fulcrum
#

Then why it never came first?

shrewd apex
robust fulcrum
shrewd apex
#

idk sarths testing

robust fulcrum
#

Only discord use it

shrewd apex
#

ic

robust fulcrum
#

Me use requests

slate swan
shrewd apex
#

i don't have much experience with replit

robust fulcrum
#

Why this error not came first?

shrewd apex
#

last time i use aiohttp with replit explicitly it gave me a few errors

robust fulcrum
#

Did it came cause of aiosqlite?

shrewd apex
slate swan
#

I never used aiohttp πŸ’€

robust fulcrum
dusky pine
#

!pip httpx

unkempt canyonBOT
shrewd apex
#

Β―\_(ツ)_/Β―

robust fulcrum
#

Do Pydictionary have any problem with replit?

slate swan
#

┬─┬ γƒŽ( γ‚œ-γ‚œγƒŽ)

dusky pine
shrewd apex
#

idk

dusky pine
#

maybe replit has already a lot of people using google translate in their service

slate swan
#

Nice

shrewd apex
#

hmm strange didn't work for me

robust fulcrum
#

I use bot.run not asyncio.run

#

Do it matter?

slate swan
#

im not doing that in a bot but general program

robust fulcrum
#

This error really insane

slate swan
#

whats the error?

robust fulcrum
#

Help!

slate swan
#

CODE

robust fulcrum
#

Kn GitHub

slate swan
#

Bro which part

robust fulcrum
#

In my profile

slate swan
#

send the full error

#

Send here

robust fulcrum
#

How do I copy bro?

slate swan
#

I can't open github

robust fulcrum
#

On mobile

slate swan
#

Ok

robust fulcrum
#

I already sent

slate swan
robust fulcrum
#

Me on mobile

slate swan
#

I can understand but...

robust fulcrum
#

@slate swan need my repl link?

robust fulcrum
dusky pine
#

why not buy an actual VPS

robust fulcrum
bright jetty
#

can someone help me lol

#

how do i setup python discord bot?

#

like setup before coding

robust fulcrum
#

😒

still swan
robust fulcrum
#

@shrewd apex

#

Do you got any solution for me?

bright jetty
#

ok

paper sluice
#

no?

#

while inviting it asks for human verification, so most probably its not meant to be automated

robust fulcrum
#

@paper sluice i am having a very huge error which here nobody was able to solve
Can you try help me?

paper sluice
#

what error?

paper sluice
#

can u copy paste it

#

i can't see anything properly

robust fulcrum
#

Me on mobile

#

Need my repl link?

#

I'll dm you link of my repl

paper sluice
#

u should be able to select all and copy on mobile

robust fulcrum
#

I'll change token lator

paper sluice
#

ur using python3.8

robust fulcrum
#

So?

paper sluice
#

upgrade to 3.10 try

robust fulcrum
#

Is it the error?

paper sluice
robust fulcrum
#

How do I upgrade on replit?

visual island
paper sluice
slate swan
#

and replit machines run 3.8.2 iirc

robust fulcrum
#

😒 my discord bot

slate swan
#

2.0 requires 3.8

#

or above

robust fulcrum
#

But replit use 3.8

#

So this is not a actual error

slate swan
#

hi

#

what even is the error?

robust fulcrum
#

@slate swan want my repl link?

slate swan
robust fulcrum
#

I'll dm you

slate swan
#

hm

robust fulcrum
#

I did dm

paper sluice
slate swan
robust fulcrum
#

I did a lot of hardwork to install 2.0

paper sluice
paper sluice
#

use 2.0, just uninstall and install again

robust fulcrum
#

I forgot how to install using git link?

slate swan
#

rip

#

nice, who tf cleaned up poetry.lock

#

thanks for the token btw

robust fulcrum
slate swan
#

did you already reset?

#

use an env var from the next time

robust fulcrum
slate swan
#

hola

slate swan
#

use an env variable

paper sluice
#

rewritting my dpy bot in hikari isnt as hard as i initially thought

slate swan
paper sluice
#

ya

slate swan
#

@robust fulcrum 😐 why did you clear poetry.lock

slate swan
paper sluice
#

dude this popped up right now, wtf, i was trying to set it up yesterday to autocorrect my colors class. why does it activate when i dont need it πŸ˜”

slate swan
#

I tried it

#

and it just gave me wrong suggestions....every single time even after seeing the patterns for 6 hours

paper sluice
slate swan
#

maybe

slate swan
paper sluice
robust fulcrum
slate swan
robust fulcrum
#

Wtf man who cleared that 😭

paper sluice
robust fulcrum
#

This replit is a bag of bugs

#

Samarth?

#

Oh the guy who is with me on replit?

slate swan
#

not me

paper sluice
slate swan
#

mine is Ashley or smth

paper sluice
slate swan
#

Ashley02014 yeah

robust fulcrum
#

Who is he?

#

I not even invited

slate swan
#

Β―_(ツ)_/Β―

robust fulcrum
#

I thought samarth is asley

#

Who invited that guy?

paper sluice
maiden fable
#

What's even happening here

paper sluice
slate swan
robust fulcrum
#

I just invited @paper sluice and @slate swan

#

Should I make new repl?

#

And paste this code

paper sluice
#

dont make repls

#

download python πŸ˜”

slate swan
#

πŸ˜” on phone

robust fulcrum
paper sluice
#

oh

#

F

robust fulcrum
#

Is it danger ?

paper sluice
#

there should be a panel to revoke access or something, do that first

slate swan
#

^

paper sluice
#

then generate a new poetry thing, i dont use it so dont ask me

robust fulcrum
#

Idk how to do that

paper sluice
# robust fulcrum ?

like u gave us access to ur replit, now revoke that access. There should be an option

robust fulcrum
#

How that guy joined my repl!

slate swan
#

just remove em Β―_(ツ)_/Β―

#

nice now even I cant join

robust fulcrum
#

I deleted join link

slate swan
#

nice

robust fulcrum
#

Ryuga still there

#

I can belive him

paper sluice
#

i never use replit

#

fuck that

slate swan
#

same

robust fulcrum
#

What should I do now?

#

The poetry.lock

slate swan
#

resend the invite link smh πŸ˜”

robust fulcrum
#

Should i report about it in replit server?
That a unknown guy joined my repl

robust fulcrum
slate swan
robust fulcrum
#

Holy

#

That guy samarth guy removed some of my imports 😭

slate swan
#

rip

robust fulcrum
slate swan
robust fulcrum
#

If unknown people join our repl this can destroy our hard work

slate swan
#

probably has something to do with poetry.lock being cleared up

robust fulcrum
slate swan
#

I'm out, I'd rather make a new repl by now

#

I'd rather not use replit

#

phone...

#

pydroid..

#

my mind on another level....

slate swan
#

there's so much shit filled in the repl 😭

slate swan
#

too smart for this shit

#

sed

paper sluice
#

how do u send ephem messages with miru.Context

robust fulcrum
#

My mind broken

slate swan
#

mine too, im out

slate swan
paper sluice
#

aight thanks

slate swan
#

and copy paste the code

#

^

#

copy pasting every single file on phone

#

so uwu

#

download the tar.gz file , unzip it, upload it, ez.

robust fulcrum
#

I can't upload folder on replit 😒

slate swan
#

upload files one by one

robust fulcrum
#

Replit people said to type poetry update in shell

slate swan
#

try it and see, I'll blame replit's outdated python version for every issue

robust fulcrum
#

Yes true

robust fulcrum
slate swan
#

yeah then just create another repl

paper sluice
#

whats the equivalent a PageSource in miru

robust fulcrum
#

Guys

#

A guy on replit server gave me a template of python 3.10

#

And i can get all 3.10 features

#

Should I use it?

slate swan
#

sure

slate swan
#

hi

frigid raft
#

hi@slate swan

slate swan
#

hi

#

hi

frigid raft
#

yeah yeah ok. πŸ—Ώ

#

What do you need ? Some help ?

robust fulcrum
#

@slate swan should i upgrade to 3.9?
With replit using nix now you should be ezily able to update python by editing the replit.nix file
Replit people told me to do this

slate swan
#

hm

#

sure

robust fulcrum
#

But python not big problem

#

Poetry.lock more big problem

#

I really hate poetry

slate swan
#

pretty sure discord.py 1.5.x still works, that doesn't means its not outdated

slate swan
robust fulcrum
#

@slate swan good news

#

I got a solution

#

I can restore my repl

#

I edited it lat yesterday

#

And i am restoring it now

#

Whats this thing

slate swan
#

I'm blind, it's too small to see

placid skiff
#

No you're not, you literally need a magnifying glass to see it D_D

slate swan
#

mhm

robust fulcrum
dusky pine
# robust fulcrum
package = []

[metadata]
lock-version = "1.1"
python-versions = ">=3.8.0,<3.9"
content-hash = "..."

[metadata.files]
frigid raft
#

@robust fulcrumWait are you really in the process of coding a bot using your phone ?

robust fulcrum
#

@slate swan

#

How can we remove the default help comamnd?

frigid raft
slate swan
#

in the Bot constructor

placid skiff
#

subclass the help command class or set the help_command to none when declaring the bot instance

dusky pine
#

bot.remove_command("help")

slate swan
#

no

frigid raft
#

it works too but help_command = None is better

feral depot
#

Ok mr.Henderson

dusky pine
#

copy commands.Bot code and remove all help-command related lines

robust fulcrum
#

Making new repl is a head ache

#

Copying everything and pasting

#

Yeees 😁 my bot is backN

slate swan
#
class MyUwUHelpCommand(commands.HelpCommand):
  pass

bot = commands.Bot(help_command=MyUwUHelpCommand())

πŸ˜”

robust fulcrum
#

Replit wasted my half day on my bot

slate swan
#

replied

robust fulcrum
#

I was thinking to work on sqlite today

#

But i was not knowing this replit is ready to stop me

#

Can I ask one thing @slate swan

slate swan
#

uh?

robust fulcrum
#

Why this thing is coming
It never came before

slate swan
robust fulcrum
slate swan
#

a default logger is automatically set when you use the run method

robust fulcrum
#

Is it helpful?

slate swan
#

kinda

robust fulcrum
#

If we not overwrite poetry installs 1.7

#

@slate swan holy shit man

#

I am really sorry to you

#

I found the thing which was creating problem in our repl

#

The PyDictionary module

bronze flare
#

can someone help me with this easy pthon script

#

it will take 2 mins

slate swan
#

why are you using that though?

slate swan
bronze flare
#

sorry?

robust fulcrum
loud junco
slate swan
slate swan
dusky pine
robust fulcrum
#

But this was a lesson for all

slate swan
#

ahem

loud junco
robust fulcrum
#

Btw i helped you all in a way @slate swan

loud junco
#

πŸ‘€

slate swan
#

that is?

loud junco
#

u sure about that

robust fulcrum
#

I helped that never use PyDictionary

slate swan
#

I'm sure I'm not dumb enough to use a blocking lib

robust fulcrum
#

Isn't?

#

Anyway it helped us all

loud junco
#

pydictionary?

unkempt canyonBOT
#

extensions/Misc.py lines 35 to 39

resp = await misc.bot.http.get(f"https://api.dictionaryapi.dev/api/v2/entries/en/{word_to_search}")
if resp.status != 200:
    return await ctx.respond("Could not find that word!")
content = await resp.json()
data = content[0]```
slate swan
#

that's how I create my dictionary command

robust fulcrum
slate swan
loud junco
#

my bot just went fstring error for no reason and im raged cuz there is 1000 files that i need to copy pasta

slate swan
#

cool

#

1000

loud junco
#

maybe thats a bit exaggerating

paper sluice
robust fulcrum
loud junco
#

thats what i need to do also

robust fulcrum
#

I hate you PyDictionary

slate swan
daring sparrow
#

what is the best way of getting a bot onto a vps?

robust fulcrum
#

PyDictionary is kutta

loud junco
#

me not even using http πŸ‘€

robust fulcrum
#

PyDictionary kutta

loud junco
daring sparrow
slate swan
loud junco
#

oo

daring sparrow
#

i want to use github and pull and request everything but idk how to set that up in my bot droid_cry_squish

loud junco
#

this is how i do it:
vps for main bot
and a replit beta bot

slate swan
#

replit

#

ew

loud junco
#

everytime i finish an update with my beta bot
i update the code to main bot

slate swan
#

ew

loud junco
slate swan
#

just make a beta cog

loud junco
#

at least i get myself vps alright

#

wait no

#

i dont have any ;-;

#

im using doube replit πŸ₯²

daring sparrow
#

@slate swan how do u pull and push updates

#

for ur vps

loud junco
#

πŸ–οΈ push
πŸ€› pull

daring sparrow
loud junco
slate swan
#

more like I'm poor now

robust fulcrum
#

Imagine making repl 3rd time .. || 😭 ||

slate swan
#

you are doing it, why imagine

daring sparrow
slate swan
robust fulcrum
daring sparrow
#

i wanna use github but how would i do that

dusky pine
#

usually you can ssh into your vps and git clone your repo and run

heavy folio
#

github education exusts

robust fulcrum
#

I'll never use PyDictionary now

heavy folio
#

literally gives you digital ocean free for 1 year bro

loud junco
#

dont tell me heroku

heavy folio
paper sluice
slate swan
#

and websites are good enough for heroku

heavy folio
#

heroku sucks ass too

slate swan
#

mostly yes

loud junco
#

still better than ur ass

heavy folio
#

ok REPLIT user

loud junco
#

LOL ikr

slate swan
loud junco
dusky pine
#

what an implicit argument

slate swan
#

I'm out

daring sparrow
#

repl.it is pointless i rather host on a 2001 windows server

loud junco
#

yayaya blablabla

paper sluice
#

id rather not make a bot πŸ’€

loud junco
#

replit underrated ;-;

#

replit is not good

#

but its not that bad ;-;

slate swan
paper sluice
loud junco
#

good enough for learner

slate swan
#

replit surely is underrated, it just isn't meant to host discord bots

slate swan
#

^

#

But for interaction commnand bots

#

interaction command?

#

I mean the new slash command thing

#

hm

#

Never used them but I think now you just need to make a webserver like flask and make your bot on it? Heroku is pretty decent for this usecase

paper sluice
dusky pine
#

step 1. grab ur moms cc
step 2. buy VPS
step 3. host discord bot
step 4. get grounded

#

ez hosting method free 2022

slate swan
#

imagine shitposting

scarlet sorrel
#

is there any way of listening to user audio with the python version of the discord api?

#

like saving it to a file each time someone goes green in the call or something like that

slate swan
#

Python, no I guess. Still a pr

scarlet sorrel
#

it is by js rip

slate swan
#

"python version of the discord api" isnt a thing, discord api is written in js

slate swan
vocal snow
#

There are experimental forks which you can use, or implement it yourself

scarlet sorrel
slate swan
#

what-

slate swan
#

If you know enough python, you can just copy the code from pending PR and fix and use it.

slate swan
dusky pine
slate swan
scarlet sorrel
unkempt canyonBOT
vocal snow
#

Don't use that

slate swan
#

well

scarlet sorrel
dusky pine
#

i, uh, don't think you know what API and API wrappers mean

slate swan
vocal snow
#

But don't use it for other reasons

slate swan
#

just experimental purposes

scarlet sorrel
slate swan
#

just use djs

#

Β―_(ツ)_/Β―

dusky pine
#

yeah make sure to use TypeScript

scarlet sorrel
slate swan
#

Are there some official discord docs for voice receive or it's all just reverse engineered?

slate swan
daring sparrow
#

it's all reverse engineered pretty sure.

scarlet sorrel
scarlet sorrel
daring sparrow
slate swan
#

Hm. Discord surely is weird to keep endpoints open and still not give docs for it like its a school test or what πŸ˜”

scarlet sorrel
#

ok lol

slate swan
#

you want voice receive feature?

scarlet sorrel
slate swan
#

pycord and nextcord supports that, totally not taken from the discord.py prs

scarlet sorrel
#

whats "prs"?

slate swan
#

Pull Requests

#

Pull requests

vocal snow
#

The pycord people did take permission from the pr author though, it wasn't blatantly stolen

slate swan
#

im not a fork person, personally dont like any
but you can go for pycord since nextcord is being re-written and there will be breaking changes

#

will/may

heavy folio
#

lolw

dusky pine
#

i'm not a fork person either, I prefer spoons

vocal snow
slate swan
#

i prefer light ( hikari )

slate swan
heavy folio
#

just use your hands

slate swan
#

ew

#

dirty

dusky pine
#

wash ur hands first

slate swan
#

mehh just don't eat

slate swan
slate swan
heavy folio
scarlet sorrel
dusky pine
#

use this thing

scarlet sorrel
#

you in prison?

slate swan
vocal snow
#

Spork supremacy

dusky pine
slate swan
paper sluice
#

i use telekinesis to eat

slate swan
#

The Force πŸ˜”

#

STOP

#

πŸ›‘

dusky pine
#

spork conversation

slate swan
#

NO OT

dusky pine
#

don't gotta be that strict

slate swan
#

don't shout Sparky

robust fulcrum
#

@slate swan i made a new repl and my bot working fine
And i found the problem
The PyDictionary module was the problem and never use it

dusky pine
#

s- sparky stop shouting πŸ₯Ί πŸ‘‰ πŸ‘ˆ this isn't youuuu πŸ˜”πŸ˜­

robust fulcrum
#

No

slate swan
#

sure?

robust fulcrum
#

πŸ˜‚

#

Anyway me will work on sqlite now

slate swan
#

Or 779990652149825537

dusky pine
slate swan
dusky pine
#

it's just a replit-related problem

full valley
#

Im using the discord.py before rewrite, is there anything compatible that I can use to create modals?

dusky pine
full valley
slate swan
#

do you mean the async branch?

dusky pine
full valley
#

it is

#

if I rewrite, what do you guys suggest

slate swan
dusky pine
#

join the hikari cult family

full valley
#

is the rewrite for dpy much different to before

slate swan
#

yeah, its really breaking

dusky pine
slate swan
#

client.say/send_message etc are removed

dusky pine
#

for example you do channel.send instead of bot.send_message(channel, ...)

slate swan
#

yep

full valley
#

Right well

#

So is hikari superior? I know there will be a little bias here

#

or did you just switch before Danny announced his return

slate swan
#

i have been using it before discord.py was well and fine

full valley
#

Any clear benefits?

slate swan
#

faster, more object oriented, better cache, inbuilt logging

#

and explicit rest client

dusky pine
#

i really like hikari's ASCII art when you start bot :P

slate swan
#

mhm you can edit it to your own custom banner too

full valley
#

Alright well I have some reading to do

#

cheers

daring sparrow
daring sparrow
dusky pine
slate swan
# slate swan

lmao, I remember seeing that shit for 3 days straight

#

then I got so sick of it, that I removed it πŸ˜”

slate swan
daring sparrow
#

ooo thats cool

dusky pine
#

Hey add the Gentoo logo there

slate swan
#

lemme try doing that

slate swan
slate swan
#

but uhhh I'll have to reinstall lightbulb so meh

#

thats not lightbulb specific anyways

slate swan
slate swan
slate swan
slate swan
#

hm yeah

severe bone
#

guys py @bot.command() async def stock(ctx): stockmenu = discord.Embed(title="Account Stock", description="") for filename in os.listdir("Accounts"): with open("Accounts\\" + filename) as f: ammount = len(f.read().splitlines()) name = (filename[0].upper() + filename[1:].lower()).replace( ".txt", "") stockmenu.description += f"*{name}* - {ammount}\n" await ctx.send(embed=stockmenu) why doesnt this send the list

#

(im using replit to keep it alive)

severe bone
slate swan
slate swan
severe bone
#

^^ idk how to spell that word sry im not english

#

im new with using replti

slate swan
#

its fine i understand, do you see a "console" option?

severe bone
#

just in console?

slate swan
#

yes

severe bone
#

oh yeah ill send a sc

slate swan
#

mhm these are not errors

severe bone
#

mmm anyway how to fix?

#

let me send my files n shi

#

@slate swan can u do more with this^^

shrewd apex
severe bone
#

yep

shrewd apex
#

yeah it's not errors

severe bone
#

anyhow to fix it?

shrewd apex
#

i don't think u can

slate swan
#

what does it actually send

#

nothing at all?

severe bone
#

no nothing

#

it doenst send anything but the other commands work

slate swan
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

slate swan
#

Selling/giving away (stolen) accounts is against Discord's Terms of Service. It can get your bot and your account terminated/banned.

severe bone
#

Just i needed some texts

shrewd apex
#

the eye πŸ‘€ Krypton pro took me some time to figure out

upbeat gust
severe bone
#

and that it works that it sends the amount of lines

slate swan
severe bone
slate swan
#

<@&831776746206265384> they will care

upbeat gust
severe bone
dusky pine
#

appreciate LX for being fastest mod

severe bone
#

Krypton is probs the kid in class that says they didnt gave homework

upbeat gust
#

no?

dusky pine
copper gulch
#

idk why but if I run my whole discord.py code in VScode I get an error but not in pycharm πŸ˜‚

dusky pine
#

no, they're both different things

upbeat gust
dusky pine
#

they are both dpy forks

visual yarrow
jovial urchin
#

How do I get a list of all the messages that has been sent in a channel? And then how do I delete them?

upbeat gust
#

TextChannel.history

#

loop through and call Message.delete

jovial urchin
upbeat gust
#

why would they have the same code, different forks, different ways of doing things

visual yarrow
#

@severe bone What does your code do?

upbeat gust
#

and then?

copper gulch
#

is there a way to like get like the userID of a person who invited a bot?

upbeat gust
#

not anymore
restarted ages ago

copper gulch
upbeat gust
#

has all the new features

severe bone
copper gulch
#

anyone know a way to like get the userID of a person who invited a bot?

visual yarrow
#

!warn 452717596341567488 Do not ask for help with malicious projects.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @severe bone.

upbeat gust
copper gulch
#

hmmm, how about:
can a discord bot even listen to a vc? idk if this is legal or no
like voice recognition?

upbeat gust
dusky pine
loud junco
copper gulch
#

speechrecognition module?crypanda

dusky pine
copper gulch
#

yes, but I think it could help πŸ˜‚

slate swan
#

If you want to know who added "your" bot, then I dont think this will work

copper gulch
#

just needed to like know who invited a bot in a server

slate swan
#

!d discord.BotIntegration

unkempt canyonBOT
#

class discord.BotIntegration```
Represents a bot integration on discord.

New in version 2.0.
slate swan
#

A bot means your own bot or any other bot in the server same as your bot?

#

same server as the bot

#

that's when it starts tracking the integrations

#

Yeah then it sure will work.

copper gulch
#

like for example:
my bot is in the server
then a user invited mee6
then the bot will then send a dm to me: mee6 - (userID)

slate swan
#

idts you can get the inviter

#

no you can

jovial urchin
#
async for i in message.channel.history():
                await i.delete()
``` Why is this so slow?
#

It takes ages to delete the messages

upbeat gust
slate swan
#

just purge the messages, dpy will handle that by itself

upbeat gust
#

you can also use textchannel.purge instead

slate swan
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=None, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
copper gulch
unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @cerulean folio until <t:1656325586:f> (9 minutes and 59 seconds) (reason: mentions rule: sent 7 mentions in 10s).

slate swan
#

@cerulean folio πŸ«‚

velvet compass
#

!unmute 508106724075634709

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @cerulean folio.

cerulean folio
#

Oh thank you ! I really want ot write this message of thanks please, where am I allowed to? @velvet compass

velvet compass
#

Don't have so many mentions πŸ‘

cerulean folio
#

but I wrote a thanks message to all people that helped me and I'm not allowed to dm them

#

I need to express my gratitude since those helped me achieve a thing that was very important to me please

slate swan
#

Don't tell me I got mentioned cz I got a ghost ping

jovial urchin
#

How do I go about structuring a discord bot? Like whats the best way to design it

paper sluice
slate swan
alpine cove
#

this will use following endpoint: POST/channels/{channel.id}/messages/bulk-delete

#

and can only be used on guild channels

slate swan
cerulean folio
#

Today i finally deployed my bot and it's now being actively used by 8k+ people !
I have always been told that I'm talented, and I always believed in my capacities ngl but, there was one thing I always struggled with:
Instead of getting things done, I'm more likely to try deepen my knowledge and improve what I do before I release it (and that's not only for coding, but anything I do in my life, even when I organise a party at my house for ex.), and often get overwhelmed and feel like i'll never achieve it the way it should be which is a very wrong belief !
Through this project I kept the focus on the practical aspect. I wanted to release a bot that could solve a problem, no matter if it's not perfect or could be improve or could solve more problems.

And I did it ! And it was very tough, because I was clueless and was using discord.py for the first time !

So since I really am gratefull to all the people that helped me on #discord-bots, I wanted to adress special thanks and love to @Ashley V#0871 , @sz_skill#5551 , @sarth#0460 , @Sparky#3940, @Ryuga#1114 , @greyblue92#0001 , and @Robin J#2415
Love you guys β™₯️

#

I hope they'll all read it pleadingmelt

slate swan
#

love you too

#

nvm

cerulean folio
#

I SAW IT ||and i liked it please ||

copper gulch
#

I have a question, am I allowed to like ask help about anti-nuke bot? is it legal?

slate swan
cerulean folio
jovial urchin
copper gulch
#

so is there a way to like make a discordBot know if the bot is a nukeBot or a moderationBot, cause in my idea is: if the bot is deleting a trap channel then it will automatically get banned and the user that invited that nuke bot will also get banned, is this accurate πŸ˜‚

loud junco
#

me back after years:

dusky pine
alpine cove
loud junco
#

i mean back with building my bot

cerulean folio
loud junco
#

because replit trashed me

copper gulch
upbeat gust
slate swan
loud junco
copper gulch
#

minimal πŸ˜‚

paper sluice
# slate swan - minimal imports - use Bot - sub-classing the Bot class - logging - up-to-date ...
from abc import ABC
from functools import partial
import re
from textwrap import shorten, wrap
from typing import Optional, Pattern

from aiohttp import ClientSession
from async_lru import alru_cache
from bs4 import BeautifulSoup
import discord
from discord import app_commands, Embed, SelectOption
from discord.ext import commands
from discord.ext.menus import ListPageSource
from wikipediaapi import Wikipedia

from ryubot import RyuBot
from utils.abstract import check_author
from utils.paginator import Paginator
from utils.utilz import color

pithink is this minimal?

upbeat gust
jovial urchin
upbeat gust
unkempt canyonBOT
#
Fat chance.

No documentation found for the requested symbol.

upbeat gust
#

idk how to use this bot

slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
slate swan
#

have to mention the proper path

upbeat gust
#

oh my god its case sensitive

slate swan
paper sluice
#

why?

slate swan
#

why use that πŸ˜”

#

buttons ftw

paper sluice
slate swan
loud junco
paper sluice
# slate swan buttons ftw

im using buttons, thats just a class with some attrs i use to run my paginator. INstead of indexing a list of embeds

dusky pine
shrewd apex
#

first is necessary then minimal comes to play

slate swan
#

better fit those imports into one line instead 😐

shrewd apex
#

pep gonna kill u

paper sluice
#

wikipediaapi doesn't do it all

shrewd apex
#

79...

slate swan
shrewd apex
#

πŸ™ˆ

slate swan
dusky pine
#

rewrite that command in Rust so you only have to import subprocess 😍

copper gulch
#

my code has 35 lines of Import commands

#

....

dusky pine
paper sluice
#

its for scraping the table, ik pandas does it as well but that will mean i have to learn it first and its sync. the wikiapi is sync so minimizing the use

slate swan
#

Hi guys, how can i create the new "Slash Commands" ?

slate swan
shrewd apex
#

i didnt even get a mentionπŸ₯²

slate swan
#

check the pins

slate swan
shrewd apex
slate swan
#

yeah, i see it

#

sec i will see

#

yerl check the pins 😭

#

asher being uwu

shrewd apex
#

indeed

slate swan
#

asher is uwu

shrewd apex
#

i gave a 3hr exam and sarth was sleeping i feel so miserable today

#

😭

slate swan
#

yeah

shrewd apex
shrewd apex
slate swan
paper sluice
shrewd apex
paper sluice
#

oh ok

slate swan
#

thanks !

slate swan
jovial urchin
paper sluice
slate swan
slate swan
slate swan