#discord-bots

1 messages · Page 1128 of 1

slate swan
#

You have not installed a module

paper sluice
#

pip install numpy, and this is not the right channel for this

slate swan
#

Delete the message

#

You have your bot token there :)

#

So go on the Developer Portal and reset it now

glad cradle
#

gnam

paper sluice
#

ah just ignore it

slate swan
#

@velvet compass Seen you're active, may you delete the message? It contains their bot ID and the user doesn't seem to react.

velvet compass
#

It isn't reacting since its a photo

paper sluice
#

what isn't?

slate swan
velvet compass
#

@slate swan I removed your message since it contained your bot token. Please take the time to reset the token to make sure it is not compromised

velvet compass
slate swan
#

Yeah realized you meant the bot filter bunHappy

slate swan
scarlet rune
#

hmm we'll see since i use slash

unkempt canyonBOT
slate swan
#

Dear please tell me what is wrong?

#

Once again, you have not installed the package

#

pip install tkinter

#

Reading the error will help you find what package you're missing

#

Especially for the next time

austere gust
#

Yo

@tasks.loop(seconds = 60) # repeat after every 60 secondss
async def myLoop():
    await bot.wait_until_ready()
    async with aiohttp.ClientSession() as session:
        async with session.get('http://87.237.52.47:30226/players.json') as response:
            data = await response.read()
            hashrate = json.loads(data)
            data2 = [player["name"] for player in hashrate]
            print(data)

            
            

    embed = discord.Embed(

        title= 'Szerver Státusz',
        description = f"Információk: Ha problémád adódik a csatlakozással, nyiss egy ticketet!" , 
        color= 0x206694
    )
    embed.add_field (name= "Szerver Státusz:", value = ('\N{WHITE HEAVY CHECK MARK}') , inline= True)
    embed.add_field (name= "Online Játékosok", value = len(data2) , inline= True)
    embed.add_field(name= "Játékosok", value = ", ".join(data2) if data2 else "---" , inline= False)

    channel = bot.get_channel(962050444031557692)
    message = await channel.fetch_message(991736240749695108)
    await message.edit(embed=embed)
    await message.edit(content="", embed=embed)


myLoop.start()```
When I start the bot, I get this error:
```PS C:\Users\Realm\Desktop\bot> & C:/Users/Realm/AppData/Local/Programs/Python/Python310/python.exe c:/Users/Realm/Desktop/bot/main.py
Traceback (most recent call last):
  File "c:\Users\Realm\Desktop\bot\main.py", line 176, in <module>
    myLoop.start()
  File "C:\Users\Realm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\tasks__init__.py", line 398, in start
    self._task = asyncio.create_task(self._loop(*args, **kwargs))
  File "C:\Users\Realm\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 336, in create_task
    loop = events.get_running_loop()
RuntimeError: no running event loop
sys:1: RuntimeWarning: coroutine 'Loop._loop' was never awaited
PS C:\Users\Realm\Desktop\bot>```
slate swan
#

yes i read i tried to install but it doesn't find it. that's why I wrote it, I thought maybe I wrote the command incorrectly

austere gust
#

where is the rror still no idea

torn sail
heady sluice
#

please show the async part in the source code

torn sail
#

myLoop.start() is a sync function that creates a task tasks.Loop._loop

heady sluice
#

👍

torn sail
#

@austere gust you need to start the loop in something like the setup_hook

heady sluice
#

well that's not true either

#

this is the example of the docs

torn sail
#

well if not using cogs yeah

rare saddle
#

How to make a check that the bot was kicked manually from the voice channel

austere gust
#

but now it doesn't updating the message 💀

austere gust
#

I uploaded to my vps, and it stopped working

#

when I started on my pc, it worked

#

💀

torn sail
#

because that code would work in earlier versions

austere gust
#

and I am using v2 too

torn sail
austere gust
#

bro I downloaded the same

#

I saved the link for my self

#

and it is on the vps too

torn sail
slate swan
#

Dear. entered pip install tk and it still gave an error. please tell me what it can be?
although when I enter pip install tkinter it says that there is no such module

austere gust
#

well

#

there is no erros now, but the message isn't updated..

heady sluice
#

oh so the task issue is new

torn sail
austere gust
torn sail
#

its still the same

austere gust
#

well

#

how to fix it then

heady sluice
torn sail
heady sluice
#

yeah that's the better example

#

but what's the async with bot for

torn sail
heady sluice
#

oh k makes sense

#

kind of

austere gust
#

ty all

idle laurel
#

when im trying to auto delete a interaction after sent nothing happens,
await interaction.response.send_message("Suggestion sent!", ephemeral=True, delete_after=10)

i dont get an error code, the message just doesnt get deleted

torn sail
#

the user can only dismiss them

idle laurel
#

oooh, thats gash. no worries cheers

scarlet rune
slate swan
#

👍

paper sluice
scarlet rune
#

@slate swan hmm it still returns None(offline) st = inter.guild.get_member(self.bot.user.id).status

scarlet rune
#

Yeah my bot does have that

#

wait a minute .-.

scarlet rune
slate swan
#

the command is named info not staff fyi

#

the cog has nothing to do with the command name

#

unless it's a subclass of GroupCog

paper sluice
#

wait u can group cogs?

slate swan
paper sluice
#

i thought GroupCog was like command groups

pliant gulch
#

What would grouping cogs even entail

slate swan
#

what so it's a subclass of GroupCog?

paper sluice
slate swan
#

ah, can I see whole of the cog?

#

...

#

oh wait, you werent creating the commands using the group variable smh

#

Dear, tell me what could be wrong?

balmy bobcat
#

add encoding="utf-8" in your open

#

with open("yourfile.txt","r",encoding="utf-8")

eternal violet
#

Afternoon all - is there anywhere I can ask for advice on Slack bots?

scarlet aurora
#
role = discord.utils.get(guild.roles, name="[I] Member")``` is [] interfering in the name?
sick birch
scarlet aurora
sick birch
#

What's the issue?

eternal violet
sick birch
#

Well is the role [I] Member in discord?

#

The name has to match exactly character for character to the one on discord

scarlet aurora
#

yes

sick birch
#

And it's still returning None?

scarlet aurora
#

yeah

#

@sick birch can I have 2 cog listener for on raw reaction in the same py file?

sick birch
#

Then it's either an intents issue or the guild roles may not be cached

sick birch
scarlet aurora
#
    @commands.Cog.listener()
    async def on_raw_reaction_remove(self, payload):``` like this?
sick birch
#

Yes

scarlet aurora
#

yeah idk why it's not working

#

it works for the other reaction role event

#

sick birch
#

What's not working? the utils.get or the listener?

scarlet aurora
#

white_check_mark right? or white check mark

scarlet aurora
sick birch
#

And what about the listener is not working?

scarlet aurora
#
    @commands.Cog.listener()
    async def on_raw_reaction_add(self, payload):
        message_id = payload.message_id
        if message_id == 991788878228897892:
            guild_id = payload.guild_id
            guild = discord.utils.find(lambda g: g.id == guild_id, self.bot.guilds)

            if payload.emoji.name == 'white check mark':
                role = discord.utils.get(guild.roles, name="[I] Member")

            member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
            if member is not None:
                await member.add_roles(role)

    @commands.Cog.listener()
    async def on_raw_reaction_remove(self, payload):
        message_id = payload.message_id
        if message_id == 991788878228897892:
            guild_id = payload.guild_id
            guild = discord.utils.find(lambda g : g.id == guild_id, self.bot.guilds)

            if payload.emoji.name == 'white check mark':
                role = discord.utils.get(guild.roles, name="[I] Member")

            member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
            if member is not None:
                await member.remove_roles(role)```
#

there's the code

sick birch
#

Why are they the same?

scarlet aurora
#

I have another listener for reactions and it works, it's the exact same

scarlet aurora
sick birch
#

It's not white check mark

scarlet aurora
#

i know

#

I tried white_check_mark too

sick birch
#

Not sure exactly what it is, but try printing it

#

print(payload.emoji.name) and react with the emoji on discord

scarlet aurora
#

the listener wont work

sick birch
#

Can you try printing the payload.emoji.name as the first line in the listener?

#

That's a good step towards diagnosing the issue

scarlet aurora
#

doesn't work

sick birch
#

Okay, do you have the proper intents enabled then?

scarlet aurora
#

yep

sick birch
#

Can I see the intents?

scarlet aurora
#
intents = discord.Intents.default()
intents.members = True

bot = commands.Bot(command_prefix=">", help_command=None, intents=intents)```
sick birch
#

Try discord.Intents.all()

scarlet aurora
#

nope

#

doesn't work py intents = discord.Intents.default() intents.members = True discord.Intents.all()

sick birch
#

Can I see the new on_raw_reaction_add function?

scarlet aurora
#

wdym

scarlet aurora
#

what would be new about it

sick birch
#

intents = discord.Intents.default()

scarlet aurora
#

?

sick birch
scarlet aurora
#

yeah it didn't work at all

sick birch
#

Can I see your intents again, just to make sure you've coded it right

scarlet aurora
#
intents = discord.Intents.default()
intents.members = True

bot = commands.Bot(command_prefix=">", help_command=None, intents=intents)```
sick birch
#

You haven't changed anything

scarlet aurora
#

yes

#

because what you told me to put killed the programme instantly

sick birch
#

Use discord.Intents.all() instead of discord.Intents.default()

sick birch
#

If you put it in the right place it shouldn't crash instantly

scarlet aurora
#
intents = discord.Intents.all()
intents.members = True

bot = commands.Bot(command_prefix=">", help_command=None, intents=intents)``` like this?
sick birch
#

Right

scarlet aurora
#

kills programme instantly..

sick birch
#

Any errors?

slate swan
#

Most likely not enabled the privileged intents

scarlet aurora
#

I did

sick birch
#

Do you get any errors when it crashes? Just to be sure

scarlet aurora
#

no, it worked now for some reason

#

now what?

sick birch
#

Can I see the new listener with the print statement?

#

Just to ensure it's in the right place

#

We need to figure out if the event's coming through at all

slate swan
#

Why would you enable all the intents, if you don't need all of these privileged intents though?

sick birch
#

Just for testing at the moment

#

We can narrow it down just to what we need later

scarlet aurora
sick birch
#

And when you react on discord, nothing is printed in console?

scarlet aurora
#

nope

sick birch
#

Okay, are you actually loading the cog?

scarlet aurora
#

yes

#

every other thing in the file runs

sick birch
#

Are there commands in that cog that work?

scarlet aurora
#
def load():
    for filename in os.listdir('./cogs'):
        if filename.endswith(".py"):
            bot.load_extension(f'cogs.{filename[:-3]}')
    
load()```in main
scarlet aurora
sick birch
#

Hmm.. can I see the developer page for your bot?

#

Make sure the right things are switched on

wicked atlas
#

Are you using d.py 2.0?

scarlet aurora
#

the other raw reaction add works...

sick birch
#

Did you put a print in both?

#

And the other one works?

slate swan
scarlet aurora
slate swan
#

With an error message

sick birch
#

I wonder what's special about the other one that works

#

Can you paste the code for both of your listeners?

slate swan
#

Wait how can you start the bot with all intents in code but not crash while not having them all enabled in the developer portal

scarlet aurora
#
    @commands.Cog.listener()
    async def on_raw_reaction_add(self, payload):
        message_id = payload.message_id
        if message_id == 991482553959731352:
            guild_id = payload.guild_id
            guild = discord.utils.find(lambda g: g.id == guild_id, self.bot.guilds)

            if payload.emoji.name == 'roblox':
                role = discord.utils.get(guild.roles, name="Roblox")
            elif payload.emoji.name == 'minecraft':
                role = discord.utils.get(guild.roles, name="Minecraft")
            elif payload.emoji.name == 'brawlhalla':
                role = discord.utils.get(guild.roles, name="Brawlhalla")

            member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
            if member is not None:
                await member.add_roles(role)

    @commands.Cog.listener()
    async def on_raw_reaction_remove(self, payload):
        message_id = payload.message_id
        if message_id == 991482553959731352:
            guild_id = payload.guild_id
            guild = discord.utils.find(lambda g : g.id == guild_id, self.bot.guilds)

            if payload.emoji.name == 'roblox':
                role = discord.utils.get(guild.roles, name="Roblox")
            elif payload.emoji.name == 'minecraft':
                role = discord.utils.get(guild.roles, name="Minecraft")
            elif payload.emoji.name == 'brawlhalla':
                role = discord.utils.get(guild.roles, name="Brawlhalla")

            member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
            if member is not None:
                await member.remove_roles(role)```This is the cog listener that works
sick birch
#

The 2nd one is the one that works?

scarlet aurora
#

both of those

sick birch
#

If they both work then what was the issue in the first place?

scarlet aurora
#

the other 2 don't work

sick birch
#

Okay.. can I see the code for the ones that don't work

sick birch
#

Ah, they look identical

scarlet aurora
#

-_-

sick birch
#

And all 4 of these are in the same cog?

scarlet aurora
#

i asked u at the start if there can be multiple of these cog listeners

#

and you said yes

sick birch
#

Which there can be, yes

#

When I asked you to put the print statement, did you put it in the one that worked or the one that didn't?

scarlet aurora
#

the one that did not

#

obviously

sick birch
#

And it was the first line, and it still didn't work. Okay, strange

scarlet aurora
#

yes

#

we are on the same 📄 now

sick birch
#

!paste Tell you what. Can you paste everything in that file in here

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.

sick birch
#

Don't leave anything out except confidential stuff

scarlet aurora
#

yeah I got no confidential stuff don't worry

slate swan
# balmy bobcat ``with open("yourfile.txt","r",encoding="utf-8")``
e_сross = open( "./emoji/general/crosss.txt", "r", encoding="utf-8").readline()
e_hp = open( "./emoji/сharacteristics/hp.txt", "r", encoding="utf-8").readline()
e_gems = open( "./emoji/resources/gems.txt", "r", encoding="utf-8").readline()
e_profession = open( "./emoji/profession/profession.txt", "r", encoding="utf-8").readline()
e_clan = open( "./emoji/clan/clan.txt", "r", encoding="utf-8").readline()
e_bank = open( "./emoji/general/bank.txt", "r", encoding="utf-8").readline()
e_auction = open( "./emoji/general/auction.txt", "r", encoding="utf-8").readline()
e_earthmap = open( "./emoji/general/earthmap.txt", "r", encoding="utf-8").readline()
e_moonmap = open( "./emoji/general/moonmap.txt", "r", encoding="utf-8").readline()
e_inventory = open( "./emoji/general/inventory.txt", "r", encoding="utf-8").readline()
e_team = open( "./emoji/general/team.txt", "r", encoding="utf-8").readline()
e_donat = open( "./emoji/general/donat.txt", "r", encoding="utf-8").readline()

I did it at all, but the panel still gives an error for some reason (((

sick birch
scarlet aurora
#

the add and remoev

#

the ones with minecraft, roblox work

sick birch
#

Okay, just want to make sure since like I said they look almost identical

slate swan
#

That's my point

sick birch
#

@scarlet aurora can you replace print(payload.emoji.name) with something else like print("Event works") or whatever

scarlet aurora
#

you have the code, why don't you do it to your "liking" since I'm probably doing it wrong

slate swan
#

They have all intents enabled in code, yet only one activated in the developer portal. It should instantly crash, unless they've changed something in the past months I haven't touched Python.

sick birch
sick birch
scarlet aurora
#

I'll test it now

#

doesn't work

sick birch
#

The code linked has 4 listeners, all of them on_raw_reaction_add, the first 2 don't work while the last 2 do work

#

Which is what stumps me because either they should all work or none of them should work

#

Oh wait, didn't notice that

#

but yeah add and remove

#

still.. should all work

#

@scarlet aurora instead of printing something to console, try sending a message to discord instead. Maybe you have something that's eating up any stdout

#

Like await bot.get_channel(payload.channel_id).send("event works")

scarlet aurora
#

ight

slate swan
#

Dear please tell me what could be wrong?

sick birch
#

Don't think so, as the event doesn't even get called in the first place (no print statement)

scarlet aurora
#

@sick birch

#

so uh, ur gonna hate me

sick birch
#

😔

scarlet aurora
#
intents = discord.Intents.all()
intents.members = True

bot = commands.Bot(command_prefix=">", help_command=None, intents=intents)``` killed my programme though
#

now that I saved it

sick birch
#

Yeah that's expected

#

You don't have all the privledged intents enabled in the dashboard

scarlet aurora
#
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
    self._check_closed()
  File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001EEF6EB4AF0>
Traceback (most recent call last):
  File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
  File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
  File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
  File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed

C:\Users\llVll\Desktop\Projects\TMG Bot .git>``` instant crash
slate swan
sick birch
sick birch
scarlet aurora
#

i'll go back to default

#

done

slate swan
#

I haven't touched it for ages so I thought it eventually had changed

scarlet aurora
#

now we're back at square 1

slate swan
#

Still found it weird but yeah

sick birch
scarlet aurora
#

nothing works

scarlet aurora
sick birch
#

😔 does the print statement still work though

#

i just want to make sure the events are actually getting through

#

if they are it should just be a logical issue which is easy to solve

scarlet aurora
sick birch
#

And after it was saved of course

scarlet aurora
dry kelp
#

@sick birch Do you have any SQL knowledge ?

sick birch
dry kelp
#

its not really about the database

#

its about my models

sick birch
sick birch
scarlet aurora
#

ight, 1 sec

sick birch
dry kelp
#

people don't really reply there 🤔

sick birch
#

well.. claim a help channel maybe

dry kelp
#

nobody replies there either

sick birch
#

Not much else you can do other than wait. We can't all post our questions in #discord-bots because that's where everyone's active

dry kelp
#

i did not

scarlet aurora
#

it's enabled now

woven summit
#

Hello I want to get bans in a server but I also want to set the limit to 5k is this possible ? I tried this guild.bans(limit=5000) but I got this error (TypeError: bans() got an unexpected keyword argument 'limit')

scarlet aurora
#

@sick birch

woven summit
#

any suggestions?

dry kelp
#

why would u get 5000 bans first of all?

woven summit
#

This server has so many bans xD

dry kelp
#

why don't u just pull every member banned in a guild put it in a list then enumerate pages

woven summit
#

1k isn't enough

sick birch
dry kelp
#

@woven summit dms

scarlet aurora
#

yes

sick birch
#

Does the listener print something?

scarlet aurora
#

doesn't work

sick birch
#

Do the other commands work?

#

Try putting a print statement in all 4 listeners and see if any of them work

#

Make sure they're all different prints so you can tell which one printed

scarlet aurora
#

yes

sick birch
#

And let me know what happens

scarlet aurora
sick birch
#

I think I will at this point

scarlet aurora
#

a grand total of NOTHING

sick birch
#

Better than before

#

At least now none of them work

scarlet aurora
#

so you've done bamboozled me??

#

all part of your scheme?

sick birch
#

Do the other commands work though?

scarlet aurora
#

yes

sick birch
#

Okay, other commands in cog works, but none of the listeners

#

We're getting somewhere

#

And double checking, but you have all the intents enabled, both in dashboard and in the code?

scarlet aurora
#

yes

sick birch
#

Hmm... that's very odd

scarlet aurora
#

the other listeners work

sick birch
#

Which other ones? The ones in other cogs?

scarlet aurora
#

yeah

#

and don't worry, I saved the files

sick birch
#

Are the listeners in the other cogs also on_raw_reaction_add and on_raw_reaction_remove?

scarlet aurora
#

yes

#

@sick birch

sick birch
#

Hmm, not sure then. Probably just a d.py bug and not much you can do about it

#

If you're 100% sure everything else is running properly

pliant gulch
#

🤔

scarlet aurora
#

alright @sick birch .... thanks for nothing

flat solstice
#

So I'm making a interactive FAQ with two dropdowns: A main page with a dropdown and then each topic in the first dropdown opens up to show a message with another dropdown, Is there a way I can pass the value of a SelectOption from one dropdown to the other?

dry kelp
#

what are u trying to do

warped mirage
#

discord.app_commands.errors.CommandInvokeError: Command 'userinfo' raised an exception: AttributeError: 'Interaction' object has no attribute 'author' any ideas?

slate swan
#

how install my discord bot in a vserver with debian?

sick birch
# dry kelp what are u trying to do

We were debugging a strange error for the better part of an hour lol. They have a few on_raw_reaction_add listeners, which weren't even getting called (we knew this because we had print statements as the first line). Other commands in that cog worked just fine. Other listeners of the same type work just fine in other cogs. They're certain all intents are enabled and are set up properly

dry kelp
#

the event is not being called when he adds the reaction.. that's what he said

sick birch
#

It was. They saved it, same issue afterward

smoky cedar
#

What is the recommended library for slash commands now? And would it be much work to switch over from discord_slash?

#

Is there an issue with discord_slash that should make me want to change? And is disnake that much better than discord.py?

sick birch
#

They're both relatively on the same level. personal preference

#

The main issue with discord_slash is that it was hastily put together in that period when everyone was panicking and didn't know which library to use

#

Right after discord.py announced it was discontinuing development, which was not long after discord themselves announced that migrating to slash commands would be mandatory

#

So the implementation isn't necessarily great, and probably not upkept as well as discord.py or disnake which seem to be the big contenders

smoky cedar
#

And thanks for all the info

sick birch
#

That's beyond me. There was a big gist about it, but I couldn't be bothered to read it myself

#

Both personal reasons for Danny and others that were in the gist

smoky cedar
#

Does documentation exist for slash commands in Discord.py? Can't seem to find any

#

beautiful

slate swan
#

moduleNotFoundError: No module named 'discord' need help pls

sick birch
#

First question.. do you have it installed?

slate swan
sick birch
#

Make sure it's the right version

#

To be sure use this syntax:

python3 -m pip install discord.py
slate swan
#

can i use my windows powershell? or the console in pycharm

pliant gulch
#

PyCharm has its own venv did you install it in there?

slate swan
#

nope installed with powershell

#

and how i install this with venv?

#

my system can does not find the git link

#

ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

#

okay its done

#

Can I put the bot on a vserver with debian so that it is online 24/7?

#

i dont can start my bot this error: TypeError: intents parameter must be Intent not <class 'disnake.flags.Intents'>

sick birch
#

How long is a "while"?

smoky cedar
#

What do you guys name your cogs?

slate swan
smoky cedar
slate swan
smoky cedar
slate swan
#

its all personal preference really

smoky cedar
#

I have a task that loops, its a very long method that calls one other helper method. Should that get a cog? And then my slash commands in a separate one? Or should one really long command be split into its own cog itself?

deep osprey
#

Someone is using PyCharm here?

smoky cedar
deep osprey
#
  File "E:/Windows Apps/Test/python/discord bot/main.py", line 2, in <module>
    my_secret = os.environ['TOKEN']
  File "C:\Program Files\Python37\lib\os.py", line 681, in __getitem__
    raise KeyError(key) from None
KeyError: 'TOKEN'

Process finished with exit code 1``` I got this error when using .env files, I installed ENV plugin
#
my_secret = os.environ['TOKEN']
bot.run(my_secret)``` here is my code
slate swan
#

!e print({1:2}[3])

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | KeyError: 3
smoky cedar
#

I don't think I know anything about ENV plugin, but I usually go to Edit Configurations for my file, go to configuration tab, and you can check if system environment variables are included there or if you have the ones you want set @deep osprey

deep osprey
#

thanks ❤️

simple kettle
#

Does anyone know how to get the ID of a custom emoji

fresh iron
fresh iron
#

991866568638210108

simple kettle
#

Isn’t that the message id

#

991866712519614565

#

It’s different

slate swan
unkempt canyonBOT
slate swan
#

if youre asking for the format its <name:id>

fresh iron
#

TypeError: Client.event() missing 1 required positional argument: 'coro'

fresh iron
#

didn't call anything

torn sail
#

No () after @client.event

slate swan
#

aka calling the deco lol

fresh iron
slate swan
#

python doesnt lie, so check your other lines!

torn sail
#

Yes

#

That’s what I guessed but idk

austere vale
#

how do i add the account age to my embed like dyno?

slate swan
#

!d discord.Member.created_at

unkempt canyonBOT
#

property created_at```
Equivalent to [`User.created_at`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.created_at "discord.User.created_at")
austere vale
#

tyy

flint isle
#

can i mention @everyone in a disnake embed?

fading marlin
#

you can't mention (ping) anything in embeds

flint isle
fading marlin
#

you can still get that ui (?), it won't ping anyone though

flint isle
#

oh. how can i mention then since i need to notify the group when the embed was sent should i just have it send a seprate message that mentions and tells them to check the above mention?

fading marlin
#

mentioning is only allowed in descriptions and field values too

flint isle
#

wait will that ping them?

fading marlin
#

nope

fading marlin
#

if you do the @fading marlin thing in a title, it'll stay as @fading marlin instead of converting to @fading marlin

fading marlin
flint isle
#

wait how would that code look

fading marlin
#

.send("@ bonk", embed=embed)

#

unless disnake's Messageable.send for some reason only takes keyword arguments, it should look like that

flint isle
#

ah

#

ill try that real quick

#

do i just do .send("@everyone", embed=embed)

fading marlin
#

try it and see

quaint epoch
flint isle
#

it worked lol

quaint epoch
#

you need to do .send(guild.default_role.mention)

flint isle
#

i needed to mention the everyone since it was a dnd anoucment for our next session

pliant gulch
quaint epoch
#

oh yeah, and i just remembered~

#

dammit i forgot

#

screw my brains memory leak

fading marlin
#

I'm very guilty of this myself... blobsweatsip

pliant gulch
#

str(str())

sick birch
#

!e

print(str(str(str())))
unkempt canyonBOT
#

@sick birch :warning: Your eval job has completed with return code 0.

[No output]
robust fulcrum
#

Hi robin

#

Me working on my comamnd challenge 😴

#

Am i allowed to use slash commands?

slate swan
#

optional args in slash commands? yes

robust fulcrum
#
import discord
from discord.ext import commands
from discord import app_commands

class MySlashCog(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
    
    @app_commands.command(name="ping", description="...")
    async def _ping(self, interaction: discord.Interaction):
        await interaction.response.send_message("pong!")

I am not able to understand what would be setup function for it

slate swan
fading marlin
#

why is self there?

robust fulcrum
slate swan
#

oops

fading marlin
#

ah

fading marlin
robust fulcrum
#

But i think it's different with slash commands

fading marlin
#

unless something changed that I'm not aware of, nope. You're setting up a cog 🤷

robust fulcrum
#
import discord
from discord.ext import commands
from discord import app_commands

class MySlashCog(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
    
    @app_commands.command(name="ping", description="...")
    async def _ping(self, interaction: discord.Interaction):
        await interaction.response.send_message("pong!")
    
class MySlashBot(commands.Bot):
    def __init__(self) -> None:
        super().__init__(command_prefix="!", intents=discord.Intents.default())
    
    async def setup_hook(self) -> None:
        await self.add_cog(MySlashCog(self))
        await self.tree.copy_global_to(discord.Object(id=123456789098765432))
        await self.tree.sync()
        
bot = MySlashBot()

bot.run("token")

This is an internal cogs but idk how to do in external cogs

#

The slash commands

fading marlin
#

oh, you just self.add_cog in your setup_hook iirc

#

not sure why you'd want to add a cog inside your main file though rooThink

robust fulcrum
fading marlin
#

why don't you just add your slash commands using your bot's instance though?

slate swan
#

!d discord.ext.commands.Bot.load_extension

unkempt canyonBOT
#

await load_extension(name, *, package=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Loads an extension.

An extension is a python module that contains commands, cogs, or listeners.

An extension must have a global function, `setup` defined as the entry point on what to do when the extension is loaded. This entry point must have a single argument, the `bot`.

Changed in version 2.0: This method is now a [coroutine](https://docs.python.org/3/glossary.html#term-coroutine "(in Python v3.10)").
robust fulcrum
#

I want slash commands in cogs

slate swan
#

use this for external cogs

robust fulcrum
#

Ik bro

slate swan
#

you already have it don't yog?

robust fulcrum
#

But not with slash commands

slate swan
#

its the same

robust fulcrum
#

I am using slash comannds first time

#

But do we need to provide guild_ids to make it work?

slate swan
#

no

robust fulcrum
#

Will it be global? If yes 😁

slate swan
#

you need that only if you want the commands to be limited to some servers

robust fulcrum
#

Ty anyway

robust fulcrum
# slate swan you need that only if you want the commands to be limited to some servers
import discord
from discord.ext import commands
from discord import app_commands

class MySlashCog(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
    
    @app_commands.command(name="ping", description="...")
    async def _ping(self, interaction: discord.Interaction):
        await interaction.response.send_message("pong!")

async def setup(bot):
    await bot.add_cog(MySlashCog(bot))

Is it fine?

#

I just run the code but my slash comamnd not came

slate swan
#

seems fine but is the extension added?

robust fulcrum
#

Yep

#

It's even loaded

#

But command not came

slate swan
#

wait for some time, reload your discord, turn integrations off and on

dreamy ruin
#

hey sorry if I'm butting in mid conversation but, I was wondering if anyone could help? I want to have my discord bot take user input, turn it into a variable and insert the variable into this BeautifulSoup4 command: ```python
definitions = doc.find_all(text='insert user input here')
print(definitions[0].parent.parent)

to then put into this discord.py bot command:
```python
async def on_message(message):
    if message.content.startswith('/i '):
        await message.channel.send('')

I reserved a help channel and then immediately saw this channel and figured it would be a better place to ask, since its more directly related

fading marlin
#

could you be a bit more specific with your question?

dreamy ruin
#

Yeah, sorry! I want my discord bot to be able to parse the HTML file for a glossary page, and when a user asks it to find a specific term, spit out the definition for that term. I've already managed to code the HTML parsing, but I need to have it so that instead of using the code I made with a sample term, it will search for the one that the user asks for. I was told the best way to do that was to take input and turn it into a variable and plug it into that first code block.

#

I hope that's more clear

sick birch
#

You're on the right track, you can get the message content using message.content. You can store it in a variable like so:

user_input = message.content

and do whatever you want with it (e.g pass it into another function)

fading marlin
#

sounds like you want to make some sort of dictionary?

sick birch
#

If you are trying to make a dictionary for words and their definitions, then there are cool APIs and you don't have to mess with the whole web scraping thing

dreamy ruin
#

well, I'm using requests to just take info from the page, since it's all there. I have the right method of finding the tag for all the text I want, it's just getting the discord command to sift that info with something the user sends instead of just using the one sample term I have in the string of the code.
(this is how it currently is, with the sample term in)

url = 'https://pflag.org/glossary'
 
result = requests.get(url)
doc = BeautifulSoup(result.text, 'html.parser')

definitions = doc.find_all(text='AFAB')
print(definitions[0].parent.parent)
sick birch
#

Okay, sounds good. Just use the message.content inside your on_message command, which contains the user's input

#

Pass it into your HTML parser/definition finder function, instead of using the sample term

fading marlin
#

switch to aiohttp if you're sending a request every time the function executes too

robust fulcrum
dreamy ruin
sick birch
#

Keep the if statement as it is, and use message.content inside

dreamy ruin
#

oh just message.content, okay

sick birch
#
if message.content.startswith(...):
  content = message.content
  definition = find_definition(content)
  ...
#

Of course use your actual function instead of find_definition

slate swan
slate swan
robust fulcrum
fading marlin
#

kinda off topic (and I've got no means on criticizing anyone), but is there any reason why one would do ```py
a = "a"
func(a)

instead of simply doing
```py
func("a")

(assuming that in both cases "a" isn't an arbitrary value)?

sick birch
#

You would if a was a function call, or a few nested function calls

slate swan
sick birch
#

If it was anything but just a regular one function call I would probably do that

robust fulcrum
#

Just speak 😂

dreamy ruin
# sick birch ```py if message.content.startswith(...): content = message.content definiti...

I know I'm doing something wrong, but it's not clicking what exactly is wrong. tried recreating it the way you were saying to.

definitions = doc.find_all(message.content)
print(definitions[0].parent.parent)

client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'
    .format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('/i '):
        content = message.content
        definitions = doc.find_all(message.content)
        await message.channel.send(definitions)
sick birch
#

With a discord bot:

channel = bot.get_channel(...)
await some_function_that_needs_channel(channel)

vs

await some_function_that_needs_channel(bot.get_channel(...))
slate swan
robust fulcrum
slate swan
#

that's a global sync too

slate swan
#

then remove that line

slate swan
#

i know

sick birch
robust fulcrum
slate swan
fading marlin
slate swan
#

global syncs don't take an hour anylonger.

robust fulcrum
slate swan
slate swan
dreamy ruin
robust fulcrum
slate swan
#

nicr

pliant gulch
sick birch
#

Actually try this instead definitions = doc.find_all(content)

robust fulcrum
slate swan
#

blocking function 😔

robust fulcrum
#

It's not showing

slate swan
robust fulcrum
#
import discord
from discord.ext import commands
from discord import app_commands

class MySlashCog(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
    
    @app_commands.command(name="ping", description="...")
    async def _ping(self, interaction: discord.Interaction):
        await interaction.response.send_message("pong!")

async def setup(bot):
    await bot.add_cog(MySlashCog(bot))

Code here

slate swan
#

show your syncing part

robust fulcrum
#

Just testing for it and then ill do Asher's challenge

robust fulcrum
slate swan
#

how many times are you syncing?

dreamy ruin
# sick birch Ookay. You sure the indents are set up properly?
  File "/Users/dannychauser/Desktop/Discord Bot - Queercoded/queercoded.py", line 12, in <module>
    definitions = doc.find_all(content)
NameError: name 'content' is not defined```
I think the error is that "content' isn't defined, and it's before the discord command.
robust fulcrum
#

Whats you want me to give?

sick birch
slate swan
robust fulcrum
#

Hmmm

#

🤔

slate swan
robust fulcrum
#

Only cogs part

slate swan
#

So you didn't read it

robust fulcrum
#

I read only using in cogs

slate swan
#

well then go read it now, it explains how syncing in discord.py works and why is it important.

sick birch
# dreamy ruin

Ah found it. The issue is all the way at the top, I thought it was inside the command

#

See the yellow squiggly?

slate swan
dreamy ruin
sick birch
#

Just remove that line. It's already there inside the command

slate swan
#

The content variable is not in the outer scope hence you can't use it at line 12

dreamy ruin
slate swan
#

You should also use Bot instead of Client, and use commands instead of on_message to make your commands.

slate swan
#

Line 12 and 13 must be removed

dreamy ruin
#

Full disclosure, I was following a tutorial so most of that is just from how the guy was doing it in vid

sick birch
#

Let me guess.. Lucas?

slate swan
#

Typical bad guides

sick birch
#

Lol the code looked familiar

dreamy ruin
#

it was actually freeCodeCamp

robust fulcrum
slate swan
#

Sad that nobody has made a good/decent tutorial on YouTube

sick birch
#

Before you get any deeper into that rabbit hole I'd advise you maybe take it down a notch with the tutorials

slate swan
#

and why do you expect every tutorial to have a spoonfeeding example...

sick birch
#

But hey.. it seems you only did it for the basic bot structure and decided to do your own thing after instead of following the entire tutorial. So that's good

slate swan
robust fulcrum
dusky pine
#

someone should make an app like youtube but for good tutorials 😔

robust fulcrum
sick birch
dreamy ruin
sick birch
#

Maybe, if you feel up to it though I'm not one to stop you. Nothing wrong with learning from discord.py, though a bit difficult

slate swan
#

A discord bot might not be the first thing you should do due to its complexity, but if you're a good learner it can get easy/normal to learn from doing a bot

#

Usually I learn a language by looking at its basics/read a book and then by doing an ambitious project

sick birch
#

We also don't want to discourage learning so.. it's up to you

dreamy ruin
# sick birch That too, yes

so this allows me to actually get a response from the bot when I type a message starting with /i, but it just feeds back two brackets

sick birch
#

That means you got back an empty list

dreamy ruin
slate swan
sick birch
#

and doc.find_all(...) didn't find anything

slate swan
#

I mean, you wouldn't be the first one to learn Python by doing a bot

#

So best of luck and amusement in learning bunHappy

sick birch
#

So you might wanna add an edge case like:

definitions = doc.find_all(...)
if definitions:
  # bot found something! ✅
else:
  await ctx.send("No definitions found! ❌") # 😭
robust fulcrum
slate swan
#

what...

dreamy ruin
sick birch
#

Oops, that's my fault. You don't get ctx in an on_message. Use message.channel.send(...) instead

slate swan
#

do you even have a context, cause afaik you were using on_message, h,

sick birch
#

No they don't, that's entirely on me

slate swan
#

😳 a perfect time to introduce them to the ext.commands extension

sick birch
#

As for returning the empty list, try some debugging like manually passing in the same thing you gave in discord

sick birch
slate swan
#

wish I was just as patient as robin 😔

#

wish i was even pateint

dusky pine
robust fulcrum
#
class botclass(commands.Bot):
    def __init__(self):
        super().__init__(command_prefix=">",help_command=None,intents=discord.Intents.all())

    async def setup_hook(self):
        await self.add_cog(cogs.slash(self))
        await self.tree.sync()

bot = botclass()

Is it correct for slash commands?

slate swan
#

patience -> patient

#

ghost ping

slate swan
robust fulcrum
slate swan
#

ps: they are importing the cog file/folder and adding the Cog class using add_cog manually

robust fulcrum
#

Anyway my slash command should work

slate swan
#

....

dusky pine
#

why complicate this, just use a fork 🤷

dreamy ruin
slate swan
robust fulcrum
#

Code jam project is very difficult

dusky pine
#

oh i thought yall were talking about slashes

dusky pine
sick birch
robust fulcrum
dusky pine
#

i don't think it's that hard

slate swan
#

all the answers are literally in the tasks itself

robust fulcrum
#

I think owners of python discord are opening a delivery service

slate swan
#

you just need to find a way to implement it

dusky pine
sick birch
#

You weren't supposed to tell anybody!

robust fulcrum
slate swan
#

I believe anyone with a decent Python knowledge can solve it

sick birch
#

Now that the cat's out of the bag, we're opening a pizza delivery service that delivers for free to all members of pydis 🍕

dusky pine
robust fulcrum
#

I'll order cheese pizza from them

slate swan
robust fulcrum
slate swan
#

how did you see the question then?

dusky pine
dreamy ruin
dusky pine
#

copy the qualifier.py and tests.py file into ur pc, and modify qualifier.py such that it passes the tests in tests.py

slate swan
sick birch
dreamy ruin
#

well moreso the actual content being printed, not necessarily the function

sick birch
#

The actual issue is within your find_all function

dreamy ruin
#

ohhh wait is it because it's missing text=

sick birch
#

The find_all function?

dreamy ruin
#

well, instead of just brackets, its now giving me the word back which is, I think, an improvement?

sick birch
#

Well, we're getting somewhere then

robust fulcrum
dreamy ruin
sick birch
#

Not much we can do about that, as it's within your find_all function. If you're willing to try an alternative, go for a word-definition API, it'll be much easier to work with rather than webscraping. If not, you'll have to try to debug and diagnose find_all and figure out what's going on

dreamy ruin
sick birch
#

Does the website you're currently trying to webscrape have words and their definitions?

dreamy ruin
#

Mhm

sick birch
#

Okay, then a different API shouldn't really be an issue

#

Should also be very simple:

r = requests.get("url")
definition = r.json()
#

With minor tweaks of course but that's 90% of the heavy lifting done with the API

#

Oh, and you can also remove BS4 from your dependencies

dreamy ruin
sick birch
#

Just that. You'll be doing those 2 lines each time someone runs the discord command

#
@bot.event
async def on_message(message: discord.Message) -> None:
  # tweak if necessary
  r = requests.get("url")
  definition = r.json() 

  await ctx.send(f"Definition for {message.content}: {definition}")
#

Of course you'll want to add an if statement or else it'll do this on every message, which is obviously undesirable. But you understand the core concept

#

Anyway, I'm off for the night. Nice chatting with y'all. Ping me with any further questions, and I'll check them out tomorrow morning if I can. Take care 👋

coarse rampart
#

@sick birch bro can you please solve this?

#

Write a user defined function findname(name) where name is an argument in python to delete
phone number from a dictionary phonebook on the basis of the name ,where name is the key.

maiden fable
#

He's asleep

slate swan
slate swan
#

!rule 8

unkempt canyonBOT
#

8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.

slate swan
#

Nobody will solve and do it for you

#

that problem is just like using a dictionary method pop 💀

maiden fable
#

del dict[key]

slate swan
#

!d dict.pop exists

unkempt canyonBOT
#

pop(key[, default])```
If *key* is in the dictionary, remove it and return its value, else return *default*. If *default* is not given and *key* is not in the dictionary, a [`KeyError`](https://docs.python.org/3/library/exceptions.html#KeyError "KeyError") is raised.
robust fulcrum
#

@slate swan slash command still not showing

slate swan
#

you want my condolences or what

robust fulcrum
#

You mean support?

restive osprey
slate swan
#

indents

maiden fable
restive osprey
robust fulcrum
restive osprey
maiden fable
#

Remove the await

restive osprey
#

just run without it?

robust fulcrum
# maiden fable Can u show yr code?
import discord
from discord.ext import commands
from discord import app_commands

class MySlashCog(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
    
    @app_commands.command(name="ping", description="...")
    async def _ping(self, interaction: discord.Interaction):
        await interaction.response.send_message("pong!")

async def setup(bot):
    await bot.add_cog(MySlashCog(bot))
maiden fable
#

Yes

restive osprey
#

got it

maiden fable
dusky pine
maiden fable
#

That ^

slate swan
dusky pine
#

icic

robust fulcrum
maiden fable
#

Weird

#

I never used discord.py 2.0, might wanna ask in discord.gg/dpy but u might wanna try refreshing your discord client by pressing

shrewd apex
#

u never started the setup_hook()

#

so cogs will never load

robust fulcrum
#

It loaded

shrewd apex
#

u have to call setup_hook() in on_ready

#

generally

robust fulcrum
#

But i loaded cogs two times and in console it also printed cogs.slash was already loaded

#

@shrewd apex

maiden fable
maiden fable
robust fulcrum
#

@maiden fable

shrewd apex
torn sail
shrewd apex
#

ic

#

i have a check for rechecking loaded cogs

#

so i didnt notice

robust fulcrum
#

It's giving error

slate swan
#

Read it

torn sail
slate swan
#

'cogs.slash' is already loaded

robust fulcrum
slate swan
#

You've already loaded it above, line 27

#

And now you're loading it again in your for loop, line 40

robust fulcrum
#

I removed in line 40

robust fulcrum
robust fulcrum
#
    @commands.command()
    async def poll(self,ctx,options:int):
        if options <= 10:
            await ctx.send("Type the name of options accordingly",delete_after=3)
            optionlist = []
            option = 1
            def check(msg):
                return msg.author.id == ctx.author.id and msg.channel.id == ctx.channel.id
            while option <= options:
                option = option+1
                await ctx.send("emter the name of option",delete_after=3)
                optname = self.bot.wait_for('message',check=check, timeout=20)
                await optname.delete
                optname = optname.content
                optionlist.append(optname)
            await ctx.send(optionlist)

Guys await optname.delete is not working
How to fix it?

paper sluice
#

bro call delete 💀

robust fulcrum
#

Oh ()

#

😅

robust fulcrum
#

Still error

left idol
#

can i have a 2x2 of embed fields?

paper sluice
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
robust fulcrum
#

So?

paper sluice
robust fulcrum
#

What should I do now?

slate swan
#

cry

vocal snow
robust fulcrum
#
    @commands.command()
    async def poll(self,ctx,options:int):
        if options <= 10:
            await ctx.send("Type the name of options accordingly",delete_after=3)
            optionlist = []
            option = 1
            def check(msg):
                return msg.author.id == ctx.author.id and msg.channel.id == ctx.channel.id
            while option <= options:
                option = option+1
                await ctx.send("enter the name of option",delete_after=3)
                optname = await self.bot.wait_for('message',check=check, timeout=20)
                optname = optname.content
                await asyncio.sleep(1)
                await optname.delete() 
                optionlist.append(optname)
            await ctx.send(optionlist)
paper sluice
#

bro 💀

#

u did optname = optiname.content

robust fulcrum
#

So?

paper sluice
#

it returns a str

#

how r u going to delete the str

robust fulcrum
#

Ohhhhhh

#

It working fine

quick pewter
#

how to make my bot react to all messages from a specific member or role

#

?

vocal snow
#

I don't think so. I'm using pillow to generate the images and caching them. After the image bugs out, I can send the same image from cache and it works fine.
Here's the EmbedProxy of a bugged image:

EmbedProxy(width=900, url='https://cdn.discordapp.com/attachments/959683740857151519/991955939743772712/track.png', proxy_url='https://media.discordapp.net/attachments/959683740857151519/991955939743772712/track.png', height=300)
``` the first URL gives me a GCP error and the other one is invalid
paper sluice
quick pewter
#

Ok

slate swan
#

Hi

paper sluice
#

👋

slate swan
paper sluice
slate swan
dusky pine
#

Funny killerboss github

slate swan
#

reminds me of tetris

cloud dawn
slate swan
#

its the inverted T isnt it

shrewd apex
#

👀

#

i indeed do

vocal snow
#

you indeed do what

loud junco
#

what is code jam

dusky pine
loud junco
#

oo

dusky pine
#

2022's theme is "Websockets"

loud junco
#

no idea what isit

#

;-;

dusky pine
#

honestly same

#

luckily the qualifier isn't related to websockets

warm tulip
#

hey guys how i can create say command?

loud junco
#

?

dusky pine
loud junco
#

my brain ded

dusky pine
#

take the text as argument, and send it back

loud junco
#

idk what id is he trying to say

#

is

cloud dawn
#

More like an echo command.

dusky pine
loud junco
#

hi panda

cloud dawn
#

👋

loud junco
cloud dawn
#

I'm currently working with slash cooldowns, instead of buckets we got lambda functions... great.

slate swan
#
Traceback (most recent call last):
  File "bot.py", line 26, in <module>
    bot.run(token)
  File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 872, in                                                                                                              run
    asyncio.run(runner())
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_compl                                                                                                             ete
    return future.result()
  File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 847, in                                                                                                              runner
    await self.start(token, reconnect=reconnect)
  File "bot.py", line 16, in start
    await self.load_extension('cogs.comand.control_panel')
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", lin                                                                                                             e 995, in load_extension
    await self._load_from_module_spec(spec, name)
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", lin                                                                                                             e 920, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.comand.control_pane                                                                                                             l' raised an error: UnicodeEncodeError: 'latin-1' codec can't encode character '                                                                                                             \u0441' in position 8: ordinal not in range(256) 

Dear please tell me what could be wrong?

thin raft
#

Are you loading a cog in a cog?

#

Send code

cerulean folio
#
2022-06-30 08:37:36 WARNING  discord.http We are being rate limited. Retrying in 3265.66 seconds. Handled under the bucket "855852976630923274:None:/channels/{channel_id}/messages/{message_id}/crosspost"
Stack (most recent call last):

What is rate limit exactly? Sometimes, some people can't use a command on my bot where some other people can, and that's for no reason at all x.x

slate swan
slate swan
slate swan
#

I might be wrong

slate swan
cerulean folio
slate swan
#

no?

#

it's global

slate swan
slate swan
cerulean folio
# slate swan it's global

that's what i do'nt understand, when there's a rate limit, some people can't use the command but some others can... :o

slate swan
#

I'm so sleepy otherwise I would have read it

slate swan
slate swan
slate swan
#

ruyga*

#

rygua*

paper sluice
#

bruh

slate swan
#

ryuga

paper sluice
#

u actually need help :p

cloud dawn
# slate swan lmao yeah, gotta use something like `key= lambda i: (i.user.id, i.guild_id)` rig...

Yeah I came up with this in the meantime ```py
from typing import Callable, TypeVar
from enum import Enum

from discord.app_commands import Cooldown
from discord.app_commands.checks import _create_cooldown_decorator

T = TypeVar('T')

class Btypes(Enum):
guild = lambda i: (i.guild_id, i.guild_id)
channel = lambda i: (i.guild_id, i.channel_id)
user = lambda i: (i.guild_id, i.user.id)

def koeldown(rate: float | int, per: float | int, btype: Btypes) -> Callable[[T], T]:
return _create_cooldown_decorator(btype, lambda interaction: Cooldown(rate, per))

slate swan
#

koeldown

#

nice

#

meh, using the key is better

cloud dawn
#

It doesn't like it tough py_guido

shadow vigil
slate swan
#

nice

cloud dawn
slate swan
#

Hi

cloud dawn
#

The lambda function is just a little odd to have in a decorator imo

slate swan
paper sluice
paper sluice
cloud dawn
shadow vigil
#

i am working with low level of the discord.py and i need to make decorator to check if object == class. for dispatch

#

ops

cloud dawn
paper sluice
#

3.8 doesn't allow lambda decos?

slate swan
#

fr, like commands.cooldown be getting a nice BucketType class

cloud dawn
paper sluice
# cloud dawn Why wouldn't they?
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> @lambda _:_()
  File "<stdin>", line 1
    @lambda _:_()
     ^
SyntaxError: invalid syntax
#

bro why does the date say Mar 15 💀 💀

slate swan
#

Ur pc datetime

slate swan
shadow vigil
#

how do i handle the copyright of the discord.py code?

paper sluice
slate swan
paper sluice
slate swan
#

Oh 💀

paper sluice
#

its 3.8, maybe they didnt allow

#

idc, i dont use 3.8 anyways, it happened to be the default one on my wsl

slate swan
paper sluice
shadow vigil
#

my windows date say its 2:09am

shadow vigil
slate swan
#

Nice sleep

paper sluice
shadow vigil
paper sluice
shadow vigil
#

create an if stm

from typing import Any
class hibot(Clients):
    igonre = False
    def dispatch(self, event_name: str, /, *args: Any, **kwargs: Any) -> None:
        # super() will resolve to Client
        super().dispatch(event_name, *args, **kwargs)  # type: ignore
        ev = 'on_' + event_name
        for event in self.extra_events.get(ev, []):
            if isinstance(object,__class__):
                self._schedule_event(__class__.event, ev, *args, **kwargs)  # type: ignore
            else:
                self._schedule_event(event, ev, *args, **kwargs)  # type: ignore
shadow vigil
robust fulcrum
#

Guys how we can keep value in a field of embed empty?

cloud dawn
robust fulcrum
paper sluice
shadow vigil
cloud dawn
robust fulcrum
#

You mean to keep it empty?

paper sluice
unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

paper sluice
#

😔

cloud dawn
shadow vigil
robust fulcrum
#

Empty value

paper sluice
cloud dawn
#

** **

shadow vigil
#

_ _

paper sluice
#

exploit markdown 💀

slate swan
hollow osprey
#

\

slate swan
#

Just add \

slate swan
robust fulcrum
# cloud dawn ** **
        embes = discord.Embed(title=question,color=discord.Color.blue())
        embes.add_field(name=list[0],value= , inline=False)
        embes.add_field(name=list[1],value= , inline=False)
        embes.add_field(name=list[2],value= , inline=False)
        embes.add_field(name=list[3],value= , inline=False)
        embes.add_field(name=list[4],value= , inline=False)
        embes.add_field(name=list[5],value= , inline=False)
        embes.add_field(name=list[6],value= , inline=False)
        embes.add_field(name=list[7],value= , inline=False)
        embes.add_field(name=list[8],value= , inline=False)
        embes.add_field(name=list[9],value= , inline=False)

Is it fine?

slate swan
#

O shi*

hollow osprey
#

use a for loop

slate swan
#

Ye

cloud dawn
#

||w||

slate swan
#

for x in list:
e.add_field(name=x,value="** **")

paper sluice
slate swan
cloud dawn
#

~~__||_*w*_||__~~

#

art

paper sluice
#

(╯°□°)╯︵ ┻━┻

slate swan
#

┬─┬ ノ( ゜-゜ノ)

cloud dawn
slate swan
#

Why

cloud dawn
slate swan
cloud dawn
slate swan
slate swan
cloud dawn
robust fulcrum
robust fulcrum
paper sluice
robust fulcrum
#

Anyway i did value="** **"

slate swan
robust fulcrum
#

Me testing it now

hollow osprey
#

is there no add_fields? pithink

robust fulcrum
#

It's there

robust fulcrum
#

embed.add_field

cloud dawn
slate swan
#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining. Can only be up to 25 fields.
robust fulcrum
#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining. Can only be up to 25 fields.
slate swan
#

ryuga

paper sluice
#

bro he said fields not field

slate swan
hollow osprey
#

I did say fields

paper sluice
#

huh pithink

slate swan
#

Troll 😔

slate swan
#

who?

#

oh

#

absolutely not

#

oh

paper sluice
#

same joke 💀

slate swan
#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

slate swan
#

this channel is for helping with discord bots not import issues

shrewd apex
#

rip

slate swan
#

pycord has nothing to do with discord bots

slate swan
#

!pip pycord

unkempt canyonBOT
slate swan
#

it's for ffmpeg

shrewd apex
#

hello

slate swan
#

I wish i was home i also want that role 😔

paper sluice
slate swan
unkempt canyonBOT
paper sluice
slate swan
#

pycord with an uwu hyphen

shadow vigil
#

i have little problem i don't know how _schedule_event works...

slate swan
#

Ok

cloud dawn
#

I don't recommend using a protected object unless you have a valid reason.

paper sluice
#

thats called py-cord

slate swan
#

pycord and py-cord are different

cloud dawn
#

Could you send an error code or anything at all?

shadow vigil
slate swan
#

pycord is an FFmpeg wrapper and py-cord is a discord API wrapper

#

¯_(ツ)_/¯

#

nvm what am I saying anymore

cloud dawn
slate swan
#

tried restarting the IDE?

paper sluice
#

run your code, dont depend on pylance for your errors

slate swan
#

oof

cloud dawn
#

Looks like pycharm did you install it trough the package manager or CMD?

slate swan
#

that's vsc panda

#

pip install py-cord

#

^

#

aka the library that sucks

#

noooooooooooo

cloud dawn
#

lmao +1

slate swan
#

py-cord is so uwu

#

boomers

slate swan
#

with the -? if yes then restart vsc and it works

cloud dawn
#

ash calling us boomers and making a big deal out of a - lol

paper sluice
#

DUDE RUN UR CODE, VSC DOESNT KNOW THAT YOU INSTALLED IT OR NOT, PYTHON DOES 😔 😔

slate swan
#

Caps

#

you got multiple versions of python installed?

cloud dawn
#

Windows version of py 😨