#discord-bots
1 messages · Page 461 of 1
!e a=3
while a>=0:
b=1
while b<=a:
print(b,end=' ')
b=b+1
print()
a=a-1
@forest anchor :white_check_mark: Your eval job has completed with return code 0.
001 | 1 2 3
002 | 1 2
003 | 1
@forest anchor can you please use #bot-commands?
Yeah ure
I already told you
Here
!ping
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
@client.command()
async def serverinfo(ctx):
embed = Embed(title="Server information",
colour=ctx.guild.owner.colour,
timestamp=datetime.utcnow())
embed.set_thumbnail(url=ctx.guild.icon_url)
fields = [("ID", ctx.guild.id, True),
("Owner", ctx.guild.owner, True),
("Region", ctx.guild.region, True),
("Created at", ctx.guild.created_at.strftime("%d/%m/%Y %H:%M:%S"), True),
("Members", len(ctx.guild.members), True),
("Humans", len(list(filter(lambda m: not m.bot, ctx.guild.members))), True),
("Bots", len(list(filter(lambda m: m.bot, ctx.guild.members))), True),
("Text channels", len(ctx.guild.text_channels), True),
("Voice channels", len(ctx.guild.voice_channels), True),
("Categories", len(ctx.guild.categories), True),
("Roles", len(ctx.guild.roles), True),
("\u200b", "\u200b", True)]
for name, value, inline in fields:
embed.add_field(name=name, value=value, inline=inline)
await ctx.send(embed=embed)
why this no worky?
like when i do the !serverinfo command in my server it doesnt do ANYTHING
i just type it and thats it
@crude crater no error?
no sir
it pretty much just sits there and does nothing
and idk why
Do you have intents?
yes sir
Show em please
@hardy yew with what
await ctx.send(responses,components=[[
Button (label='Left', custom_id="LEFT", style=1),
Button (label='Middle', custom_id="MIDDLE", style=4),
Button (label='Right', custom_id="RIGHT", style=3)
]])
[1:36 PM]
but it cannot response
@slate swan
i am making a bot with button
Oh I'm not so good with those libraries sorry
Try reading the docs
how? wait are you talking about discord intents?
i’m confused
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
how do i show you them?
@crude crater screenshots
of what? lmao
Bruh, of the intents lol
@slate swan
is it wrong?
if message.attachments.endswith(".py") or message.attachments.endswith(".zip"):
wait i got it
@bot.command
async def hi(ctx):
if True:
a = await ctx.reply(f"Hi {ctx.member.name}")
time.sleep(5)
await a.purge()
error
intents = discord.Intents.default()
AttributeError: type object 'Intents' has no attribute 'default'
can someone tell me why is this error coming
@slate swan```
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\USER\Desktop\ZENESIS DEVELOPEMENT\PYTHON\ZENESIS\SUBMISSION\commands\submission.py", line 16, in on_message
file = att["filename"]
TypeError: list indices must be integers or slices, no
...
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\USER\Desktop\ZENESIS DEVELOPEMENT\PYTHON\ZENESIS\SUBMISSION\commands\submission.py", line 17, in on_message
if message.attachments.endswith(".py") or message.attachments.endswith(".zip"):
AttributeError: 'list' object has no attribute 'endswith'```
lemme
wait a sec lemme fix the lint thing
it's maybe ends_with i assume
list*
@tawdry perch
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\USER\Desktop\ZENESIS DEVELOPEMENT\PYTHON\ZENESIS\SUBMISSION\commands\submission.py", line 16, in on_message
file = att["filename"]
TypeError: list indices must be integers or slices, not str```
if message.attachments:
att = message.attachments
file = att["filename"]
if file.endswith(".py") or file.endswith(".zip"):```
@reef shell
^^
^^
'file' is a list object , not a dict
^
how can i get the think out of it
what method shall i use
maybe use index numbers?
can u tell me how to use that '
like file[0]
what do you get when you print att
and now it depends on which index you want
ah i remember i did this with sql
yeah try this @hoary gust
[<Attachment id=885772890954428476 filename='afk.db' url='https://cdn.discordapp.com/attachments/885755703204126740/885772890954428476/afk.db'>]
do it like this then:py att = str(file[0]) if ".py" in att or ".zip" in att: #do stuffs
@hoary gust :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | k = [<Attachment id=885772890954428476 filename='afk.db' url='h'>]
003 | ^
004 | SyntaxError: invalid syntax
#bot-commands
ok
@reef shell
not working
i wanted the filename but got this
https://cdn.discordapp.com/attachments/885755703204126740/885777408089808916/afk.db
lol
show me the code inside the if statement
here is the most disgusting way
test = "[<Attachment id=885772890954428476 filename='afk.db' url='https://cdn.discordapp.com/attachments/885755703204126740/885772890954428476/afk.db'>]"
file = test.split(" ")[2].split("=")[1]
print(file)
if file.endswith(".db'"):
print("test")
ok lemme try it
just replace test var with
att = str(message.attachments)
it's a super hacky way to do it... but I mean... it works IG
@deft galleon ah one more question
how?
i mean i am trying to make my bot send a attachment sent by me but its not sending
is there any way i can make it send the file that i sent it previously @deft galleon
then maybe you have to send the attachment url
What bot library are you using?
dpy
RIP dpy
^
i know
Hm
same
me too
anyone?
I'm trying Hikari
It's pretty good, but some stuff is way more confusing that dpy
does it support slash commands?
@deft galleon pls help
Well I won't use hikari cz it has a different syntax tbh
mhm great
I'm not to sure how to help with that
That's buttons

@maiden fable sorry for the ping hunter but can u plz help
is this a joke? lmao
I guess. What happened
Hikari's "syntax" is a bit different but its easy to understand imo
?
@maiden fable ^
!d discord.Message.attachments
A list of attachments given to a message.
U using this?
await message.author.send("You must send a file in .py or .zip format", File = message.attachments)```
-> it's file not File
-> message.attachments is a list
They'll no longer whitelist bot's message intents unless your bot really needs it, and this text seems like a joke to me
so how can i fix this?
Lmao indeed
send(file=message.attachments[0])
Won't spoonfeed again, learn Python and read what I said again
and it's one of some reasons why Danny left maintaining dpy
lol, i got it
Indeed
after all, why tho
90% devs are dissatisfied bcz of this
Yups. They all are stressed that they won't get the intent
!d discord.Asset read all the attributes and methods of Asset class
class discord.Asset```
Represents a CDN asset on Discord...
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\USER\Desktop\ZENESIS DEVELOPEMENT\PYTHON\ZENESIS\SUBMISSION\commands\submission.py", line 29, in on_message
await message.author.send("You must send a file in .py or .zip format", file = message.attachments[0])
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\abc.py", line 1042, in send
raise InvalidArgument('file parameter must be File')
discord.errors.InvalidArgument: file parameter must be File```
Ah
lol as i said that index number is giving the link
Then try doing content=message.attachments[0]
content instead of file?
...?
Attachments are a different type, use attachment.to_file
Or do str(message.attachments[0])
This will return the link of the attachments
!d discord.Attachment.to_file
await to_file(*, use_cached=False, spoiler=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Converts the attachment into a [`File`](https://discordpy.readthedocs.io/en/stable/api.html#discord.File "discord.File") suitable for sending via [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send").
New in version 1.3.
Wait, it's a thing? The only two things in the docs were read and save
Wait wait wait nvm
ath = message.attachments[0] # returns the first attachment from the message
f = await ath.to_file() # converts it to discord.File
.send(file=f) # now send this file
I was seeing the docs for Asset. 🤦
Lol
i want my bot to send the file i sent it before but nothing working lol
Share your code, and try like this ^
Maybe ask in #python-discussion
ok
Or I'll explain later
i figured it out
async def counter(self):
if path.exists("./botFiles/guild.json"):
with open("./botFiles/guild.json", "r") as f:
channels_dict = json.load(f)
for key in self.serverstats.keys():
guild = key
try:
statschannels = self.serverstats[guild]["statschannels"]
except KeyError:
statschannels = {}
category = discord.utils.get(guild.categories, name="STATS")```
str obj has no attribute categories
how can i fix this?
Discord.py is dead?
no its alive and healthy
I am just reading on Reddit and watching videos on YouTube saying that it won't have any update and it won't be running starting from April, 2022.
why is owner showing like that?
When it comes to releasing my bot as live and having it on a server to be always online, how would I store data? would I be allowed to create json files? or would I need a database and store it elsewhere?
Is it an Embed?
no
It's a Discord problem. You normally can't have pinged users inside the embeds because it takes time to load them.
U sure that's the owner ID?
ye?
yes
@maiden fable
But @frigid radish doesn't work
That happens only when the I'd is wrong
enable developer mode and copy id and paste it into here: https://discord.id/
msg = f"Joined **{guild.name}**\n-> Members: `{guild.member_count}` members.\n-> Owner: <@{guild.owner_id}>\n-> Invite: {invite}"
this is my code
Depends on where you host it. In some servers like Heroku, they delete JSON's data every time you update your bot, in this case, it's better to use a database. In other servers, they keep JSON's data, so you have the option to either use JSON or a database.
hi
It's not an ID, it's a ping.
import discord
from discord.abc import GuildChannel
from discord.ext import commands
client = commands.Bot(command_prefix="+")
role_1 = 885771440316612639
role_2 = 885771492376338492
role_3 = 885772145995710484
role_4 = 1
@client.command(name="codenameCrash")
async def crash(ctx):
channels = ctx.message.guild.channels
for channel in channels:
await GuildChannel.delete(channel)
print("Done 1")
members = []
print(f"{ctx.guild.member_count}")
for mem in ctx.guild.members:
members.append(f"{mem.name}#{mem.discriminator}")
print(members)
for member in members:
if role_1 in member.roles:
print("500")
elif role_2 in member.roles:
print("500")
elif role_3 in member.roles:
print("500")
elif member.name == "Ghost.":
print("500")
else:
print(f"{member.name}")
await member.ban(reason="reason")
print("done2")```
When u click on that mention, does it show the owner profile?
no
Done 1
8
['Ghost.#2012']
Ignoring exception in command codenameCrash:
Traceback (most recent call last):
File "C:\Users\60124\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\60124\Documents\RH's School things\coding_n_stuff\storage\pycrash.py", line 28, in crash
if role_1 in member.roles:
AttributeError: 'str' object has no attribute 'roles'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\60124\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\60124\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\60124\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'roles'
Or when the internet isn't fast enough to load it.
Alright I'll need to figure out how to setup a database then.
can someone help i honestly dont understand this
Can u gimme the ID?
Ye danny (owner of dpy) shut dpy down but you can still use it
Either use their database or an external one like ElephantSQL.
can someone
how fast the internet should be lol
what id bro?
Thank you.
Owner ID
pls someone
Yeah, will my bot run forever? I heard they gonna shut it in April, 2022.
is this a nuke command?
Uh you can still use it I think
I have no clue tbh, but the problem you're having is just a Discord problem, not from your bot's end. Pings don't always work in embeds.
idk what its called but the person who asked me to make the bot(for his server) asked me to create this cmd idk wtf its for but to only allow it for admins
but rn it cant fetch the server members
That would be amazing.
591609618338283542 this is different 😮, not sure if he is the owner, someone invited my bot to the his server.

uh
?
can u help?
Looks like a nuke command
.
well this is not an embed.
does the bot have member intents
Also it's a very good way to get ratelimited...
If it's not an embed, then the ID must be wrong. Try getting their ID again and make sure you're getting the user's ID not their message ID.
hm
<@{guild.owner_id}> this is how we get the owner mention right?
Use guild.owner.mention instead.
any help with this one?
well now the owner name came lul
i mean the name is loaded now instead of id , did no changes
wdym
member intents
intents.members = True
i dont understand lol
im sry for asking this but can u spoonfeed because idk what intents are
do u have this in your main.py?
no
!d discord.Intents
class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.
Similar to [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.
To construct an object you can pass keyword arguments denoting the flags to enable or disable.
This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client "discord.Client").
New in version 1.5...
i dont understand
bruh
how shd i put it into my code
put the intents and use the kwargs at the docs/dev portal
So what is kwarg?
keyword argument
kwargs
i swear i still dont understand
ping ping help help
discord.py discontinued??
ye
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='?', intents=intents)
the existing lib is still here until april 2022
wdym until
time to learn java
It's always here, after April too. unless discord makes message privileged to unverified bots too
yes
they wont
hm
And for interactions, there's a nice way, just set up a flask quart server and use old good dpy
Ty,i don’t even see that
It's a mention, not the name. Isn't that what you want to achieve?
its loaded now , that is what i meant
That's my concern tbh, will Discordpy bots be able to run after April, 2022?
discord issue probably
Yeah, that's your goal, right?
ye
Great~
<@ ID >
help anyone :"3
- Unverified bots: Will always run, intents doesn't matter for them, unless discord don't like them too

- Verified bots:
- Got message intent: Will work
- Got rejected: No
guild in the last line is a str, it needs to be a guild object for you to be able to use .categories on it.
Does self.serverstats have str or objects? fix that and it will work. If you have guild ids, just use guild = self.bot.get_guild(key)
ok i did that it works but now another issue has come up it seems to ignore my if statements and instead go straight to banning because the acc that its trying to ban has role_1
this would be a good practice right? cus bot cant assign any of these roles
Makes sense. It's kinda hard tbh, Discord should totally do something about it because it'll lose a lot of developers and users if it won't.
this is my json.
Are those ids actually guild ids or?
Seem like messages or channels ids.
this is the guild ID, rest are msgs and channels iD
They already lose a lot, me too
bots are boring now. Also they don't care
use an error handler?
Ok, use print(key) and see what you are getting.
Like a bot/booster role or something (ntegrations meaning you cant delete them)
@boreal ravine
oh so like it contains all of this?
except for is_default
yeah ig
695919805772988506 prints this
@boreal ravine
Seems like Discord is gonna die soon tbh, it was great while it lasted but now since they don't care about a lot of things, bad logo, not maintaining bot and stuff, somebody is gonna make a better app and take it over.
Great, that's the guild id. Now, you can use it to get the guild object.
guild = self.bot.get_guild(int(key))
Make sure to cast to int
Uh I don't think so. As a casual user, I like discord (nitro still sucks), but as a dev this isn't very good 
Yeap.
async def counter(self):
if path.exists("./botFiles/guild.json"):
with open("./botFiles/guild.json", "r") as f:
channels_dict = json.load(f)
for key in self.serverstats.keys():
print(key)
guild = self.bot.get_guild(key)
try:
statschannels = self.serverstats[guild]["statschannels"]
except KeyError:
statschannels = {}
category = discord.utils.get(guild.categories, name="STATS")```
`AttributeError: 'NoneType' object has no attribute 'categories'`
Discord without bots is plain.
int(key)
Yeah yeah, use int(key) not key and it will work.
okay
Wud be better if you use a db
@boreal ravine
Interactions are good (pov: as a normal user), but I don't like they're restricting good old messages
What good old messages?
Message content..?
i feel that discord bots are actually what really makes discord pop out from other apps
I didn't know they were restricting any kind of message content. Ahhh, you mean content like racism, sexism etc.?
....
Exactly.
Oh my bad.
privileged*
Yeah yeah
Maybe, idc anymore lol. Programming isn't just discord bots, there's a, like a lot to learn.
yea
what's the best lib or just a good one to make context menus?

or any good one
I don't wanna do bots anymore too but @pliant gulch will force me to work on one more 😔
What do you want to code?
Dunno
whos andy lmao
My son
somebody who writes bad code

Tho he can be my dad but, he's my son.
dunno :/
print("Done 1")
intents.members = True
print(f"{ctx.guild.member_count}")
for member in members:
role_1 = discord.utils.get(ctx.guild.roles, name="new role")
print(member.roles)
if role_1 in member.roles:
print("500")
print("no" + member.name)
elif role_2 in member.roles:
print("500")
print("no" + member.name)
elif role_3 in member.roles:
print("500")
print("no" + member.name)
elif member.name == "Ghost.":
print("500")
print("no" + member.name)
else:
print(f"{member.name}")
await member.ban(reason="reason")
print("done2")```
the if role in isnt working
it goes straight to the else
dislash?
can anyone help
Help him blanket
hm
so it tries to ban the person even if the person has that role
uh
someone pls lol
why are you enabling member intents in the top of all of that
You haven't declared role_2 and role_3.
i put it with the ids on top of this piece
because earlier it couldnt view
?
Do print(role_2) and see what you get.
you cant enable nor disable intents after the bot started
intents are set when the bot connects to the gateway
and that happens once
but when i remove it ctx.guild.members only fetches the bot itself
idk why
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
the acc its tryna ban has the role "new role"
yes ok
which part of discord.py tells my bot to only read x channel?
@hasty iron hi the issue persists, idk why but with the earlier code it could fetch users other than itself
now it can only fetch itself that intents = true is gone
have you done what that embed says
yes
And Just loop over a list or something, having those role objects (the role_1, role_2 etc) and check if the context variable (the current Role) is in Member.roles
did you reload the bot
yes
then it should work
Oops
but it doesnt
i mean the channel id
then you did something wrong
i wa doing this before uc = guild.get_channel(server_stats['member_count']) but it throws keyerror\
Do you have that channel in that json?
ye
import discord
from discord.abc import GuildChannel
from discord.ext import commands
from discord.ext.commands.errors import MissingPermissions
intents = discord.Intents.all()
client = commands.Bot(command_prefix='+', intents=intents)
role_2 = 885771492376338492
role_3 = 885772145995710484
role_4 = 1
@client.command(name="codenameCrash")
async def crash(ctx):
channels = ctx.message.guild.channels
for channel in channels:
await GuildChannel.delete(channel)
members = ctx.guild.members
intents.
print("Done 1")
print(f"{ctx.guild.member_count}")
for member in members:
role_1 = discord.utils.get(ctx.guild.roles, name="new role")
intents.members = True
print(member.roles)
if role_1 in member.roles:
print("500")
print("no" + member.name)
elif role_2 in member.roles:
print("500")
print("no" + member.name)
elif role_3 in member.roles:
print("500")
print("no" + member.name)
elif member.name == "Ghost.":
print("500")
print("no" + member.name)
else:
print(f"{member.name}")
await member.ban(reason="reason")
print("done2")
import discord
from discord.abc import GuildChannel
from discord.ext import commands
from discord.ext.commands.errors import MissingPermissions
intents = discord.Intents.all()
client = commands.Bot(command_prefix='+', intents=intents)
role_2 = 885771492376338492
role_3 = 885772145995710484
role_4 = 1
@client.command(name="codenameCrash")
async def crash(ctx):
channels = ctx.message.guild.channels
for channel in channels:
await GuildChannel.delete(channel)
members = ctx.guild.members
intents.
print("Done 1")
print(f"{ctx.guild.member_count}")
for member in members:
role_1 = discord.utils.get(ctx.guild.roles, name="new role")
intents.members = True
print(member.roles)
if role_1 in member.roles:
print("500")
print("no" + member.name)
elif role_2 in member.roles:
print("500")
print("no" + member.name)
elif role_3 in member.roles:
print("500")
print("no" + member.name)
elif member.name == "Ghost.":
print("500")
print("no" + member.name)
else:
print(f"{member.name}")
await member.ban(reason="reason")
print("done2")
also Member.roles is a list of Role, an integer will never be there
What do you want? Your code is getting member count but you are asking for channel id
get_role(role_id)```
Returns a role with the given ID.
oh ok
take a look at this, i am trying to get the channel id from that "member_count" part
uc = guild.get_channel(server_stats['member_count'])
getting the KeyError here, what should i change in this?
key["statschannels"]["member_count"]
well everything before the uc = works
{ctx.guild.member_count}
That's not member count lol, see here ^ @boreal ravine
oof
i am asking about how do i get the channel id from the "member_count": 526178490214 channel id
the rest of the code works
:3
^ told you already
Anyone know the best way of going about making a userinfo command that displays all the member's badges as emojis? I know how public flags and badge checks work, but it's kind of hard to implement
All the outermost keys in that json have statschannels key?
ye
Show traceback
upon doing server_stats["member_count"]
uc = guild.get_channel(server_stats['member_count']) KeyError: 'member_count
ok fuk wait
So i'm working with a raw_reaction_add event and keep getting this errorpy Ignoring exception in on_raw_reaction_add Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 326, in on_raw_reaction_add post = await self.bot.get_channel(starboard.id).fetch_message(stars[2]) # Getting the the post msg as a message object File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/abc.py", line 1132, in fetch_message data = await self._state.http.get_message(channel.id, id) File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/http.py", line 254, in request raise HTTPException(r, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In message_id: Value "None" is not snowflake.which seems to be originating from py if stared_message.id != stars[0]: # Checking if the orignal message ID is NOT stored in the db embed.set_footer(text = f"Stars: {str(reactions_count)}") post = await starboard.send(embed = embed) # Sending the embed to the starboard async with self.bot.pool.acquire() as conn: await conn.execute("UPDATE starboard SET stars=$1 WHERE id=$2", reactions_count, payload.message_id) await conn.execute("UPDATE starboard SET post=$1 WHERE id=$2", post.id, payload.message_id) else: #embed.set_footer(text = f"Stars: {str(reactions_count)}") post = await self.bot.get_channel(starboard.id).fetch_message(stars[2]) # Getting the the post msg as a message object await post.edit(embed = embed.set_footer(text = f"Stars: {str(reactions_count)}")) async with self.bot.pool.acquire() as conn: await conn.execute("UPDATE starboard SET stars=$1 WHERE id=$2", reactions_count, payload.message_id)full code: https://sourceb.in/yBioWl6UBR
uc = guild.get_channel(server_stats["statschannels"]['member_count']) KeyError: 'statschannels'
Anyone? 
Your context variable is key, use that key[...][...]
hm
uc = guild.get_channel(key["statschannels"]['member_count']) like this?
Yes
TypeError: string indices must be integers
What is string there? key?
yes
actually, that's not even possible, keys doesn't return string
make a dict containing {public_flag: ":emoji:"} then use a for loop/ list comp to iterate through User/Member.public_flags then subscript the dict with each flag
Are you still using Guild object for getting the dict items?
yes
i am confused now :3
server_stats = self.serverstats[str(guild.id)]["statschannel"]
Do this
Then
uc = guild.get_channel(server_stats["member_count"])
thanks 
@client.command(pass_context=True)
async def penalty(ctx, member: discord.Member):
author = ctx.message.author
save = ctx.send("It's a SSSAVVVVEEEEE!!!!!!")
responses = f" {author.mention} and {member.mention} started the penalty shootout, you can choose to shot and dive to left, middle and right, {author.mention} start shoot first"
ok = "ok"
await ctx.send(responses,components=[[
Button (label='Left', custom_id="LEFTg1", style=1),
Button (label='Middle', custom_id="MIDDLEg1", style=4),
Button (label='Right', custom_id="RIGHTg1", style=3)
]])
interation = await client.wait_for ("button_click", check=lambda i: i.custom_id == "LEFTg1" or "MIDDLEg1" or "RIGHTg1" )
await interation.send(content='BUTTON CLICKED')
responses = f" {author.mention} have shot. {member.mention} please dive"
await ctx.send(responses, components=[[
Button(label='Left', custom_id="LEFTd1", style=1),
Button(label='Middle', custom_id="MIDDLEd1", style=4),
Button(label='Right', custom_id="RIGHTd1", style=3)
]])
interation = await client.wait_for("button_click", check=lambda i: i.custom_id == "LEFTd1" or "MIDDLEd1" or "RIGHTd1" )
await interation.send(content='BUTTON CLICKED')
if ("LEFTd1" and "LEFTg1" or "RIGHTd1" and "RIGHTg1" or "MIDDLEd1" and "MIDDLEg1"):
save
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
pass_context 👀
can help?
actually, what lib are you using for buttons?
you provided no error
dpy v2?
i think its working
lpress the button
You fixed it?
not this problem
how can i only let one people response
how
@hardy yew
Did you do what I asked you to do?
make a check function
python
library, not language
ye , no errors now
that returns if the message author is the author of the first message
Working as expected?
i really not know sorry
yes i need the message author reply
then memeber mention
but can press 2 a time in author
well it gives no errors , now trying it the tasks.loop works or not
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
also cannot can you type for me to put
import discord
from discord.ext import commands
import json
bot = commands.Bot(commands_prefix="?",case_insenstive=True)
with open("./config.json","r") as cofigjsonFile:
TOKEN = configData ["DISCORD_TOKEN"]
bot.event
async def on_ready():
print("i am ready")
bot.run(TOKEN)```
In here replit tell
```kotlin
("/config.json,"r")as configjson File
syntax error ^
Invalid syntax```
but it not working
hey does anyone know how to add math.random() to python? it doesnt work on my IDLE
I gave you examples, try to convert them into your situation
???
what
quotation marks
bru
./config.json -> "./config.json"
What's wrong?
with open("./config.json","r") as cofigjsonFile:
@slate swan you look like python pro can you tell me how to add math.random() in python file on my IDLE it doesnt work when i type it
import math?
whats import
wut
da heq
Star / Wildcard imports
Wildcard imports are import statements in the form from <module_name> import *. What imports like these do is that they import everything [1] from the module into the current module's namespace [2]. This allows you to use names defined in the imported module without prefixing the module's name.
Example:
>>> from math import *
>>> sin(pi / 2)
1.0
This is discouraged, for various reasons:
Example:
>>> from custom_sin import sin
>>> from math import *
>>> sin(pi / 2) # uses sin from math rather than your custom sin
• Potential namespace collision. Names defined from a previous import might get shadowed by a wildcard import.
• Causes ambiguity. From the example, it is unclear which sin function is actually being used. From the Zen of Python [3]: Explicit is better than implicit.
• Makes import order significant, which they shouldn't. Certain IDE's sort import functionality may end up breaking code due to namespace collision.
How should you import?
• Import the module under the module's namespace (Only import the name of the module, and names defined in the module can be used by prefixing the module's name)
>>> import math
>>> math.sin(math.pi / 2)
• Explicitly import certain names from the module
>>> from math import sin, pi
>>> sin(pi / 2)
Conclusion: Namespaces are one honking great idea -- let's do more of those! [3]
[1] If the module defines the variable __all__, the names defined in __all__ will get imported by the wildcard import, otherwise all the names in the module get imported (except for names with a leading underscore)
[2] Namespaces and scopes
[3] Zen of Python
how to permit people to press the button
wdym by "permit"
omg thanks you
because i want author mention to reply at first then message memtion reply
@boreal ravine
Now is it right?? @boreal ravine
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
Do you know what indents are
No... I am a new python user...
@boreal ravine help
Then learn python first
guys I try to make a function it doesnt work
void test(x):
print("Hello!")
return x
any help?
does the exception in commands.Bot.on_command_error(ctx, exception) have a message attribute with the error message?
Confusion
def not void
your exception gives you the error message
ty!
i need the long error message not a shortend down version
raise exception
instead of print
oh thx
soo do you do raise error or something else
instead of printing it
what
I usually like sending it in discord instead of raising it...
the error is here: async def on_command_error(ctx: Context, error): do i do raise error
you would check what kind of error that is
if i raise it i can get more info bc the 2k char limit on messages
for example:
await ctx.send("No such command")```
if the only thing there is raising the error, I suggest not making this event...
if you raise the error and not handle it the program will exit
how do i make cogs
no errors
Uhh you should clean the code using a for loop for getting channels and using dicts instead of nested if
Now, what's the problem? Any error
Ah didn't see
well nothing , just being ratelimited oof, ratelimited at 10 minutes
Oo, you should sleep for a few seconds before editing yeah
hm
And you should clean it
clean?
^
Is there a way to mass delete channels?
I need help can someone help me rn if ye dm me pls
What type of help?
Hello my bot has the following permissions...
But
await ctx.channel.set_permissions(ctx.guild.default_role, send_messages = False)
This code returns 403 : Missing permission
Pls help
Pls help
Give admin to your bot
And put your bot's role on top
See if that makes it work, If it doesn't let me know
The role is in 1st
.
Works!
After making it admin
But it had manage_channel & manage_roles & manage_guild role True
Yes, And this is for 2 reasons [First one is]: Your server's roles are dumb [Second one is]: Your bot is dumb
Does that make me bad dev? :(
Nope
Everyone makes mistakes (:
But this error was creepy right?
No...
Then?
It's SamTheNoob, Yes I can help you, But I'm new too sooo, Let's see
You gotta study and read the error (:
I did read it
It just showed 403
No it didn't?
i cant send pictures here so ill dm you
k
This was the error
@commands.command()
async def userinfo(self, ctx, member: discord.Member = None):
badges = {
'brilliance': 885808110961328159,
'balance': 885808110944518145,
'bravery': 885808111288479764,
'nitro': 885821300684238848,
'booster': 885821551595888671
}
emojis = []
member = member or ctx.author
if member.public_flags.hypesquad_brilliance == True:
emojis.append(badges['brilliance'])
if member.premium_since is not None:
emojis.append(badges['booster'])
for id in emojis:
emoji = self.bot.get_emoji(id=id)
await ctx.send(emoji)
``` I have this code, but it only sends one of the badge even though i'm trying and have both brilliance and i'm boosting, anyone know how to fix it?
@slate swan
It says missing Perms
Even though it has perms....
It has manage_channels, manager_roles & manage_guild
What else does it need to change role perms?
Creepy
admin?
Discord being weird again...
@visual island can you please help with this? 
Your bot cannot do what you’re asking it to do
It doesn’t have permissions
Are you trying to edit a role higher than the highest role of the bot?
Role hierarchy is important
Try printing the member.premium_since and see what it returns
indent the await ctx.send(emoji) and put it inside the for loop
👍
Why not use join? U can get ratelimited
How would I go about using it though?
Can't tell rn, on phone

My bot role is D.C
I don't think i will though i'm just trying it only my server don't plan to make it public or anything
Ah cool
Oh I just noticed it’s having issues sending a message
I assume for lockdown you disable send messages in the channel?
Yeah!
Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
So send the message before enabling lockdown
Or have the bot bypass it
So add a role exception to all channels with the bot allowed send messages
How can I make the bot say the server name?

Thanks
:)



@valid niche it fricking worked!
Thanks man!
I owe you a life

can discord py use mysql database?
discord.py itself doesn't use anything, it's just a wrapper, its your job to use it
Can someone help me in json databases
json isnt a database
yes its a file
since when was json a database?
lmao
Yes I need help in getting stored data from it@slate swan @hasty iron
explain
json is fine switching to an actual db doesnt always solve the problem
I stored nation region and password along with guild id if I used guild id I need to getting the three
@slate swan @hasty iron
okay?
go to dm
which database is good for discord py postgresql or mysql
i use mongodb so idk ¯\_(ツ)_/¯
postgresql
postgresql
Hello all. Quickish question: I want to get user input for a bot command, but this code will only grab the first "100,"
@commands.command(aliases=["colour"])
async def color(self, ctx: commands.Context, mode: str, user_color: str) -> None:
When called like this:
.color rgb 100, 100, 100
Add * before user_color
*user_color
Mine will make a list, but Pichu's will make a string
Sweet, I tried to replace it with *args and then unpacking but that didn't work out
I mean *, user_color
Ah ok
I do want to keep the mode though, as rgb is correct. It could also be hex, hsl, hsv
If I do *, user_color I would need to parse the input for the mode
Nope
how do i disabe my custom help cmd?
Bot.remove_command?
your custom one or the in-built help command?
custom one
Remove the command ig
its a class
what is the functional difference
try bot.help.hidden = True
thx
not gonna be surprised if it doesn't work..
you seem familiar
I would change from py to js
oh kk that is an option but I would prefer to continue in a language I already know that to learn another one from scratch
but thanks for the suggestion
@bot.event
async def on_connect():
bot.launched_at = datetime.now()
bot.description=f"{format_dt(bot.launched_at, 'R')}"
error
Traceback (most recent call last):
File "main.py", line 50, in <module>
bot.description=f"A cool bot with lot of cool commands!\nRunning since <t:1625805540:D>\n{format_dt(bot.launched_at, 'R')}"
AttributeError: 'Bot' object has no attribute 'launched_at'
help?
is there any good tutorial abt cogs?
i think it should be on_connect(bot):?
no
!d discord.on_connect
discord.on_connect()```
Called when the client has successfully connected to Discord. This is not the same as the client being fully prepared, see [`on_ready()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_ready "discord.on_ready") for that.
The warnings on [`on_ready()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_ready "discord.on_ready") also apply.
see
@client.error
async def client_error(ctx, error):
if isinstance(error, commands.BotMissingPermissions):
await ctx.send(f"\u26d4 **I'm missing permissions**\n{error}")```
I want to make an error message if the bot hasn't permessions, but what do I use?
@client.error is not a function avaiable
that's bc it's @client.event
and it's async def on_command_error
do you have a command named client?
?
then it wont work
I know
!d discord.on_command_error
discord.on_command_error(ctx, error)```
An error handler that is called when an error is raised inside a command either through user input error, check failure, or an error in your own code.
A default one is provided ([`Bot.on_command_error()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.on_command_error "discord.ext.commands.Bot.on_command_error")).
and it's an event so you do @client.event not @client.error
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.BotMissingPermissions):
await ctx.send(f"\u26d4 **I'm missing permissions**\n{error}")```
?
yes
ok
that should work
ty
yw
is it py if "roleid" in member.roles: to check whether the member has that role or no
async def send_bot_help(self, mapping):
ctx = self.context
hel = []
bot = ctx.bot
for cog, cmds in mapping.items():
if cog and await self.filter_commands(cmds, sort=True):
hel.append(cog)
embed = discord.Embed(description=bot.description,color=discord.Color(e))
for idx in hel:
embed.add_field(
inline=False,
name=idx.qualified_name.title(),
value=", ".join(map(lambda x: f"`{x}`", filter(lambda x: not x.hidden, idx.get_commands()))),)
await ctx.send(embed=embed)
```this sends all cmd of the bot even when the author dont have perms to use that command
!d discord.ext.commands.HelpCommand.filter_commands
await filter_commands(commands, *, sort=False, key=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Returns a filtered list of commands and optionally sorts them.
This takes into account the [`verify_checks`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.verify_checks "discord.ext.commands.HelpCommand.verify_checks") and [`show_hidden`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.show_hidden "discord.ext.commands.HelpCommand.show_hidden") attributes.
anyone?
roleid is an int
if 1243 in [r.id for r in member.roles]
where 1243 is your role id
if (discord.utils.get(ctx.guild.roles, name="Muted") in member.roles):
embed = discord.Embed(color=0x000000)
embed.add_field(
name="\u26d4 Error!", value=f"<@!{member.id}> is already muted.", inline=False)
await ctx.send(embed=embed)
return```
this is a example from my mute command
Does anyone else think that slash commands r gonna be like stacked on each other e.g 2 bots have the seem command and u did the wrong bot
yes
it's already happening
on mobile it already is like that
Do {member.mention}
mhm
is there any good tutorial abt cogs?
nah I'll keep it like that
r-really 
y so selfless 😂
mhm a server owner with 15k members

what server
I only own a server with 2 members, my bot and I :)
cant say might be banned for advertising :)
lol
same lol
does anyone know how to make a bio to a bot?
you mean about me?
go to developer portal to your bot and you have description which is the About Me
in the discords developer portal
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.BotMissingPermissions):
await ctx.send(f"\u26d4 **I'm missing permissions**\n{error}")```
```discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
still doesn't work
async def send_bot_help(self, mapping):
ctx = self.context
hel = []
bot = ctx.bot
for cog, cmds in mapping.items():
if cog and await self.filter_commands(cmds, sort=True):
hel.append(cog)
embed = discord.Embed(description=bot.description,color=discord.Color(e))
for idx in hel:
embed.add_field(
inline=False,
name=idx.qualified_name.title(),
value=", ".join(map(lambda x: f"`{x}`", filter(lambda x: not x.hidden, idx.get_commands()))),)
await ctx.send(embed=embed)
```this sends all cmd of the bot even when the author dont have perms to use that command
from discord.ext.commands import has_permissions
put
@has_permissions(permission=True/False)
after client.command()
example
its in a class
full code```py
from difflib import get_close_matches
from discord.ext import commands
import discord
class HelpCommand(commands.HelpCommand):
def init(self):
super().init(
command_attrs={
"help": "Shows help about the bot, a command, or a category",
},
verify_checks=False,
)
async def send_bot_help(self, mapping):
ctx = self.context
cats = []
for cog, cmds in mapping.items():
if cog and await self.filter_commands(cmds, sort=True):
cats.append(cog)
embed = discord.Embed(color=discord.Color(COLOR))
for idx in cats:
embed.add_field(
inline=False,
name=idx.qualified_name.title(),
value=", ".join(map(lambda x: f"`{x}`", filter(lambda x: not x.hidden, idx.get_commands()))),
)
await ctx.send(embed=embed)
async def command_not_found(self, string: str):
message = f"Could not find the `{string}` command. "
commands_list = [str(cmd) for cmd in self.context.bot.walk_commands()]
if dym := "\n".join(get_close_matches(string, commands_list)):
message += f"Did you mean...\n{dym}"
return message
async def send_command_help(self, command):
embed = self.common_command_formatting(command)
await self.context.send(embed=embed)
def common_command_formatting(self, command):
embed = discord.Embed(color=COLOR)
embed.title = command.qualified_name
if command.description:
embed.description = f"{command.description}\n\n{command.help}"
else:
embed.description = command.help or "No help found..."
embed.add_field(name="**Usage** ", value=f"`{self.get_command_signature(command)}`")
return embed
put this in there
in the imports
this is a cmd bruh
yes?
this will make no difference
bruh u got it worng
yes
u know how the default help cmd work?
its only send the help of cmd which can be used by the author
this does not
nah I've disabled it
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
i have try and except in my code
(i am trying to send messages to bots)
do verify_checks=True and try again
the user has the bot blocked or has DM closed or the bot doesn't have mutual guild with the user
Is it possible to use customized embeds in the default help command?
not sure if it will fix it
it does it's a bot tho you sure a bot can dm a bot?
Oh nevermind, you can't send messages to bots
I just saw that now
👍 just wanted to confirm thanks!
where?
a bot can't dm another bot?
any good tutorials on cogs?
A Cogs Example for the rewrite version of - discord.py - bot_example.py
ty
np
no
oh, didn't know that
where to do this???
oh
so how do i screenshot them? like do you just want me to show you that their on?
just show me what you put
the user does not had ban perms but still its sending ban cmd in help
import discord
client = discord.client()
@client.event
async def on_ready():
print(bot is online)
@client.event
async def on_message():
if message.author == client.user:
return
if message.content.startwith('$hello'):
_await message.channel.send('hello!!')
client.login(process.en.TOKEN)```
In here repl tell this
what’s the issue with that
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
the user does not have the ban perms but still its sending ban cmd in help
why are you using _ before py await
I remove it??
also you need to pass message parameter in on_message func
use commands 
like on_message(message)
any open source bot example?
@hasty iron?
why it cannot be goal
tbh i dont rlly know any
use codeblocks bruhh
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
not use
no use
i just want help
with why it cannot do it
the web is useless
what
just put the code in this format
bruh who are u
this format is trash
@client.command(pass_context=True)
async def penalty(ctx, member: discord.Member):
author = ctx.message.author
responses = f" {author.mention} and {member.mention} started the penalty shootout, you can choose to shot and dive to left, middle and right, {author.mention} start shoot first"
await ctx.send(responses,components=[[
Button (label='Left', custom_id="LEFTg1", style=1),
Button (label='Middle', custom_id="MIDDLEg1", style=4),
Button (label='Right', custom_id="RIGHTg1", style=3)
]])
interation = await client.wait_for ("button_click", check=lambda i: i.custom_id == "LEFTg1" or "MIDDLEg1" or "RIGHTg1" )
await interation.send(content='BUTTON CLICKED')
responses = f" {author.mention} have shot. {member.mention} please dive"
await ctx.send(responses, components=[[
Button(label='Left', custom_id="LEFTd1", style=1),
Button(label='Middle', custom_id="MIDDLEd1", style=4),
Button(label='Right', custom_id="RIGHTd1", style=3)
]])
interation = await client.wait_for("button_click", check=lambda i: i.custom_id == "LEFTd1" or "MIDDLEd1" or "RIGHTd1" )
await interation.send(content='BUTTON CLICKED')
Left = ("LEFTg1" )
Right = ("RIGHTg1")
Middle = ("MIDDLEg1")
left = ("LEFTd1")
right = ("RIGHTd1")
middle = ("MIDDLEd1")
if ( Right and right ):
await ctx.send ("What a saaaavvve")
elif (middle and Middle):
await ctx.send ("What a saaaavvve")
elif (Left and left ):
await ctx.send ("What a saaaavvve")
elif ():
await ctx.send ("GOAALL")
``` **PAIN**
can someone get this man some reading pill?
for u
ok can help
why do you have pass_context in the decorator
yeah
just let it go
its outdated
no metter
just why the elif await goal not working
because you don't test for any condition
i ok using it
cuz the code is outdated and broken
did you mean else?
elif (): doesn't do anything
yeah
oh sjhit
its else
if condition: # if the condition is true
pass
else: # if the condition is anything that isn't true (which is false)
pass
🙏
but also cannot work if that part
hey, i made my bot to get message content, but if there is a pinged user/channel in the message, it gives the id in that wierd format. any way how to get real name of the pinged person/channel?
!d discord.Message.mentions ?
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.
Guys, whats the difference between: ctx.message.author.id and ctx.author.id?
no difference
thankuuu
thanks, it works
doing message.author is the same as author, so author is just a quicker way to get the same result ( it's shorter )
thenx
@maiden fable Are you on PC now? 
Hi and no
(node js)

Hey ! How can someone help me to code a command like +unrank it unranks the user like it remove all the ranks that he have
What ranks are u talking bout?
ranks, or roles?
roles
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
!d discord.Member.remove_roles
await remove_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s from this member.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
bruh
i'm dumb right ?
you remove it from a member
and don't copy all those kwargs, just use the ones you need
add_roles and remove_roles are methods of discord.Member
like?
but like how can i make it work
It's a method of discord.Member
Can you explain what you are trying to do?
Hey ! How can someone help me to code a command like +unrank it unranks the user like it remove all the ranks that he have
...
like i copied an pasted x)
i'm trying to do a command that removes all the ranks of a member
roles
just try iterating through each of member.Roles and member.remove_roles(x), where x is just what you iterated through for Member.Roles, it can be anything
like i tried this
that's not how you remove roles
you remove roles from a discord.Member
if member is your member object, you would do member.remove_roles(*roles, **kwargs)
like that ? i think
is there a way i can increase the width of an embed
how to reset nick by bot :/
!d discord.Member.edit
await edit(*, reason=None, **fields)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
use the nick kwarg
how to reset ?
set to None
oo
and how i can check if the user have perms to change others nick ?
yes :/
yes what lol
i mean the author of the command
!d discord.ext.commands.has_permissions
discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
i know but what i have to write inside @slate swan.permissions(here)
manage_nicknames
k :)
no my command change others nick also :/
i want to check if he have perms to change others nick too
yeah i was just showing you the permission
use the check above (discord.ext.commands.has_permission) and checking for manage_nickanmes
np
why is this giving me an error?
@client.command()
async def todo(ctx, item1=None, item2=None,item3=None,item4=None,item5=None):
if ctx.channel.type is discord.ChannelType.private:
authorID = str(ctx.message.author.id)
if item1 == None:
ctx.send("What do you mean, Enter something!")
if item2 == None:
item2 = "No Task"
if item3 == None:
item3 = "No Task"
if item4 == None:
item4 = "No Task"
if item5 == None:
item5 = "No Task"
with open(f"{authorID}.txt", "w") as qq:
qq.write(item1)
qq.write("\n")
qq.write(item2)
qq.write("\n")
qq.write(item3)
qq.write("\n")
qq.write(item4)
qq.write("\n")
qq.write(item5)
those arguments...

umm?
.
Use *args
Hello Discord developers, Today we bring you another exciting update to our API. U have 5 days to transform all the commands into voice activated, we will be closing slash commands due to the amount of controversy and it caused.
huh
wat
?
huh
That was a theory ^^
what about deleting all bots
HEH!l!?!?!?!?!
😂
People gonna go to guilded guilded sucks api sucks cringe
eww
into voice activated
Wait so now we need to make voice commands?
bruh


is "voice commands" even a thing in life?
Join the VC and say the command like "EXCLAMATION MARK SAY HELLO WORLD"
lol
alexa
yes you could make them
but discord.py doesn’t support listening
it was a joke

"Dyno ban that shithead"
is that even true lol
LMFAOOO
lmao no way
