#discord-bots
1 messages · Page 5 of 1
!pypi humans
👀
i haven't used threading since i am not too sure if asyncio supports that lib i used concurrent.futures threadpoolexecutor which is said in their docs they support it
thank you
and used it with bot.loop.run_in_executor i had no problems with it till date
!d asyncio.to_thread
coroutine asyncio.to_thread(func, /, *args, **kwargs)```
Asynchronously run function *func* in a separate thread.
Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current [`contextvars.Context`](https://docs.python.org/3/library/contextvars.html#contextvars.Context "contextvars.Context") is propagated, allowing context variables from the event loop thread to be accessed in the separate thread.
Return a coroutine that can be awaited to get the eventual result of *func*.
This coroutine function is primarily intended to be used for executing IO-bound functions/methods that would otherwise block the event loop if they were ran in the main thread. For example:
you can use this instead
but the question is whether it would still be blocking or do i have to start a thread for each blocking call inside a threaded one
threads honestly hurt my brain
for blocking code, you'd have to open a new thread.
so if u just want to create a thread for a task u don't need a thread lib
just use bot.loop.run_in_executor(None, foo, *args)
so bascially might as well just do it for the slowest blocking task rather than the function which contains them
^^
no need
oh it's in a loop already
yes
i mean, you could add a task to that loop
loop = asyncio.get_event_loop()
loop.create_task(client.start(token))
loop.run_forever()```
Ok, i will use this method :)
.run
and yes you can do that, but dpy handles it already
what ash said works
manually starting the loop isn't necessary

idk why it dosent show with python bot but u can try in ur ide u just need to pass none as first arg then the function me and rest all args
u can use functools partial as well
if u want to
thats how it works 💀 🗿
loop.run_in_executor(None, get_embed, interaction) i'm guessing getting return variables is gonna be a pain in the ass
... await await
why are you running a coro in executor 
yeah ill just make it not a coro
coro has blocking stuff ig
if it has blocking stuff, don't make it a coro, simple
oh didn't notice ryuga team leader 👀
how is your jam coming along?
decent ig
nais
wbu
ah gl
hehe gonna need that
embed, components, file = await asyncio.gather(loop.run_in_executor(None, get_embed, interaction))```
will this work 
y gather? and where ur bot?
how do i get return values
embed, components, file = await self.bot.loop.run_in_executor(None, get_embed, interaction)
in the get_embed function
just add a return statement
i don't get why i need the bot, it's not in a class either so self?
bot has a loop attribute u need that
how do ik if it's in a class or not 🗿
you cant do that with txt files
sowwy
main.py:31: RuntimeWarning: coroutine 'Loop.__call__' was never awaited
S_ping()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
it is a task
await it 
so await S_ping()?
hellllloooooooooooooooooooooooooooooooooo
it says 'yeild' used outside a function
show code
do i have to do this channel = AWAIT bot.get_channel?
no
then whatttttttttttttt
u just remove the await there that's it nothing less nothing more
@tasks.loop(seconds=60)
async def S_ping():
await bot.wait_until_ready()
c1 = bot.get_channel(1001528129254338641)
c2 = bot.get_channel(1001528141631737997)
c3 = bot.get_channel(1001528154013311037)
c4 = bot.get_channel(1001528163941228635)
c5 = bot.get_channel(1001528191300685824)
while True:
await c1.send("@everyone")
await c2.send("@everyone")
await c3.send("@everyone")
await c4.send("@everyone")
await c5.send("@everyone")
await asyncio.sleep(2.5)
what do i do
main.py:31: RuntimeWarning: coroutine 'Loop.__call__' was never awaited
S_ping()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
cringe
im making a ping server..
for pings
you can join
its still cringe especially because of ratelimits
S_ping.start()
asyncio.sleep 🙄
pretty happy with my 3rd bot now 
its amazing
⭐dynamic ratelimits⭐
i wouldn't want a ping every 2.5 secs either
thats even more annoying than rate limits
imagine like not having your own server
@commands.has_permissions(administrator=True)
async def gstart(ctx,time,winners,prize):
channel = ctx.channel
embed = discord.Embed(title="Giveaway!",description=f"{prize}",color=random.choice(colors))
embed.add_field(name="Hosted by:", value=ctx.author.mention)
embed.set_footer(text=f"Ends {time} from now!")
my_msg = await ctx.channel.send(embed=embed)
await my_msg.add_reaction("tada")
d = time[-1]
num = int(time[:-1])
if d == "s":
await asyncio.sleep(num)
if d == "m":
await asyncio.sleep(num * 60)
if d == "h":
await asyncio.sleep(num * 60 * 60)
if d == "d":
await asyncio.sleep(num * 60 * 60 * 24)
winners_number = int(winners[:-1])
new_msg = await channel.fetch_message(my_msg.id)
users_mention = []
for i in range(winners_number):
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(bot.user))
winner = random.choice(users)
users_mention.append(winner.mention)
users.remove(winner)
await ctx.send(f"Congratulations {users_mention} you won the giveaway !")```
Why giveaway dosent work without errors?
have problem with twilio
👁️ 👁️
what am i seeing right now
Lol, I forgot Twilio exists.
I mean the error message is right there anyway and tells you what you need.
third party slash command lib 
check line 21,22,23 if i counted it right
guys
anyone know how to reopen a closed dms with a deleted account
with or without python
What is going on with your imports....
import datetime
import os
import discord
from discord.ext import commands
from discord.ext import tasks
import os, discord, datetime
from discord.ext.commands import Bot
from dotenv import load_dotenv
theyre going brrrrr
i had a friend who deleted their account
That would be a discord support thing if the account is deleted, even then it will be against data protection so not doable.
im looking for a message i sent them
a message i sent
not them
do you still have him as a friend?
when an account is deleted the friends list is cleared
Well, contact support like I said, but you whether its your account or not is irrelevant, they will refuse on grounds of data protection.
oh right, well you cant unless you had the dm open
hmm alright
@regal pulsar if u can find them on a server or whatever just right dm them, u will get an error but aye u can read the dms
ah
nothing happens when i click dm
like for example this is the id
456226577798135808
i tried doing @slate swan
@slate swan
Discord support.....
clicking the message button does nothing
Searching up "deleted user" in the quick switcher shows up
thats my last resort ;)
I'm able to view the DMs of people I've talked to who have deleted their accounts
a bunch of them are showing up for me but not this one
But didn't you say you deleted your account you used to message them?
no they deleted their account
they have a new one now but im looking for something i sent them a while ago
Ok, did you clear the conversation/delete the specific chat with that friend? I mean can you see anything at all from that specific frined?
i had a dm open with them on my old account and i can scroll down and open it just fine
but not on this one
this would work right?
Run it & see
Right, were not talking about your old account, now can you see anything form this specific friend ?
sure why not, not like discord bots take much resources
🗿
wdym
Discord support.
you mean messages from mutual servers?
Why is there parts indented in the function and some other parts not? Also DWM Moment
last resort ;)
Contact discord support this is not a discord bot issue.
sus
I am a BSPWM enjoyer myself
good wm
yeah but people in this channel usually know more about discord’s workings so i asked
its what all the kids use
i am also a bspwm enjoyer
So long as I can get access tot he backend... 😉 I'll help with the hosting.
sounds like a deal tbh
DWM is definitely more powerful than BSPWM since you get to use C, if my install wasn't fully configured to BSPWM already I would've used DWM or Xmonad
fr
guess im an adult already
💀
No such thing as an adult, you'll grow old but will always stay young at heart 😄
nah kids im being fr, ill host ur discord bot for no extra cost 👍 i have a server that doesnt do anything atm, just mc and my discord bot
mc is ridiculously unoptimized
need to setup openrc services because man im lazy
mc server
Where you host your discord bot? I'm intrigued.
heres my token ||never gonna give you up, never gonna let you down||
Not to be a stick in the mud but please be careful on who you give our your tokens to, just a word of advice
yeah
on my old pc
the game is unoptimized
bro
oh wait it didnt
thats sus as hell
im just dumb
I use xmonad btw 😏
Fair enough, I'm looking at building a RasberryPI cluster soon more out of bored than anything lol.
do u want me to host ur bot for now or na
look mommy im a haxor
You didn't even know how to use layout hooks
You had to ask me and I don't even use xmonad
me being an average windows user: 
I wanna have 1% patience of gentoo users
I now know all the fundamentals at least!
Specs explain the resolution
if u cant use ur pc for 3 hours u have a problem
.
I can but I don't think i have enough patience for compiling literally anything I install for hours
ahem can you guys stop
@slate swan Please stop offering to host bots, and stop asking for people's tokens.
how to get client latency in discord.ui.button? i tried interaction.client.latency always 0
Sure, I can already sense presence of a certain faker. Cya
Really? That's strange, not documented behaviour
packages take like a few seconds to minutes
class Ping(discord.ui.View):
def __init__(self, client):
super().__init__()
self.value = None
@discord.ui.button(style = discord.ButtonStyle.gray, label = "Перевірити ще раз", emoji = "♻️")
async def update(self, interaction: discord.Interaction, button: discord.ui.Button):
embed = discord.Embed(description = f"Пінг бота до серверів діскорду {round(interaction.client.latency)}")
await interaction.response.send_message(embed = embed, ephemeral = False)
self.value = True
class ping_command(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def ping(self, ctx):
view = Ping()
embed = discord.Embed(description = f"Пінг бота до серверів діскорду {round(self.client.latency)}")
await ctx.send(embed = embed, view = view)```
let's change the channel perhaps I don't wanna get banned again. Hehe
Rounding is where the problem is as it's probably < 500ms/0.5s
so it gets rounded down to 0
SAMEEEE
What you should do is multiply interaction.client.latency by 1000 to get the latency in milliseconds, and send that instead
i dont get whats wrong with offering to host peoples bots
We can't be sure of your intentions of hosting or doing something potentially unwanted as you're not a reputable cloud service provider, to put it simply
Against the rule so yeah follow it
And as a word of advice, never give your token to any possible VPS that you don't 110% trust
"no you can trust me im not like the other people"
@terse coyote
latency = round(interaction.client.latency * 1000) # in milliseconds
thx!
Hi Nova ur back!!!
how do i get user avatar url in a slash command
How can I make my bots prefix change every 10 seconds
I just want to make a list and shuffle through the prefixes from the list
That sounds like a terrible design choice
robin
I know it's for a little game I'm making
how do i get user avatar url in a slash command
Well if you really want to you can create a loop and do something like bot.command_prefix = 'something else'
What loop though, while true would block all the code wouldn't it?
class discord.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.
The main interface to create this is through [`loop()`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.loop "discord.ext.tasks.loop").
Can I help you?
Depends on the library
dpy 2.0.0
interaction.user.avatar.url
from discord.ext import tasks
@tasks.loop(seconds = 20) # repeat after every 20 seconds
async def myLoop():
# code here
myLoop.start() # can this go anywhere?
Usually people will create a cog and start the loop in the cog's constructor
class PrefixSwitcher(commands.Cog):
def __init__(self) -> None:
...
my_loop.start()
@tasks.loop(seconds = 20)
async def my_loop() -> None:
...
Not a good idea
You should be able to just start it in the global scope
pk
Do I smell another scam free host? 👀
It's been handled
I can just use random to choose the prefix from the list right
'Oh' in message.content
Nice
@sick birch should I use random.choice or secrets.choice?
I'm not familiar with the latter
it's just a cryptographically secure version of random
If that's true, then in this case it doesn't matter and it's overkill
yyeah
wym, a command prefix is highly sensitive how can u say its an overkill xD
how do you guys even find such libraries 
It's so sensitive. Id never let my users know my bot prefix!
import <bang head into keyboard here> hey, that worked!
its also a stdlib, so ig u can find its mention in the Python docs too
Did that once and it actually worked for some reason
Think of any word and there is a huge possibility that lib exists
What didn't you understand 
if "oh" in message.content.lower():
. . .
are you aware of the in keyword in python?
Ryuga speaking like a Helper does
heights of idiocy now 

@sick birch If I define prefix in the loop prefix is never defined to access for the command_prefix.. How can I do it?
I am one hundred percent not
hey one hundred percent not, I'm Dani
Milk doesn't taste good
haven't tasted milk yet
Dani.
Why did you tweet "I hate eating rice"
@slate swan
nova do you even eat?
I have one million racially motivated responses ready but a certain hypocrite will ban me again so i will opt against answering.
wdym by loop prefix
Cause I do.
ok
That's almost anti-national

What was your jee score again nova
I did not write that exam. Ot.
You need access to the bot instance from the task loop
Most people will pass it into their cog, but you said you didn't want to use cogs so you'll need to figure out how to get access to the bot instance
Ayo Mr helper, won't you ask them to stop ot-ing here perhaps.
Shut up nova
I am hurt.
can I just use globals?
maybe but globals are a bad idea
Globals are frowned upon
you guys have a love and hate relationship
No
Yes they are a terrible idea.
Hi okimii how is codejam going
zeffo didnt qualify?
its going great pretty fun actually
I qualified but i didn't want to participate
ah cool
@commands.Cog.listener()
async def on_bulk_message_delete(self, messages):
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow())
async for entry in delete.guild.audit_logs(action=nextcord.AuditLogAction.message_bulk_delete):
embed.description=f'Channel: {messages.channel}\n{count}Messages Deleted'
await self.bot.get_channel(933978399280599080).send(embed=embed)
can someone help me format the async for entry? particularly what delete.guild.audit_logs and {count} should be instead
black formatter is crying right now
me too
!globals
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
can't you use botvar
ive used it before, when our school was teaching about scopes
It does have valid usecases
Just use a class 
No use case at all, there are much better alternatives
It's kinda like metaprogramming in the sense that you should use it only when there aren't any alternatives
There always are alternatives for globals and meta both
I miss yesterday when you weren't in this server
elon = commands.Bot(command_prefix=prefix, intents=intents, case_insensitive=True)
@tasks.loop(seconds=20)
async def myLoop():
prefix = random.choice(prefixes) # somehow make this accesible in the command_prefix above
myLoop.start()
i will go back on my hiatus, was bored so joined the convo ¯\_(ツ)_/¯
You call random.choice(prefixes) in the command_prefix kwarg, then in the loop set bot.command_prefix
class UwU:
var: int = 10
uwu = UwU()
def func(score: int, deduction: int) -> int:
uwu.var = score
return score-deduction
def foo() -> int:
return uwu.var
looks cleaner than a global
just dm me if youre ever bored😉
calling without initing 😋
🤨
and your annotations could be better
That sounds suspicious.
was just an example 💀
i have allot of cat memes what can i say
The return annotations aren't even necessary

Would it change the prefix every 20 seconds?
overrated
chocolate milk better
👀
Coffee mocha 🤤
Could we stay on topic folks
@vocal snow do I literally just add the bot.command_prefix in the task loop or ?
why dont you stay on topic #discord-bots message, Robin? more like Robozo
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
😤
i've been caught
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
elon = commands.Bot(command_prefix=random.choice(prefixes), intents=intents, case_insensitive=True)
@tasks.loop(seconds=20)
async def myLoop():
elon.command_prefix
myLoop.start()
Yes, set it to random.choice(...)
hm okay
So when the task re-runs (after 20 seconds) the bot should have a different prefix right?
Yes
that's so weird it seems like it's not changing after the task resets
can someone help me with the underlined errors i have?
messages.guild most likely
okay it is picking the same prefix, how do I fix it ?
Are you calling random.choice in the loop callback?
Loop callback? I just have random.choice(elon.command_prefix) in the task loop
Bruh
Bruh
elon.command_prefix = random.choice(prefixes)
That picks a random character from the existing prefix string
@commands.Cog.listener()
async def on_bulk_message_delete(self, messages):
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow())
async for entry in messages.guild.audit_logs(action=nextcord.AuditLogAction.message_bulk_delete):
embed.description=f'Channel: {messages.channel}\n{messages.count}Messages Deleted'
await self.bot.get_channel(933978399280599080).send(embed=embed)
```could someone help me?
Never knew Musk had a command prefix
Does having a task loop mess up on_message events?
No
messages is a list of Message objects, and Message objects have attribute guild
Says how big of an alien he is after that swimming pool incident
Isn't looking through audit logs pointless if the event tells you which messages were deleted
@elon.event
async def on_message(message):
if elon.user.mentioned_in(message):
await message.channel.send('I was pinged.')
when I run other commands it does nothing?
Prefixes be like X Æ A-12
Having an on_message event like that will disable commands, if that's what you're asking
So that's what's breaking the bot
It overwrites the original on_message event handler
Hence your commands.. Add a process_commands method at the last
so would it be messages.Message.guild.audit_logs?
or I can just use a listen instead of an event?
"messages is a list of Message objects" means ```py
messages = [Message(1), Message(2), Message(3)]
It's a list of multiple message instances
how do i get access the messages part of the audit log then?
How do you get an item from a list?
you call array index ?
Exactly
Do the same thing here
how do i get all dms from my bot, like when people dm my bot how do i get them to post into channel
!e ```py
messages = ['hi', 'hello', 'nevergonnagiveyouup']
print(messages[2])
or to iterate through each message
for message in messages:
... # do stuff with message
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
nevergonnagiveyouup
does anyone know
Use on_message listener and check if the message's channel is the bot's dm
can u do a example in code please
why am I getting a git error when its in my path
Do you know what is an event/listener?
@bot.command()
You dont define both client and bot
You just need one of them
Preferably Bot, cause it supports commands extension
Yes
Initialise using Bot class and remove every instance of Client
yes i know event listener tho not sure
Create an on_message event to listen to messages the bot receives
In the event, check if the message.channel is a Dm channel
You still didnt remove your client
I hope you know enough python required to use this library. If not, prefer doing simple projects first before jumping right into dpy
@commands.Cog.listener()
async def on_message(self, message):
logchannel = self.client.get_channel(1001565362904629381)
@slate swan
Yes
Now check if message.channel is an instance of DMChannel
If it is, the message is received in your DMs. Then just log it into your log channel
now i dont understand.. @slate swan
@slate swan got this ^?
nope
Sorry I need to go soon its already midnight 💀 Share your issue here someone else might be able to help you out
You have the message instance. You now need to check the channel type. How you do that?
Use isinstance() method to compare your message.channel and discord.DMChannel class. If it returns True that means the channel in which the message was sent is a DM Channel. Since the only possibility for the bot to receive a message in a DM Channel is it's own DM.
Now you know that the bot received a message in their DMs. Just send the content of the message to the required channel and you're done.
@slate swan ^
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
ok so
what does that mean tho
Read the embed
so
i need a if statement
@commands.Cog.listener()
async def on_message(self, message):
logchannel = self.client.get_channel(1001565362904629381)
``` can you just do the first part , please.
- Remove useless imports. You have many unused/double imports in your code
- The
intentsyou defined is below your bot declaration. Also you need to pass intents in the constructor likeBot(intents=...)so do that too. Same reason why your Bot isn't receiving member events. - The
fetch_guildandfetch_channelare API calls and also async functions. Either await them, or even better just useget_guildandget_channelbecause it uses cache, saves you and API call.
!d isinstance
isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.
Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
alright whats the oject and whats the classinfo
Uhh that's out of context for this channel but object is the instance of the object you need to check, and classinfo is/are the class/array of classes you need to compare your instance with
true
!e ```py
i = 10
print(isinstance(i, int))
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
True
i have been trying to make a bot restart command
@commands.command(name="restart")
@commands.is_owner()
async def restart(self, ctx):
await ctx.send("Restarting bot...")
await self.bot.close()
os.execv(sys.executable, ['python'] + sys.argv)```
this is what i have and works perfect. but at discord.py place they say not to use os.execv
is there any alternative to do this
sometimes it shows the right number of messages deleted, sometimes it doesnt. anyone know how to fix ?
@commands.Cog.listener()
async def on_bulk_message_delete(self, messages):
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow())
for Message in messages:
async for entry in Message.guild.audit_logs(action =nextcord.AuditLogAction.message_bulk_delete):
embed.description=f'Channel: {Message.channel.mention}\n{len(messages)} messages deleted'
await self.bot.get_channel(933978399280599080).send(embed=embed)
Sure, use any of those 7 or so alternatives mentioned in the post
are there any examples?
because personally i dont know any of the methods
Not that I know of, but they shouldn't be hard
For example systemd is a linux classic, included in many distros. You could start with that
@sick birch AttributeError: 'Command' object has no attribute 'listen'
coming from my on message listen, I changed nothing im not sure why it's showing this
Is it in a cog?
No
It should be @bot.listen() then
yeah it is
@elon.listen('on_message')
async def pinged(message):
if elon.user.mentioned_in(message):
await message.channel.send('You mentioned me!')
You're sure that's the right line?
yeah it says line 36
Do you have a command of the same name?
Yeah prefix the command with a _elon, and use the name='elon' kwarg in the command constructor
yeah
@bot.command(name="actual_command_name")
async def some_random_command_name(...) -> None:
...
what does the -> None: do?
It's usually good practice to typehint everything, including the return type
Command handlers will usually always be -> None as they shouldn't return anything (even if they do, which they shouldn't, they'll be ignored)
is it bad to not do it?
It's.. not ideal
Why so?
You should always typehint everything when you can
Much easier for you as the developer and so you know what variables are of what types
Your IDE can also help you by suggesting possible methods and attributes so you won't have to refer to the documentation
Make sure to have an actual working/get a type-checker otherwise you'll fall into a hole you'll never get out of
Your code has many errors like:
- You're not using any entry you fetched from audit_logs. You can just remove the line and save an API call too..?
- Declaring a value to same variable in loop is equivalent to give it the last value directly. So that doesn't make sense either.
oh
Hello, i was wondering how i can save a message object in a json to remember it and load it again on initialization of my cog
It's for a system where people vote on the message to approve it so my bot needs to remember it
i am using discord.py
might be pycord
Save the ID in your JSON. Though it might be better to use buttons instead and make the view persistent so you don't need a JSON
i was thinking of reaction roles since i want to be sure that everyone votes once
it would only have 👍 👎
so if someone uses both it doesn't matter much
but do you have an example of how to save the id?
@commands.Cog.listener()
async def on_bulk_message_delete(self, messages):
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow(),description=f'Channel: {messages.channel.mention}\n{len(messages)} messages deleted')
await self.bot.get_channel(933978399280599080).send(embed=embed)
what do i replace {messages.channel.mention} with to mention the channel properly?
This is my code right now
import asyncio
from distutils.log import debug
import discord
from discord.ext import commands
import json
class story(commands.Cog):
def __init__(self, client):
self.client = client
# load saved message here in memory to check it for reactions
@commands.Cog.listener()
async def on_message(self, message):
# Ignore ourselves
if (message.author.bot):
return
# Ignore all messages except in the story channel
if (message.channel.id != 1001566491335999599):
return
# add reactions to message and save it in json + lock channel
await message.channel.send("Message sent!")
def setup(client):
client.add_cog(story(client))
print("story.py loaded")
is it giving an erro0r or no
yes messages is a list of discord.Message
try messages[0].channel.mention
is there a possible way i can get more than one member like picked in a slash command example in ss but be able to pick more than ONE member
@commands.Cog.listener()
async def on_bulk_message_delete(self, messages):
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow(),description=f'Channel: {messages[0].channel.mention}\n{len(messages)} messages deleted')
await self.bot.get_channel(933978399280599080).send(embed=embed)
do you know how to fix the len so that it properly shows how many messages were deleted?
hm
just bc u specified to purge 100 messages doesn't actually mean 100 messages will be purged
in the discord.py docs, its defined as The number of messages to search through. This is not the number of messages that will be deleted, though it can be.
maybe the purge command actually only deleted 4 messages?
any more than 1 parameter in dpy 2.0 slash commands won't come up on the bot. any idea why?
is there a possible way i can get more than one member like picked in a slash command example in ss but be able to pick more than ONE member
wait but how do i do that for members..
no, i looked through and there were at least more than 4 messages deleted
maybe not 100 but i do think somethings wrong with my code bc it did purge more than 4
can u send ur code for the purge command
I don't believe it's possible right now
@commands.command()
async def purge(self,ctx,*,number:int=None):
if ctx.message.author.guild_permissions.administrator:
try:
if number is None:
await ctx.send('Gotta gimme a number of messages to delete.')
else:
deleted=await ctx.message.channel.purge(limit=number)
await ctx.send(f'Messages purged by {ctx.message.author.mention}: `{len(deleted)}` (max is 100)')
why would you save deleted
@commands.Cog.listener()
async def on_message(self, message):
# Ignore ourselves
if (message.author.bot):
return
# Ignore all messages except in the story channel
if (message.channel.id != 1001566491335999599):
return
message_id = message.id
message_content = message.content
I want to add 2 reactions to the message (👍 👎) how do i do this?
it's for voting
i figured it out
i think i previously used a wrong name for the command
oh wait i know whats wrong
on_bulk_delete_message only returns cached messages i think
try using on_raw_bulk_delete_messages
await message.add_reaction
https://discordpy.readthedocs.io/en/stable/api.html?highlight=add_reaction#discord.Message.add_reaction
Can you send the whole code for your class?
and as text, preferably
Bit confusing as to why you're creating a class inside of a function, but like the error says, it's expecting the custom_id parameter of your super.__init__() in your MyModal class to be a string, not an InputText
@commands.Cog.listener()
async def on_raw_bulk_message_delete(self, messages):
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow(),description=f'Channel: {messages[0].channel.mention}\n{len(messages)} messages deleted')
await self.bot.get_channel(933978399280599080).send(embed=embed)
on raw bulk messsage delete doesnt return messages it returns a payload
any more than 1 parameter in dpy 2.0 slash commands won't come up on the bot. any idea why?
Are you syncing properly?
i believe so
how do u get a guild in a slash command? the member count
Does this has_permissions() check if the user being banned has a rank above the author? Like if a helper tries to ban an admin for example, can they do that?
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
if member == None or member == ctx.message.author:
await ctx.channel.send("You cannot ban yourself")
return
await member.ban(reason=reason)
emb = discord.Embed(title=f'O usuário {member} foi banido.', description=reason)
await ctx.send(embed=emb)```
No, it checks the permission of the person running the command
So if you've got ban_members permission, you can ban other people
how to ping voicechannels
same way you do with normal channels
<#voice-channel-id>
Guys
I need help
If i do this it works
But if its this, the command doenst work
Line 8
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
if member == None or member == ctx.message.author:
emb = discord.Embed(title=f'Você não pode fazer isso.')
await ctx.send(embed=emb)
return
if ctx.guild.message.author.top_role > ctx.guild.memeber.top_role:
await member.ban(reason=reason)
emb = discord.Embed(title=f'O usuário {member} foi banido.', description=f"Motivo: {reason}")
await ctx.send(embed=emb)```
how can I make this check the highest role of both author and member being banned, and check if author has role higher than member? so that a helper wont ban an admin for example
You can just assume that the user has the right permission to ban, and use a try/catch to catch a discord.Forbidden error
try:
await member.ban(...)
except discord.Forbidden:
await ctx.send("You don't have the necessarily permissions to ban that user.")
Not sure if that's the exact error but a quick look at the documentation will tell you
Hey quick question,
https://i-stole-your.dog/8zAGQSlo so this is how you fetch a message in a channel right. what about a dmed msg tho?..
but isn't the bot the one banning? wouldn't the ban work regardless of the role, since the bot is the one doing it?
You can use .top_role
Example: if interaction.user.top_role.position =< user.top_role.position:
timeout user in dpy 2?
this should work, right?
Users/Members support the Messageable base class, including fetch_message(), so you just need the user object you want to fetch from
!d discord.Member.timeout
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").
You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to use this.
This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit "discord.Member.edit").
Ohh,
so abc= get_member()
abc.fetch_message()
?
cheers
Nvm got it, tyty
One more quick question tho
does "ctx.message.author.top_role.position" get the author top role? is the syntax right?
Why is this erroring?
https://discord-edating.com/rHp1GSWE
https://femboi.best/P1nGpFAf
Ide bug or did i mess something up
it should tell you specifically what its complaining about if you hover your mouse over the underlined lines
You also need a check for people that are the same rank 😄
I did, in the 2nd ss
Not sure what that means tho
Or why im getting it
that is a pretty poor error message
<= ?
Yea
Lmao
what its basically saying is that the view= parameter doesnt exist for TextChannel.edit()
you uh, need to store the Message object thats returned from fetch_message and edit that
Oh my god
Im so dumb
I forgot to do post = on the middle line
I am so sorry 😭
Tysm for helping
np you good
what does this * means?
to store user data (for example, a currency and trading bot where trades might take a while, and with buy and sell orders), what should I use? It's going to be a relatively small bot.
In regular python when adding an asterisk inside of the function signature causes any arguments after that KEYWORD-ONLY. ```py
def foo(bar: str, *, baz: str) -> None:
print(bar + baz)
foo("Hello", "World!") # Error!
foo("Hello", baz="World!") # No error!
Strictly speaking in the context of discord.py, since the wrapper inspects the function signature to do "custom" (how the library wants it) parsing, it'll mean that the `member` argument in this case, consumes everything the user types, E.gpy
@commands.command()
async def foo(ctx: commands.Context, *, arg: str) -> None:
await ctx.send(arg)
``` Running it via !foo Hello World! will capture Hello World! (The full sentence) in the arg variable. Whereas doing it without the asterisks will produce an error since it didn't expect two inputs
ah okay, thanks. Last question: and what about the /? like in this timeout command
Forces until to be positional ONLY
So you cannot do timeout(until=...)
It has to be timeout(...) or else it'll error
!e ```py
def foo(bar: str, /) -> None:
print(bar)
foo("Hello World!")
foo(bar="Hello World!")
@pliant gulch :x: Your 3.11 eval job has completed with return code 1.
001 | Hello World!
002 | Traceback (most recent call last):
003 | File "<string>", line 5, in <module>
004 | TypeError: foo() got some positional-only arguments passed as keyword arguments: 'bar'
How can i check if a sentence has a word(e.g. Bot)
what does this mean in the context of this timeout example? do I need to make or call the function in a different way?
Anyone?
I think
@bot.event
async def on_message(self, message):
if "word" in message.content:
await #do something```
When doing await Member.timeout you have to call it positional only unless using reason
if message.content=='bot'
thanks
guys
for some reason this doesnt work
line 17 to line 21
will i make another client?
but it still doenst work if i do so
anyone ?
anyone on this?
Use a free db if really small
SQLite is probably the easiest file based, so no servers. All on disk
^ and its SQL, good for structured data which is what you'll mostly have with discord bots
anyone ?
thanks I’ll try that
msg.author == client.user will only work if the person sending the message is the bot itself
Should be msg.author != client.user
okay
dont forget to use an asynchronous wrapper for sqlite like asqlite (also made by the author of discord.py), otherwise your event loop will be blocked during queries
okay
guys
need help again
i want to ping the author of the message but it only shows the id
Hey! Im back once again haha..
So i have a button, and its not running. I added print("hi") at the start of the code and it dosnt print. No errors
Any ideas?
class UserQuoteButton(discord.ui.Button):
def __init__(self, channelvar):
self.channelvar = channelvar
super().__init__(label='Accept quote', emoji="📡", style=discord.ButtonStyle.green, custom_id='agdczcs')
async def cazzllbagssdgck(self, interaction: discord.Interaction):
print("running")```
do i use the name instead of the id?
Thats not how u ping someone lol
A) <@{Id}> (bad way}
B) use something like member = get_member() then member.mention
how
the "B."
1S
how would i put it in my code
Msg.guild.get_member()
oh
U need to set it to a var tho
msg.author.mention should work fine without getting
Oo yea ^^
That works, but to mention ppl in other things thats how u should do it, the way i said. Unless u can use ctx.author.mention ofc
thanks
yee it worked
tysm guys
^
Np
doesn't work
if "bot" in message.content
@bot.event
if message.content == ‘bot’:
await message.channel.send(‘hello’)
Remove the ()
If my bot is going to be in more than one server, is there anything specifically that was to be different?
No, just make sure you don't hardcode any IDs or anything like that
So doing like channel.send and ctx.send won't affect anything
Those are context-dependant, so the channel and guild are completely different each time
Nope
make sure your database tables are structured correctly :P
not storing anything
ok then just do what robin said
Anyone? Lol
im thinking its because im using sub classing and ive never done that before with discord.ui.Button so maybe the button code is wrong?
Are you doing self.add_view(UserQuoteButton()) in your view?
Yep
View is being added fine
Also the callback has to be called "callback"
It also needs to have 3 arguments: self, the interaction, and the button
?
async def callback(self, interaction: discord.Interaction):
That?
This cooldown is killing me 😭
async def callback(self, interaction: discord.Interaction, button: discord.ui.Button) -> None:
...
this is an ideal callback
Ohh i never knew that it had to be called that, im dumb
" -> None:"
do i reallllly need this? 🙄
Yes
No but you should always typehint when possible
^ yes
This bot has been worst then paypal api istg
pp has an api?
Well it doesn't need the typehint to be functional. To python, typehints are nothing more than # comments
Yes don tget into it tho it will make u cry
Okay...
!e
def returns_integer() -> int:
return "This actually returns a string even though the return type is supposed to be an integer"
print(returns_integer())
@sick birch :white_check_mark: Your 3.11 eval job has completed with return code 0.
This actually returns a string even though the return type is supposed to be an integer
Yeah
it's just like comments basically
It doesn't
It's a recommendation on what the type of certain things should be
Discord.py commands will always be None though right?
The computer itself doesn't care about types, in fact, it has no concept of a "type". To it everything is a mess of 1s and 0s, so only statically typed languages will enforce the type
Love that python added reveal_type as well to python 3.11
discord.py doesn't care about the return of a callback
Is it worth swapping to 3.11 yet? Lol
!e ```py
import typing
def foo(bar: str) -> int:
return int(bar)
typing.reveal_type(foo("132"))
@pliant gulch :white_check_mark: Your 3.11 eval job has completed with return code 0.
Runtime type is 'int'
You can still return something if you want:
@bot.command()
async def my_command(...):
return "something" # discord.py doesn't care about this
How come this wasn't possible before? Seems like it would, given we had the inspect library which also did on-the fly runtime analysis (unless it doesn't)
Also new pep draft for typing in 3.12
Uhhh why inspect?
Just type()
Conceptually seems familiar, it's able to analyze different things about a function during runtime, like the types of parameters
Seems like if you could do that, you should also be able to get the actual return type of a function?
🤔 what's the difference between that and reveal_type?
Lib/typing.py line 3351
print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)```
Oh
!pep 695 Read this pep, def cursed but I kind of like it
Look at the spec 100%
!d discord.Guild.get_member
Especially this, very cash money
!d discord.Guild.get_channel
guys
how can i make it so it sents a message when the blocked text is in a message?
i tried putting await msg.channel.send("sus") top of the delete code(line 26) but it didnt work
if msg.author != client.user is always true?
your checking if the message author is not equal to the user?
that's what != means
if the a userr(not the bot) sent a message that is = to blocked(array of strings )
yeah
what discord.py version are you on
@thorn grove try this instead.. str(msg.content).lower()
thats a standard check most people write in on_message to ignore messages sent by the bot, which is what client.user means
Yeah I looked it up after lol, it's just the connected client
the code would seem to work if the send() came just before deleting the message, assuming it would have reached the delete() line in the first place
I saw it was kinda buggy somewhere on stackoverflow
@thorn grove id suggest putting print statements before the if statements and for loop to make sure your code actually gets to delete()
th code works
i just want to make it send a message after the deletion
Oh
what happened after you added this line and tried sending your test message again?
doesnt work
doesnt delete the message
was there an error in your console?
uhh wait
Did you remove the await msg.delete() before adding in the channel send
no
i also wanna delete it
there no error
did you put the channelsend under or above the delete?
above
it works now
turns out i misspelled something lol
😭
sorry for wasting your time guys 😔
how can i just get the client_status part from this
guys
nvm
too much questions for one day
was gonna ask what is the code on waiting for a certain amount of secs
Hey, anyone got a idea of how i can get all the servers categories,
find a category called something specificly
then set the id of that category to a var. Not sure if theres a method to get all category info in a list but yea
Await asyncio.sleep()
U gotta import a module tho, if ur using pycharm it will tell u what module else i think its called just asyncio
Whats the best way to send a message into a channel in an on_reaction_add listener?
Wdym?
On_reason_add
channel = reaction.guild.get_channel(yourchannelid)
channel.send(stuff)
Or if its the same channel
just reaction.channel.send()
Not sure if its called "reaction" but yk what i mean
@bot.event
async def on_reaction_add(reaction, user):
if user != bot.user:
if reaction.message.id in msgs_to_check and str(reaction.emoji) == "ℹ":
msgs_to_check.remove(reaction.message.id)
link = re.match(r"https://pcpartpicker\.com/list/([a-zA-Z0-9]+)", reaction.message.content)
product_info = info(link)
await reaction.message.channel.send(product_info)@bot.event
This is wat I tried
RuntimeWarning: coroutine 'Command.__call__' was never awaited
await coro(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
This was my error
U forgot await, thats what it means
Where though?
yeah
Good question
I have an await
probably the msgs_to_check.remove(reaction.message.id)
^
import requests
from bs4 import BeautifulSoup
import re
import discord
from discord import reaction
from discord.ext import commands
bot = commands.Bot(command_prefix='>')
@bot.event
async def on_ready():
print('Ready!')
msgs_to_check = []
@bot.event
async def on_message(msg):
if 'https://pcpartpicker.com/list/' in msg.content:
await msg.add_reaction("ℹ")
msgs_to_check.append(msg.id)
@bot.event
async def on_reaction_add(reaction, user):
if user != bot.user:
if reaction.message.id in msgs_to_check and str(reaction.emoji) == "ℹ":
msgs_to_check.remove(reaction.message.id)
link = re.match(r"https://pcpartpicker\.com/list/([a-zA-Z0-9]+)", reaction.message.content)
product_info = info(link)
await reaction.message.channel.send(product_info)
def info(link):
link = link + "/by_merchant/"
res1 = requests.get(link)
soup1 = BeautifulSoup(res1.content, "html.parser")
res2 = requests.get(link)
soup2 = BeautifulSoup(res2.content, "html.parser")
list = ["**Product List**"]
for names in soup1.find_all("td", class_="td__name"):
clean_data = (re.sub('<>', '', names.text))
if clean_data not in list:
list.append(clean_data)
for price in soup2.find_all("td", class_="td__price")[-1]:
list.append("\n**Price**")
list.append(price)
for comp in soup2.findAll('div', attrs={"id": "compatibility_notes"}):
clean_data = (re.sub('<>', '', comp.text))
ns = clean_data.replace('\n', ' ')
ns2 = ns.replace(' ', '\n\n')
ns3 = ns2.replace(' ', '\n\n')
list.append(ns3)
list_info = '\n'.join(list)
return[list_info]
@bot.command()
async def info(ctx, link):
list_info = info(link)
await ctx.send(list_info)
Here is the whole bot
A
Try the msgs to check.remove like we said above
Ok let me try
No
Ignoring exception in on_reaction_add
Traceback (most recent call last):
File "C:\Users\Matt\PycharmProjects\nanoreviewbot\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Matt\PycharmProjects\nanoreviewbot\main.py", line 29, in on_reaction_add
await msgs_to_check.remove(reaction.message.id)
TypeError: object NoneType can't be used in 'await' expression
i use import time amd use time.sleep
This works too
that'll block your bot, i'm pretty sure
Oh
oh
use asyncio sleep
time.sleep() stops the entire execution of the program. If you just want to delay one async response thread use asyncio.sleep
Any other ideas?
import asyncio
await asyncio.sleep(5) # sleep for 5 seconds
@thorn grove
thanks
no problem have fun
Have fun.
Please explain to me how
I would love to know this skill
have fun while coding
Yes
explain to me how i can gain this. As 12h of hell and 5 energy drinks is not fun
Lmao
Coding = pain
Correction
if len(code) > 100.lines:
return(pain)
LMao
a 100 lines stops your abilities to have fun??
Ive felt that way all day. Im at 31 views at the moment, and the amount of args i gotta pass thru is killing me
Yes.
Anything below that is doable
Any other ideas how to fix my problem?
Im at 600 rn, its killing
20 lines is a command the rest is all views
👏
seems like spaghetti code to me
True
what are you doing
You would cry if you saw it
Ticke tsyetem
You make ticket, req gets sent to artists, if accepted it disables all the buttons of the other quotes or questions
btw can i have multiple files for my bot
Sounds simple but im dying
multiple python files
depends
Also is it just me or does nayone else lay there cogs out one cmd per file
Im so used to js, and its so much cleaner
theyre mostly set by category but you do you
im hosting my bot in heroku and it only hosts the main.py file
*heroku *
so i was thinking if adding a new .py file will work
it should be pushed if it's in the branch innit
Ok did print statement debugging with my code
The problem is this line msgs_to_check.remove(reaction.message.id)
and with that line I get this error
RuntimeWarning: coroutine 'Command.__call__' was never awaited
await coro(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
but when I add an await and make it await msgs_to_check.remove(reaction.message.id) I get
TypeError: object NoneType can't be used in 'await' expression
So I have absolutely no idea what to do
its a normal function which you called and it returns the result, which is None which ofc you tried to await the result(NoneType) and not a corourine object
So then how would I fix that?
you dont await it👁️ 👁️
But then I get the first error
Nvm just relised as i pasted whta the issue was oops
i would need more info on that
Here is all my code
@slate swan
just rename the first info function
https://femboi.best/v0kNY6rO Is this right? Im getting errored but im not sure if its bc of this or
specificly, the .name and .id part
:3
the error is?
Traceback (most recent call last):
File "C:\Users\kaelm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 423, in _scheduled_task
await item.callback(interaction)
File "C:\Users\kaelm\PycharmProjects\mainbot\cogs\ticket\ticketcore.py", line 507, in callback
await interaction.channel.edit(category=categorya)
File "C:\Users\kaelm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\channel.py", line 371, in edit
payload = await self._edit(options, reason=reason)
File "C:\Users\kaelm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 417, in _edit
parent_id = parent and parent.id
AttributeError: 'int' object has no attribute 'id'```
Im confused as it shouldnt be running that part of the code
categorry is an int lol
But thats the only thing with id
Whaaat
No ?
Categorry is each category, and im trying to just get the id of it
Thats me daily
Im still confused why its even running that tho lmfao
you need to pass a category obj in TextChannel.edit
Oh ncm
im trying to run this code here: https://pastebin.com/bQ92zNFt, but once I run the command $timer 1s in my discord channel i get this error "discord.ext.commands.errors.MissingRequiredArgument: time is a required argument that is missing."
Im dumb it should be running nvm
Hm?
in interaction.channel.edit(category=...)
Ohhh
you need to pass a category object and not an id because it accesses the id internally hence the attribute error, i shouldve read it lol
it'd be better if you showed full traceback
wdym by that? its my first time coding a bot so
no this is enough
he put self even though he shouldn't have
remove self from your arguments xen
ah
you use that in classes only
yeah
ah okay
So sorry, but how do i do that? Ive only had to do that once and i forget 😭
I only remember like half of it lol
just pass categoryy
for example this is a full traceback
ah
you have to do $timer (amount of time) ?
my code doesnt work now
i did do that, the issue was with the self part
as they had mentioned earlier
is it because i used 2 @client
event
@commands.Cog.listener()
async def on_raw_bulk_message_delete(self, payload):
length=0
for message_id in payload:
length=length+1
embed=nextcord.Embed(color=0xfd9fa1, title='Bulk Message Delete',timestamp=datetime.datetime.utcnow(),description=f'Channel: <#{payload.channel_id}>\n{length} messages deleted')
await self.bot.get_channel(933978399280599080).send(embed=embed)
can someone help me? im not sure how to get the number of messages purged
the last @client.event only works
are you coding on notepad ? holy
no
payload is not iterable, payload.message_ids is what you need in this case
github and pydroid
how would i find the length of payload.message_ids
i used pydroid for that
whats wrong wuth the code ?
len(payload.message_ids) ?
len(payload.message_ids)
o
do u know python?
who
not you
im a noob with python
It's okay.
i learnt mine in a book
then probably its early for a bot
by hywell carver
Use @client.listen
same😔
im just poop
where
buddies?
why do you use 2 on_message events?
thats what i said
lol that maybe what caused it
instead of using @client.event change it to @client.listen('on_message')
that worked thank youuu
okay 👌
np
master rejected my offer to be buddies😔
i didnt get it
were both poop at python so we are frens
sorry, i thought it would be better to ignore
🗿
fren
ImportError: cannot import name 'PartialMessageable' from 'discord.channel'
I've never gotten this, I think it might be because I have pycord and disnake installed too?
from discord maybe?
discord.abc
but I don't even use that?
now its doesnt work
my code doesn't even use that though
then maybe just remove that import?
you forgot the quations around the on_message part
oh
I am not importing, I'm getting that error when installing discord
😳
then probably your guess, i dont know for sure
still doesnt work
you have to add a definition
@client.listen("on_message(msg)")
like that?
async def somename(msg)
you have to declare the function 😩
oh lol
@client.listen('on_message')
async def SOMENAME(msg) -> None:
# do stuff
im just starting bot developing sorry
that's basics of python?
i know basics
🤷
fancy y9 with the return annotations, but no argument annotation🤵♂️ 😔
Why.
why not🤵♂️
whats "SOMENAME"
👁️ 🐽 👁️
you can change it to anything you want
literally some name
oh
its the instance name 
when you declare a function you make an instance of it named with the name given uppon the signature
I don't think they understand that
me neither
error
only discord.ext.commands.Bot has the method lol



