#discord-bots
1 messages ยท Page 869 of 1
Why this code no work ;-;
why though
youre sus
Lmao
Idk why it doesn't work
Lmao
https://stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers @sick birch
?
oh ๐คฃ
ah yes historical significance

people being serious in the answers like
can't tell if this is the dumbest way to do this or the best
f strings in sql queries
careful as you're opening yourself up to SQL injection attacks
uhuh, you literally can't use placeholders for columns and table names
also there's a thing i read that placeholders haven't been implemented for those because it's not a concern but
? Is the placeholder
Hmmm
for column and table names
Oh no, wait
This is often a code smell
Hardcode it
Make an array with the unprepared queries somewhere
none of it is even user input
so you want me to do this instead?
Yeah
yeah i agree
use str.format(), its a lot safer
/s this is not advice
Lmao
โyou just do UPDATE ? SET ? WHERE id = ?โ, (table, column_items, id)
noo
doesn't work
sqlite3
just use aiosqlite which i know it works fir
and discord bots should use asynchronous wrappers
Olie is correct; placeholders can only be used for values
not in aiosqlite
no, it's not different for different DBMSs @manic wing
Might be, but theyโre in fact using the same dbms ๐ค seems like aiosqlite has a query builder
Use #databases or im calling mods
Cope
the wrapper doesn't handle the sanitization though. And aiosqlite just runs sqlite3 in a different thread and provides an asyncio interface
That doesnโt change what I said
aiosqlite has a query builder
not sure what you mean by this
If this is the case, it may as well, who knows
<@&831776746206265384> ^^^^^^
sup?
See
tested rn: ```py
import asyncio, aiosqlite
async def main():
db = await aiosqlite.connect('db.sqlite')
await db.execute('CREATE TABLE TEST (id INTEGER PRIMARY KEY, name TEXT);')
await db.execute('INSERT INTO TEST VALUES (0, "test");')
await db.execute('UPDATE ? SET name="changed" WHERE id=0;', ("TEST",))
asyncio.run(main())
results in
Traceback (most recent call last):
File ".\t.py", line 9, in <module>
asyncio.run(main())
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File ".\t.py", line 7, in main
await db.execute('UPDATE ? SET name="changed" WHERE id=0;', ("TEST",))
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\site-packages\aiosqlite\core.py", line 175, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\site-packages\aiosqlite\core.py", line 122, in _execute
return await future
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\site-packages\aiosqlite\core.py", line 98, in run
result = function()
sqlite3.OperationalError: near "?": syntax error
They are talking about db in discord bots
just use !ot tag
I said them
don't ping mods just for that
@manic wing ๐คทโโ๏ธ
.
Now if i delete its a ghost ping
Just trying to come up with an explanation for what he said, but I donโt know if thatโs entirely true again
๐
discord bots, data base, both db, i see no issue here
Lol
databases are sometimes relevant to discord bots
istg sometimes this channel is dead and sometimes active as hell
When i talk one time a guy told me like that
if you're tlkaing about databases without the context of discord bots, please use #databases
how is this Dyno ka bhai even allowed in this server, istg discord is for 13+
This guy
please remain respectful of other community members
Ye i just ignore these people
ignore the truth
Pinggggggsssss
๐ฅฒ
seems like you forgot to ignore me when I was talking about databases? Or is your ignorance selective? Does it trigger every 5 minutes?
Like u are allowed here
Ok u want controversy
File "C:\Users\Apple\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\cog.py", line 660, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\Users\Apple\Documents\GitHub\Gaming-Bot\cogs\brps.py", line 22, in <module>
class brps(commands.Cog):
File "c:\Users\Apple\Documents\GitHub\Gaming-Bot\cogs\brps.py", line 27, in brps
async def brps(self, ctx, member: discord.Member()):
TypeError: __init__() missing 3 required keyword-only arguments: 'data', 'guild', and 'state'```
just kidding, dont take it to heart 
Remove the () from discord.Member
ok
My heart has no API 
Eh it's fine, it is common in this channel
SyntaxError
Oh discord added the Add to Server button on mobile client at last ๐
!e
exams = "uwu"
date = 2
return exams if dare == 3```
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | return exams if dare == 3
003 | ^^^^^^^^^^^^^^^^^^
004 | SyntaxError: expected 'else' after 'if' expression
ERRORsyntax error not defined
Epic fail lol
?
Okay lets stop it
lmao
Doubt @maiden fable
?
@maiden fable @maiden fable
If it's about my name, then ping me in an OT
Huh?
Code
Import erro mainly
Cog is a module
cog.help
ik that bruh
lol
i guess you mean commands.Cog?
imagine importing cogs manually
cant imagine
Uhhh, nvm
๐
Was gonna say something but nvm
Say
Nah, was just thinking out loud
If u acuttaly dont wanaa say u wont msg this
@commands.command()
async def brps(self, ctx, member):
try:
member: discord.Member
print("ok")
except:
print("sad")```
its always triggering the try part
name copy
Imagine using cogs
Pretty sure you don't need ctx
Maybe put it directly
But it's a required arg
Ye
๐
Unless u are using events
It's a command since it has a command deco
imaginw not using them
Imagine nothing
uhm how to fix it
use isinstance function to check that
The best thing is to make a custom Command class
Do u copy the code from somewhere
yeps
i wanna trigger 1 block if a member is mentioned and another block if member isnt mentioned
um no
Ok
And using on_message to manually implement the command system ๐
how do i do this without error handler
Not from pc cant help
@maiden fable
What
how do i do this
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
uh tht works for replies too
i don't wanna trigger for reply pings
!d discord.Message.reference
The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.
New in version 1.5.
uhm ok
well i found an easier solution
Eh it's easy to implement if u know basic Python
Hm?
make member = None in default value in args, ez
then we can do if member = None:
async def foo(self, ctx, member: discord.Member, member2: discord.Member=None):
if member2 is None:
return await ctx.reply("uwu")

if not member2:
return await ctx.reply("You didn't mention a member")
what a difference 
if member2 is None and if not member2 are two different things
eskplain
What
Syntax difference and it also looks nicer
does the same thing ยฏ_(ใ)_/ยฏ

Iirc the second one is faster, tho I don't really remember
should I use disco?
?
I've been using it for a while now (3 years to be exact) and it doesn't support any of the new features discord released ๐ข
What's disco tho
Ig? Who knows
Cool
How do I get the huge "add to server" button?
How to get the Add to server button to your bot's profile:
- Go to https://discord.com/developers/applications/ and select your bot.
- From the side menu click on Oauth2 -> General
- Modify the Default Authorization Link section with a Custom URL or In-App authorization
Article: https://discord.com/blog/discord-bots-and-app-discovery-announcement
Imagine copying DPY tags
they are made to make your life easier 
Then contribute them to @unkempt canyon too, to stop bothering your PC's clipboard ๐
I got the button now, tyy
Cool
@bot.command()
@commands.is_owner()
async def next(ctx, *, member : discord.Member):
await member.send(f"`Hello world ! `")
await ctx.send("`Look in DM`")
``` hello, someone know why this commands doesn't work ? indents are good
modify them to disnake first
sure, but I don't code in Python
they accept often asked question tags, ats button isn't often asked
Sad
can you elaborate "doesn't work"?
nothing append
there is a error for sure but nothing in console
try printing something before await member.send(...)
so you run the command and it does nothing?
yes
checked that the prefix that you use is correct?
wtf, i have this now (translate = missing args)
ofc
yes you need a member object
yup he is right, in your command you declared a member object
you can pass a member object by giving his ID, or by mentioning him
You can even send his discord name but ID and mention are better of course
ok
@bot.command()
@commands.is_owner()
async def next(ctx, *, member : discord.Member = None):
if member not None:
await member.send(f"`Hello {member.mention} ! `")
await ctx.send("`Look in DM`")
else:
await ctx.send("mention a member")
@vale sierra
alr i test this
btw why do you added the * before the member object? you are telling your command to get every everything that the user write in the command
invalid syntax for the ```python
if member not None:
if member is not None
alr thats work thanks bro
how to make an anti spam
if member: does the same thing 
Yup, but is not None is more readable
Heh?
vice versa?
well of course if you read if variable and the code is yours you automatically know if that variable is an object or a bool variable, but if you don't open your code for a lot time or you work in a team or you share your code with someone reading if variable could be a little bit confusing, because you have to found where that variable is declared to know if it is an object or a bool value
i always use is None or is not None for object value
call it mental arrangment lol
if that variable is an object or a bool variable ?
if x:
``` just uses bool(x)
if it doesn't have bool it's falsey
or if it is an empty value, an empty string, an empty list and so goes on
That's because of their respective __bool__s
So I WAS correct. if variable or if not variable IS somewhat faster
Yes, but it also does a different thing than x is not None
sorry i forgot the is LOL

well of course, the not has to reverse the original value, at hardware level it is an operation. We are talking of microseconds logically
so i have this code for a timer command but i get an error that there is an error of invalid syntax:
@commands.command()
async def timer(self, ctx, timeInput):
try:
try:
time = int(timeInput)
except:
convertTimeList = {'s':1, 'm':60, 'h':3600, 'd':86400, 'S':1, 'M':60, 'H':3600, 'D':86400}
time = int(timeInput[:-1]) * convertTimeList[timeInput[-1]]
if time > 86400:
await ctx.send("I can\'t do timers over a day long")
return
if time <= 0:
await ctx.send("Timers don\'t go into negatives :/")
return
if time >= 3600:
message = await ctx.send(f"Timer: {time//3600} hours {time%3600//60} minutes {time%60} seconds")
elif time >= 60:
message = await ctx.send(f"Timer: {time//60} minutes {time%60} seconds")
elif time < 60:
message = await ctx.send(f"Timer: {time} seconds")
while True:
try:
await asyncio.sleep(5)
time -= 5
if time >= 3600:
await message.edit(content=f"Timer: {time//3600} hours {time %3600//60} minutes {time%60} seconds")
elif time >= 60:
await message.edit(content=f"Timer: {time//60} minutes {time%60} seconds")
elif time < 60:
await message.edit(content=f"Timer: {time} seconds")
if time <= 0:
await message.edit(content="Ended!")
await ctx.send(f"{ctx.author.mention} Your countdown Has ended!")
break
except:
break
except:
await ctx.send(f"Alright, first you gotta let me know how I\'m gonna time **{timeInput}**....")```
Hey, does anyone know how i let my discord bot send a message when someone comes online? Im a beginner in python. I try it multiple times but it doesnt work and i dont get an error or something. I used the bot event async def on_member_update but all my trys to get the status doesnt work.
Check your member intents maybe?
Okay thanks. I will check it
U need the presences intent
Also what module u using?
To what i know there is no method or event which checks when the status change
Can anyone help with this?
!d discord.on_presence_update u sure?
discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their presence.
This is called when one or more of the following things change:
โข status
โข activity
This requires [`Intents.presences`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.presences "discord.Intents.presences") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled...
interesting
prior to 2.0 it was included in on_member_update
line where you get the error?
the last except:
disnake doesn't have any presence value in on_member/user_update
I know, that is why I said "prior to 2.0"
disnake is based on 2.0
why do you have py except: break except: # code, there is no try for the second except
also the indentation is rly wrong
btw do you know python, or is this some copypaste?
because why would you do "I can\'t do timers over a day long"
is that posibble so my bot can create 1 webhook for a text channel and use it multiple times? if yes, how
and can u bypass the "10 limit webhook" by creating webhook with a different name :V
Yea, just store the webhook object
๐ฟ ?
!d discord.Client.fetch_webhook
await fetch_webhook(webhook_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") with the specified ID.
oh, ok ty
after that how to use :V
await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message using the webhook.
The content must be a type that can convert to a string through `str(content)`.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object.
If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects to send.
url? and how to use the object ๐ฟ can i just await that_object.send("test")
webhook = await bot.fetch_webhook(id)
await webhook.send(...)
s = await ctx.channel.create_webhook(name="Webhook")
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(s.url, session=session)
``` where to get the id, also in where so i just create the webhook 1 times without create it multiple times
Oh there's a kwarg embeds never new that
added in 2.0
The webhookโs ID
aha, ok ty
isnt that will still create webhook multiple times?
no
wait, really :V ok
Can i make a check that allows only one user bot owner to use extra pr3fixes than others?
U need the ID
session is still used or no
Wym session
This was to whom?
the one whom am replying to rn
Maximum number of webhooks reached (10)
s = await ctx.channel.create_webhook(name="Webhook")
async with aiohttp.ClientSession() as session:
# webhook = Webhook.from_url(s.url, session=session)
webhook = await bot.fetch_webhook(s.id)
await ctx.message.delete()
await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")``` i hate u
Bro, who said to use create_webhook repeatedly
How'd i check the author of a message to extend prefix?
i ask, where to add that so it wont create multiple times
and who tf said to create a session? For what u doing it
!d discord.Message.author ?
Is it bot, message?
Yea
๐คทโโ๏ธ not really understand how does that work
Its as simple as
webhook = await ctx.channel.create_webhook(...)
# store webhook.id somewhere, so whenever the command is used next time, make a check to see if webhook with the ID exists or not
i'm trying to make something that changes the colour of a role based on an image, but it's stopped changing the colour/quits printing anything after on_ready is called. any idea how to solve this?```python
@bot.event
async def on_ready():
print('Boost roles active')
@tasks.loop(seconds=2)
async def colour_names():
try:
with open('DATA/BOOSTS/INDEX.txt', 'r') as j:
_colDICT = ast.literal_eval(j.read())
for ROLE in list(_colDICT.keys()):
with Image.open(_colDICT[ROLE]) as f:
colours = np.asarray(f)
print(f"0x{''.join([baseconv.base16.encode(i).lower().rjust(2,'0') for i in list(colours[:,(math.floor(time.time())%(colours.shape[1]*2))//2,0:3][0])])}")
await discord.utils.get(bot.get_guild(917640265475440681).roles, name=ROLE).edit(colour=discord.Colour(eval(f"0x{''.join([baseconv.base16.encode(i).lower().rjust(2,'0') for i in list(colours[:,(math.floor(time.time())%(colours.shape[1]*2))//2,0:3][0])])}")))
except Exception:
pass
colour_names.start()
i mean ๐ฟ where to put that
!d discord.Message.created_at
property created_at: datetime.datetime```
The messageโs creation time in UTC.
what fork is good?
you have to make your loop run after the bot is ready
i don't remember how to do that lol
probably no
where to put that thing
๐ฟ disnake #1
why disnake
Nope, the message which is used became an interaction, so the message became the one which the bot send which can be access by await interaction.original_message but you can get the content of the original message by doing this:
interaction.application_command.qualified_name
cuz pycord suc
what object do you need for your command?
The only reason everyone supports disnake is cz of faster release of new features
me what
do you need a message object?
Wrong person lol
discord.js more faster ๐ณ
In Python*
js sucks xD
๐ฟ python
why does it suck xD?
holy fk internet suck
suck what?
what would the object be for the invocation command?
i need to put that where
!d discord.ext.commands.Context
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
@placid skiff can u help him? I have to go rn
tyvm
๐ฟ
wait, I think it's that anyways
Yup i'm trying to understand what he wants to do lol
ok ty
me or sift
you
oh ok wait
so basically
s = await ctx.channel.create_webhook(name="Webhook")
async with aiohttp.ClientSession() as session:
# webhook = Webhook.from_url(s.url, session=session)
webhook = await bot.fetch_webhook(s.id)
await ctx.message.delete()
await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")``` i wana make the bot dosnt create webhook multiple times
yes
so you want to check if the webhook already exists?
it doesn't create multiple times though?
๐ฟ
yea, smth like dat ig
well as hunter as said you can store the id somewhere, in a file or a database, then before you send the webhook retrieve the id where you saved it and if they have the same id the webhook already exist
hey i want my bot to convert a raw dict i provide in a message into an embed
or they can use TextChannel.webhooks and parse through the list
can someone help me with that
ok, lemme try (wait, why database ๐ฟ)
Database are usefull with bots
yes
!d discord.Embed.from_dict usage ex: ```py
dict = {"title": "title"}
embed = Embed.from_dict(dict)
classmethod from_dict(data)```
Converts a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") to a [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") provided it is in the format that Discord expects it to be in.
You can find out about this format in the [official Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object).
now how to fking add the webhook and ad the server ID one by one to the database ๐ฟ
wait, server ID or text channel ID
you can use this too
that's for you to do
if you don't want to use database
parse... what
i want to provide the values in the message so like !embed {"title": whatever title} and it will return an embed with that title
in databases you can save the id, it is more easy to fetch them
the method returns a list
yes, just use what I said
can i?
print(TextChannel.webhooks)```
!d discord.TextChannel.webhooks click the link first please
await webhooks()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gets the list of webhooks from this channel.
Requires [`manage_webhooks`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.
k ty
how can I make python read my message as a dict so it can then send the embed through the msg
then you iterate through the list like for webhook_ids in inter.channel.webhooks and check if the id is in the list
why inter though
or doing it in a single line doing this: if any(webhook_id == id for webhook_id in inter.channel.webhooks)
!d json.loads
json.loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)```
Deserialize *s* (a [`str`](https://docs.python.org/3/library/stdtypes.html#str "str"), [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray "bytearray") instance containing a JSON document) to a Python object using this [conversion table](https://docs.python.org/3/library/json.html#json-to-py-table).
The other arguments have the same meaning as in [`load()`](https://docs.python.org/3/library/json.html#json.load "json.load").
If the data being deserialized is not a valid JSON document, a [`JSONDecodeError`](https://docs.python.org/3/library/json.html#json.JSONDecodeError "json.JSONDecodeError") will be raised.
Changed in version 3.6: *s* can now be of type [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray "bytearray"). The input encoding should be UTF-8, UTF-16 or UTF-32.
Changed in version 3.9: The keyword argument *encoding* has been removed.
inter from?
he has to check more id or a single id? lol
can i just do json.loads(message) so it can read it as a dict instead of a string?
message.content, yea
!d discord.Embed.from_dict
classmethod from_dict(data)```
Converts a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") to a [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") provided it is in the format that Discord expects it to be in.
You can find out about this format in the [official Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object).
Nvm someone already told
brain twist, i get the webhook id from the create webhook thing, and without create it i cant get the ID
what I just did
he still does not have a dictionary tho...
ayy hello sarthak
hi
Lol then you have to use a storage method, if you don't want to recreate it it is the only method
holy crap i ask how to do that
async def msg(ctx, *, message):
data = json.loads(message.content)
e = discord.Embed.from_dict(data)
await ctx.send(embed = e)
if i try to !msg {"description": wtv desc, "title": wtv title} it still don't send
ah, remove the content from there
database or file
everything else seems fine
๐ฟ db
async def msg(ctx, *, message):
data = json.loads(message)
e = discord.Embed.from_dict(data)
await ctx.send(embed = e)
@slate swan will my msg cmd work now
change the database you want to use, i suggest sqlite if you're a newbie
will work
then create a table where to store the webhooks id, add some more reference like the id of the channel where the webhook was created
@placid skiff
#can i do "s = await ctx.channel.check_webhook(name="Webhook")"
if any(webhook_id == id for webhook_id in inter.channel.webhooks):
pass
else:
s = await ctx.channel.create_webhook(name="Salcash RPG Webhook")
webhook = await bot.fetch_webhook(s.id)
await ctx.message.delete()
await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")```
can you send me the whole command so i can think a way to implement this?
@bot.command(
aliases=["say", "impersonate"]
)
async def repeat(ctx, mention:disnake.Member = None, *, text=None):
if text == None:
await ctx.send("where text")
else:
if mention == None:
await ctx.send("pls mention someone")
else:
#can i do "s = await ctx.channel.check_webhook(name="Webhook")"
if any(webhook_id == id for webhook_id in inter.channel.webhooks):
pass
else:
s = await ctx.channel.create_webhook(name="Salcash RPG Webhook")
webhook = await bot.fetch_webhook(s.id)
await ctx.message.delete()
await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")```
i tried to !msg {"description": wtv description, "title": wtv title} with the code above but doesn't send hm
"description":"wtv description"
and there are many other required fields too
you need to add "type":"rich"
you can do it inside the command itself
it works without the rich it seems
ah great then
yeah you have to store the id. i can send you a script which simplify the use of sqlite3
yeah you have to store the id.
nooooooooooo
lol that will never work because id is None in that code
i can send you a script which simplify the use of sqlite3
can u also simplify my use of if elif thing :V kinda too long
well i'll start sending you the script, now i have to launch xD
i sent it in DM
a
discord/embeds.py line 183
type: EmbedType = 'rich',```
hey @maiden fable how would i check if a cog is loaded or not
Just use bot.get_cog and see if it's returning None
also, I thnik i tried using that before, I couldn't figure out what to put for the name argument in bot.get_cog, if i have my cogs as files in a folder where the main file is not in that folder do you mind telling me the name i should put?
use bot.cogs and check if the cog you are interested in that list
does this return a cog instance or a string?
i.e would i need to use bot.get_cog to compare it?
U need to put in the cog name and see if it's returning None
this is my code:
@commands.command(name="setstatus")
@commands.cooldown(rate=1, per=30)
@commands.has_guild_permissions(administrator=True)
async def setstatus(self, ctx: commands.Context, *, text: str):
"""Set the bot's status."""
await self.bot.change_presence(activity=discord.Game(name=text))
await ctx.send(f"The bot's status was changed to: {args}")
await message.add_reaction(':tick:948182369347719209')```
I get an error that there is missing 1 required positional argument. I'm not sure what the problem is.
first your indentation is off
thats discord
ye
give the full traceback
message.add_reaction prolly raises an error as message is not a parameter. But, tbh I'm not sure where the other pos arg is. give the traceback
is that it?
give the full traceback
yeah but i don't what to put as name
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 71, in wrapped
ret = await coro(*args, **kwargs)
TypeError: setstatus_error() missing 1 required positional argument: 'message'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 979, in on_message
await self.process_commands(message)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 976, in process_commands
await self.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 943, in invoke
await ctx.command.dispatch_error(ctx, exc)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 422, in dispatch_error
await injected(cog, ctx, error)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 77, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: setstatus_error() missing 1 required positional argument: 'message'
The cog u want to check that's loaded?
there was quite a lot so i couldnt take ss of it all
yeah
looks like an internal error
whats the best way to dynamically access attribute names
Wut
Can you give an example of what you want to do?
so would i do
message =
if i had self.attribute and i had attribute as a string i could do locals()["self.attribute"] for example
and something after the =
but use a variable for the attribute part
Still don't understand
i would right? im just not sure what to put after the =
๐คทโโ๏ธ
locals()["self." + jeff]```
Ah
@spring flax
yes...?
that's how you define a variable
what would i put after the =
I have no idea what you're talking about but you're overcomplicating
to define message
what message do you want the reaction to be added to?
the message the user ran
does this explain better if save_type is the attribute name
ctx.message
ohh tysmm
Wut does this do ?@client.message_command() in disnake library
oh ok ty!

this is a discord library?
From this example you're definitely thinking about setattr
!d setattr
setattr(object, name, value)```
This is the counterpart of [`getattr()`](https://docs.python.org/3/library/functions.html#getattr "getattr"). The arguments are an object, a string, and an arbitrary value. The string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For example, `setattr(x, 'foobar', 123)` is equivalent to `x.foobar = 123`.
Note
Since [private name mangling](https://docs.python.org/3/reference/expressions.html#private-name-mangling) happens at compilation time, one must manually mangle a private attributeโs (attributes with two leading underscores) name in order to set it with [`setattr()`](https://docs.python.org/3/library/functions.html#setattr "setattr").
ahhh okay
I believe that he's making functions for a leveling system?
thanks
Any idea?
is there really a reason to use this
it's actually for map objects in that example
yea to dynamically set attributes at runtime
wait would setattr work with a dictionary
oh i needed to use getattr
getattr(cls, 'fields')['key'] = 'value'
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
role = discord.utils.get(ctx.guild.roles, name = 'Mod')
mods = role.members
for i in mods:
print(f'{i.name} is {i.status}')
that does not work
it shows everyone is offline
ohh
yeah, you only have members
so what should i add
and why did you define a client?
forgot to remove that
just
intents = discord.Intents.all()
oki, tysm
i enabled that
๐
so, what i want to do is
check all the mods if they are online or dnd or smth
and i want to get the first person
for example,
{'a' : 'offline'
'b' : offline
'c' : 'online}
i want to get a first. if a is not responding, ill get c
if this is a dumb question, im sorry
use a for loop, check the members statuses, use the break keyword
for i in mods:
if str(i.status) == 'online':
x = i
break
x.send('blah blah blah')
something like that?
x doesnโt exist out of that loop
docs for message content?
x is declared outside
oh
!d discord.Message.content <--
The actual contents of the message.
ty
the person who owns the bot?
yes
!d discord.ext.commands.Bot.owner_id
The user ID that owns the bot. If this is not set and is then queried via is_owner() then it is fetched automatically using application_info().
get the bot.owner.id (which hunter mentioned) then you can use fetch_user(id) to get the rest of the information.
no
!d disnake.Client.owner also exists
No documentation found for the requested symbol.
@commands.command()
async def brps(self, ctx, member):
p = await self.bot.get_prefix(ctx.message)
prefix = p[0]
if member == None:
await ctx.send("Invalid syntax\n;mrps <member>\n Mention the member next time")
if member == ctx.author:
await ctx.send("Bruh, how can you play with yourself?")
if member == self.bot.user:
await ctx.send(f"Do `{prefix}rps` if you wanna play with me")```
the command doesnt even trigger
Ofc it does wdym?
just because a variable is not on the same indentation scope as something doesnโt mean itโs non existent else where
if that was the case we wouldnโt have dynamically assigned variables
He said it was defined elsewhere
um what's wrong here
You said what you said before he said that
yeah he clarified
That was the problem tho. You made me think he wouldnโt be able to access "x" if they didnโt have it defined somewhere else
You probably should typehint member to discord.Member
ahh i forgot it my bad
Because you know you said "x doesnโt exist outside that loop"
member: discord.Member
how to find whether a member object is a bot or a human
pretty sure get_prefix takes two args, unless that's a custom method
ah I'll refer docs
it's not documented
uhm it's documented in pycord docs
nvm it is
pycord ewwww
i found tht method from the docs itself
yeah
What object does await ctx.send() return?
discord.Message
how would i react to that message?
define the send as variable
yes, but what method to react and what args to be passed?
how to find whether a member object is a bot or a human ;-;
member.bot is a bool
ohh alright
!d discord.Message.add_reaction
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
nice
A str/discord.Emoji/discord.PartialEmoji object should be passed in the method
hi, can I ask a question about discord bot creation?
using a string sometimes fail though
sure
yes
I want vey simple things but i am doing something wrong
actually I am trying to do that; bot will remove a role of mentioned user in a spesific channel
but not as command, it can be in a sentence mentioned that user
i wrote that code :
if "@" in message.content:
message.content = message.content.split("@",1)[1]
message.content = message.content.split(" ",2)[0]
a = message.content
a = a.replace("<","")
a = a.replace(">","")
a = a.replace("@","")
a = a.replace("&","")
a = a.replace("!","")
await message.channel.send( a + " " + "is free!")
#user_id = "<" + "@" + a + ">"
#a = int(a)
user = await client.fetch_user(a)
role = discord.utils.get(user.guild.roles, id = a)
await client.add_roles(user, role)
await message.channel.send( user + " " + "is free!")
;remove @tepid tiger role
like this?
you can use message.mentions
no for example "@tepid tiger is free have a good day"
when i wrote that it will remove a role of that user
not the author's
ah
if message.content == "message you wrote":
#stuff:
how do i get the id for an emoji? (not with my bot just with my discord)
i tried right clicking and stuff, but it's not working
mentioned user can be end of the senctes or begining of the senctes
hello botmakers
"Today @tepid tiger is so happy"
"what a wonderful day right @tepid tiger ?"
these are examples
@quaint epochpost ur emoji and put \ infront of it
So I'm trying to adapt a dpy embed pagination lib to work with hikari which is going okay. This lib has ctx as a parameter in several places (for example py class Paginator: def __init__( self, bot: Union[AutoShardedBot, Bot], # ik I'll need to change this to gateway bot for hikari ctx: Union[ InteractionContext, # This is from one of the libs depancies (the paginator lib is a extenion of a different interactions lib) so does hikari have something similar Context, # Hikari doesn't have this TextChannel, # Hikari's is GuildtextChannel ik User, Member, ],and I'm wondering what I could swap this out with since hikari doesn't have ctx. I though about using lightbulb or tanjun but I don't want to tie it to one specific library, is there a way I can check if a import actually exits or not (say if I imported tanjuns ctx but don't have tanjun installed the bot would just carry on and disregard any tanjun ctx references) or should I try to make my own ctx for the paginator and if so does anyone know any good examples I could check out on how ctx is made
i want to scan the sentences and find the mentioned user, then take his role
so i wrote if "@" in message.content that alows to find mentioned someone in the sentence
you have message.mentions or something like that
but it takes the user id not user as an object, so i cannot give a role or cannot remove a role by using his user.id
did I explain clearly? ๐
better if u show code ๐
that is not a guild emoji
that is a global emoji
oh
!d discord.Guild.fetch_emoji
await fetch_emoji(emoji_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") from the guild.
Note
This method is an API call. For general usage, consider iterating over [`emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.emojis "discord.Guild.emojis") instead.
and you also doing wrong u using an unicode emoji and not an ID of an emoji
but still thats a unicode global emoji and not a discord-guild emoji so therefor it has no ID
if I unload a cog, it won't be in bot.cogs right?
this good
if u unload a cog its gone yes
yes that works
nice
Union with autoshardedbot and bot?
!d disnake.Client.get_guild
get_guild(id, /)```
Returns a guild with the given ID.
@slate swan ?
Then why does
@bot.command()
async def cogs(ctx):
loaded_cogs = set(bot.cogs.keys())
all_cogs = set(list_of_cogs)
unloaded_cogs = (all_cogs & loaded_cogs)
await ctx.send(unloaded_cogs)โ
This returns none even when i unload a cog
By none i mean it returns a empty set set()
hmm?
@slate swan
why'd you want to do that? How'd the bot know you didn't ping them rather want to remove a role?
actually there is a FIFA discord
and captains write their players name when they are free
so the players have the team role and when the captain say "this guy is free!" its automaticly lose his team role
we do it manually so we want to do that
@spring flaxbot.unload_extension
what are you trying to do?
Get loaded and unloaded cogs
Yeah ive done that in a command before using the cogs command
cogs or extensions?
bot.cogs
is it logical?
@spring flax oh bot.cogs will still have cogs even if unloaded i guess
Cogs
still not getting lol. show me an example in text. like the whole process
@spring flaxthis is how i have to see cogs loaded or not,
first i have a global variable that contains a list of cogs i wanna load at botup then i use that list to check if its in bot.cogs or not
for x in self.bot.botcogs:
if x in self.bot.cogs:
description += f"โ
**{x.title()}**\n"
else:
description += f"โ **{x.title()}**\n"
okay; imagine that there are 2 different text channel; 1. is agreement room; which is when the captain agree with a palyer text his name in that room like " @tepid tiger is our player anymore" and we want to give ceksar to team role when he was mentioned in that room,
the 2. room is contract termination room; which is captain write the player name again when they cancel their contract with player such as " @tepid tiger is not our player anymore, good luck in football life..." and the his team role from the ceksar.
yeah, it's a dpy extension lib that i'm trying to adapt to work with hikari (there's very little actual dpy code it's more the lib linking other things together). Hikari doesn't need autoshardedbot or bot bc it has gatewayBot (which is sharded all ready
i think its very simple thing to do, but i am very close to do that just a tip all I need
ah makes it much more clear
if message.mentions(person):
if message.channel.id == id_of_contract_cahnnel: add role
if message.channel.id == id_of_termination_channel: remove role
Pseudo but should give you an idea
if not country.nato_member:
russia.invade(country)
``` #withukrainewestand ๐บ๐ฆ
if a member is a bot, how do i find it's owner?
u cant i think
!d disnake.AppInfo
class disnake.AppInfo```
Represents the application info for the bot provided by Discord.
oh nice
so disnakes the currently recommended fork of dpy right?
yup
no other bots as well, if member.bot is true then i want to find the owner of the bot
ah nice thanks ! didnt know that
I mean you could make a list of all the cogs you have and do something like this ```py
loaded = []
unloaded = []
cogs = ["Eco", "Mod", "Info"]
for key in dict(bot.cogs).keys():
if key not in cogs:
unloaded.append(key)
else:
loaded.append(key)
what i kinda showed him earlier
for x in self.bot.botcogs:
if x in self.bot.cogs:
description += f"โ
**{x.title()}**\n"
else:
description += f"โ **{x.title()}**\n"
``` and that i have a list of the cogs i want to load on botup
wich is a global var called botcogs
oh nvm you can't get a bots owner info
you can
how?
!d discord.Client.application_info
await application_info()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the botโs application information.
for every bot, not just the current client
When would the else statement ever occur lol
oh nvm
pretty much impossible
yeah that's what I'm saying lol
i don't think that you can access other bots data
what
yea
does disnake.RawReactionActionEvent let you check the user that added/removed the action?
Guys how can I run two bots at the same time? like how do I open pycharm two times
I think it has user_id
!d disnake.RawReactionActionEvent.user_id
The user ID who added the reaction or whose reaction was removed.
nice
!d disnake.Message.clear_reactions
is it possible to make a global userinfo command in discord.py??
(that shows user info even if they arent in the guild)
yes i think so, use a user object, not a guild member tho
lol i was working on the same thing
how to have same check function for multiple buttons
user: discord.User() or class user
fetch the user
well, get or fetch what u prefer
you cant get a user from cache if the bot cant see the user
;-;
you can't?
no?
!d disnake.Message.remove_reaction
await remove_reaction(emoji, member)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://docs.disnake.dev/en/latest/api.html#disnake.Emoji "disnake.Emoji").
If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_messages "disnake.Permissions.manage_messages") permission is needed.
The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://docs.disnake.dev/en/latest/api.html#disnake.abc.Snowflake "disnake.abc.Snowflake") abc.
get_user gets the user obj from cache which the bot only caches the user it can see
then what about await bot.fetch_user()
fetch makes a api call so yes
they said get or fetch meaning either
oh alr
ik but you cant really get a user the bot hasnt cached
oh without guild,maybe this
@client.command()
async def userinfo(ctx, user:discord.User):
mem = fetch_member(user)
await ctx.send(f'Name: {user.name}')
fetch member but youre waiting for a user obj?


await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Note
This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.
cough fetch_member

user
@commands.command(aliases=['senddm', 'dm', 'sdm'])
async def send(self, ctx, target:disnake.Member, message=None):
if message is None:
await ctx.reply("You must include a message.")
dmmessage = disnake.Embed(color=magcolor, description=message, timestamp=dt)
dmmessage.set_footer(text=f'from {ctx.author.name}#{ctx.author.discriminator} | reply with: e!re <message>',
icon_url=ctx.author.avatar.url)
await target.send(embed=dmmessage)
await ctx.message.add_reaction('โ
')
print(f'{ctx.author.name}#{ctx.author.discriminator} messaged {target.name}#{target.discriminator};')
``` I forgot how to dm specific user, is this right? this seemed to be working back then. It's not working anymore
!d discord.Member.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
that target.send doesn't do anything though ๐ค it should've
reply is a coroutine
do you have intents
yes i do
hm
maybe the bot can't DM the member because the member disabled DMs
i tried it on myself, it didn't work
any errors?
no i don't get any...
do you have jishaku?
what is that?
A useful extension for discord.py
never tried it
Can a bot use either of these:
- Animated Emojis
- Emojis from a server it isn't in
- yes
- no
show me how you invoke the command
How do I get the animated emojis then? I can't copy the id I'm on mobile and I also don't have nitro
Put a backslash then the emoji and send
get the emoji by name
e!send 389034898666553344 msg
i also have tried mentioning
The way I get them atm is \:emoji: but I don't have nitro so I can't do that
when i didn't put the message arg, the bot doesn't even reply with the if statement
try adding print statements in the command to see where it stops
You are rate limited
ok
also is that your actual IP
maybe ๐
you just leaked your ip lmao
just as i thoght, the command isn't even running, but thebot knows it's a command
are you using replit?
yeah
Don't
thats just your replits ip then
good
Try typing kill 1 in the shell
does anybody know the code to blacklist words?
i did
how do you find when a guild was created
maybe use if message in list
!d discord.Guild.created_at
property created_at: datetime.datetime```
Returns the guildโs creation time in UTC.
thanks!
ive done that twice now and it still gives me that
Gotta wait now I guess
Bro try to use the docs sometimes, not because i don't want to help you but literally this is the same method you used for the message but with a different object lol
okay
I recommend you use a proper IDE though (VSC/pycharm)
sublime is decent
Well you have to configure it to set a good intellisense
VSC/Pycharm are already configured
its based on preference
Plus sublime is a text editor and not an IDE
do you have an error handler?
no
Code?
.
@placid skiff
I'm clueless at this point
Do you have any on_message event?
vsc is a text editor lmfao
plus you can download pyright to check types
Yup, but it is the text editor which is more related to an IDE among other text editors
totally forgot about that
nope, i unloaded all my extensions, im currently rebuilding it cuz my bot somewhy got deleted, i forgot everything
the only cog listener is on_ready it doesn't affect anything...
not really more leaned to a text editor it does have a cool ui and linter but sublime has the same things but is a text editor
discord.gg/dpy ask here maybe
He is using disnake
waiting for answer there, i hate that my bot starts breaking randomly
btw what IDE are you using?
me? pycharm
Good then, add a breakpoint at if message is None and run a debug
write the command and let's see if the code runs
you should probably not name your command send
Why?
why not
It shouldn't be an issue
why? python hasn't a bultin method named send
How do I make a bot send a custom emoji?
You have to use the id of the emoji and sent it by doing this :ID: i think
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
oh thanks man. It works with being animated too?
it should
yeah, but an a before the first colon to symbolise that it's an animated emoji
A wild Hunter has appeared
Thanks man
welp, it doesn't run. Just confirming, the bot knows that it's a command
Strange
i'm clueless lol
Do you use the correct prefix?
yeah
the command is in a cog?
yeah
bro method naming you ever read pep8
do you loaded the cog?
yeah, the other functions works well
whats wrong with naming a method send though
im attempting to make an anti nuke/logging bot. basically uses the same idea and base of an anti, but logs instead of banning. my current way of getting user who triggered x event is [entry.user async for entry in guild.audit_logs(limit=1, action=event_action, oldest_first=False)][0]. that would ideally return the user object but that is flawed many ways. sometimes my bot is delayed and doesnt actually get the audit log and returns index error, sometimes discord is delayed and i get the same error. my bot may be behind and return a different user object. i notice audit_logs has other parameters such as before and after. i thought i could make a datetime object upon the event being triggered, and for the before add maybe timedelta 10 seconds, and for after subtract maybe timedelta 10 seconds. would this solve my problems?
i also thought about maybe doing something like
async for entry in guild.audit_logs(limit=10, action=event_action):
if entry.target is x:
return entry.user
break```
or maybe dont event specify an action, and then in the if statement check target and action?
just what would be the most optimal/fastest way to get the entry.user object?
seems like the parameters and the attributes on AuditLogEntry are almost identical, not sure what would be as optimal?
or is there another way to get the user who made x object
How does it break pep8
imma try using slash command maybe if it shows any difference
why cross-post
bro doesnt pep8 have a whole section on method naming 
Yes but tell me how it breaks it
indeed, and i still have 3 school projects on the line
you guys it's just PEP8 at the end of the day it's not that big of a deal no one will read your shit code anyways?
Okimii you probably thought it did because it mirrors any Messegeable.send().
i.e
def print():
print("whats your name")
what does it print exactly 
nah nah
nothing
PEP8 100% matters
this hurts my eyes
Thatโs only built ins okimii
i thought about it
this doesn't break pep8 this breaks python
No
send isn't built in
Bro there is no builtin methods named send in python
Yes. Readability matters
bro whos talking about built ins

Can u both take it to an ot channel? @slate swan @final iron
no
It's not overwriting any built in methods
lmaooo
So what's the issue?
and the send method of a member/channel can't interfer with that command because you don't do something like this:
from discord.Guild.TextChannel import send
Even because you can't do that
RecursionError.
..
uhhhh?
do you wanna get muted
that's not the appropriate response to someone telling you to follow our rules

whos talking about built ins im talking about method naming 
they always do that its so annoying
I didn't even talk to him lmao
What's wrong with the method naming though
sorry
they're asking you to follow the rules. if you're annoyed, i can't do much about that..
i showed an example
@slate swan
im sorry
Yes but print() is a built in method. It will overwrite it while send() won't overwrite anything
!rule 7 anyway, this is in fact one of our rules btw
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
you guys dont see my point on how to name a method correctly
No okimii because your logic doesnโt work
The method naming rule only applies to built ins
no
Well guys let's cut this off
istg this would be the first argument I am not a part of and I am happy about it ๐
@daring olive shush time for this channel?
bro you do a send command what would you think it would do
no
send a message
where
no, the user apologized so, i don't see a need.
Was talking bout the other argument which is going on lol
i'm not sure i see an argument lol. disagreements are fine, however. so long as they remain civil. don't be sarcastic or demeaning or condescending and you're all good
well said
yup
like maybe overusing
is a bit much
yeah you guys are going too far with the pep8 stuff like it's enforced
what if i'm always sarcastic? xD
true
best not to be sarcastic with strangers you don't know in a public space on the internet that has moderators
Also @slate swan that print func gonna return an error iirc
its not like you have to follow it 100%
Hey, i tryed to make a bot who send a message if a specific user come online. I dont know how i can check whether he is online and the Id. Does anyone can help me?
it was an example on method naming lmao
I never followed pep lol D_D
Ah okay
lol
what version of d.py are you using?
i follow pep lol but i don't think i follow it 100%
Don't start another disagreement
One is enough for today
Oke boss
https://paste.pythondiscord.com/liyaxagomu what is this TypeError: True is not a valid parameter annotation cause
you guys do know pep means Python Enhancements Proposal right
code that raise the error?
It doesn't work? Can someone help me how do I send custom emojis with bot?
mhmm
the link he sent
it is written in the exception
I dont know were i can see it
i forgot it
where did you install d.py?
pip obviously
yes
pycord >
pypi probably
pypi ig
!d discord.on_presence_update use this then
discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their presence.
This is called when one or more of the following things change:
โข status
โข activity
This requires [`Intents.presences`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.presences "discord.Intents.presences") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled...
check if the member is a certain member
and if it's the member send the message to them
you would also need the presence intent for this don't forget about that
I've tryed this if after.status is discord.Status.online:
Yes I've checked it
whats wrong?
i dont know it dont send a message and i dont get an error
maybe try casting the members status ```py
if ... == "online":
...
@client.event
async def on_guild_join(guild):
await guild.leave()
Is this a good bot?
๐คจ
definitely
Nicee time to make it
Okay i try it
the docs didn't cover this, member.pending is a bool that tells whether or not the member is verified, but what kind of verification?
like, a verified discord partner?
or verified through email?
no like when you sign up you have to verify from email
email verification?
It doesnt work
so this can be used to ban spammers and raiders
pretty sure its like if the user is still on the verify page when you join a community server
really?
show code
i always thought it was to prevent new accs
really?
not sure, read the object docstring
mhh no ig not
str()
aaa
so if str(after.status) right
yes
Okayy its works but it spam the message and i want also the the message will send if a specific user comes online. can i do this? if str(after.status) == "online" and str(after.id) == "1235456":
Ok it works thanks
But the bot spam the message what can I do about it?
did you know something?
Channels
not sure
does it send the message two times? or does it send the message more than two times
more than two times
.


