#discord-bots
1 messages · Page 777 of 1
"a link"
this is why so much bot's have ultra plus pro premium supreme package deal 1% off super-sale black saturday
lmao
probably because they lost their money for the domain
ill just use my bot's repo wiki
eh alright
cause im not gonna learn html or smthing
But-
You can make the TOS website easily with html and bootstrap and flask
¯\_(ツ)_/¯
i can just write it easily with some basic markdown in a wiki page
elif user_message.lower() == "!joke":
await message.channel.send(random.choices(jokes))
return
```.
when the bot prints this
uhuh, Good Luck fren
a tuple inside of a list inside of a tuple ins- 😃
enough discord for today
go sleep , ashley
oh it reminds me of okimii
Its 5 am, I'm bored so I came here to kill it
Welp
oh , by your time ill assume you're somewhere from europe 😔 GMT+1
Yes
same.
making something funny , lets see how it goes
india*
Bro you and me brothers
Suggest more topics here!

cof cof
Damn Dues Ex is fun
!ot cof cof
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
No thanks
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
yo
Hi?
its in the dev portal
oh where
ye?
I mean add to server button in profile
i think its in general
ye
OAuth2 -> General -> Scroll Down
!pypi disnake-debug || due to the silence, i feel as if it is my moral duty to help onlookers 🙂
no hes helping🚶
im helping younger, less experienced disnake users have a chance at succeeding in life, through the usage of the blacklist, github, view, invoke tracking and much more 🙂
inspirational 
i try my best 🙂
lovely work
ping
pong
what is this
is DevilBro in this server?
well, im glad you asked! its an easily loaded extension with over 30 features to make your bot usage simpler, safer and super. There are some pictures on the pypi that show what it looks like 🙂
advertisement spotted
people can easily implement that
but ok
is the code in github?
yes
May I get the link
noice
most inexperienced users cant though
hence why jishaku is a thing…people can implement it but noone can be assed
one of the many reasons why you learn python enough before making a bot
class MyButtonLink(disnake.ui.View):
def __init__(self):
super().__init__()
self.add_item(disnake.ui.Button(label='✅ Support Server', style=disnake.ButtonStyle.blurple,
url='e'))
self.add_item(disnake.ui.Button(label='🌐d Website', style=disnake.ButtonStyle.blurple,
url='e'))
@client.slash_command(name='BotInfo',
description='Shows Bot Info.')
async def BotInfo(inter: AppCmdInter):
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
await inter.send(embed=embed, view=MyButtonLink())
```|
why does it say application didnt respond
🤦
slap
dumb question, but how do I add a second name to 1 cmd?
so !leave and !stop is the same
aliases
@tawdry perch py @commands.command(alias= ["stop"])I tried this, but doesnt seem to work
aliases...
aliases=['testcommand', 'testing']
it's aliases not alias, since it takes a list
ah I see
its plural
since it takes a list
is it possible to include a member's profile picture in an embed?
you need the member or user object of the user
the member object has an avatar object as parameter which refers to the user avatar, with the avatar object you can get the avatar url which is required to send the image
thanks
oo i could add a bot invite generate
hey how to make a timeout command?
What would it do
Ah you mean discord timeout
!d disnake.Member.timeout (or any other fork)
await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Times out the member from the guild; until then, the member will not be able to interact with the guild.
Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.
You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.
New in version 2.3.
Check this out https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
cant it be done without disanke
snake*
Raw request only ;)
Main library doesn't support it, so raw request or a fork
It is very similar to the main library so shouldn't cause any issues
Or hikari
Sure
Aiohttp pretty gut
Aiohttp?
usually people say "try Beautifull soup" and ive tried but not good
soo ima try this Aiohttp
well what i tried to scrape is just a static image and a text from a <span></span>
so bs4 can
?
Yeah def
yo this keeps happening when I try to add a field to my embed, it just makes all the fields the same I have no idea why. This is poorly explained so: https://gyazo.com/e4cf295a3467251437ae2fe558a04852 ```py
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
if payload.member.bot:
return
e = 0
casinoMessageReaction = discord.Embed(title = "SLOTS", description = "These are the current selected slots", color = discord.Color.blurple())
casinoMessageReaction.add_field(name = "Selection", value = "Please select the slots you want to roll from (click on the emojis)", inline=False)
b = '\n'.join(map(str, Blacklisted))
casinoMessageReaction.add_field(name = "BLACKLISTED SLOTS (These slots are not able to be rolled)", value = b, inline=False)
embed_dict = casinoMessageReaction.to_dict()
for field in embed_dict["fields"]:
if field["name"] == "BLACKLISTED SLOTS":
await asyncio.sleep(1)
field["value"] += str(b)
casinoMessageReaction.set_thumbnail(url="https://i.imgur.com/7xDaaTf.png")
casinoMessageReaction.set_footer(text=f'Cosmic Overground',icon_url="https://i.imgur.com/7xDaaTf.png")
casinoMessageReaction.timestamp = datetime.datetime.utcnow()
if payload.channel_id == 935100681629601802:
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(payload.emoji) == ":zap:":
selectedSlot.append("Gates of Olympus")
for x in selectedSlot:
xq = (next(item for item in slotDict if item["Slot"] == "Gates of Olympus"))
casinoMessageReaction.add_field(name = str(xq['Slot']), value = str(xq['Symbol']), inline=True)
await channel.purge(limit=1)
await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == ":four_leaf_clover:":
selectedSlot.append("Leprechuan goes WILD")
for x in selectedSlot:
xq = (next(item for item in slotDict if item["Slot"] == "Leprechuan goes WILD"))
casinoMessageReaction.add_field(name = str(xq['Slot']), value = str(xq['Symbol']), inline=True)
await channel.purge(limit=1)
await channel.send(embed=casinoMessageReaction)``` basic jist of the code
because I'm adding a field to it
I think it would be the same
if I edited it
Message edits can do that.
what is the syntax
its just like sending a msg
you make an embed and you edit the msg with the new embed
also
I solved the issue, been stuck on this fo rso long
if str(payload.emoji) == ":zap:":
selectedSlot.append("Gates of Olympus")
for x in selectedSlot:
xq = (next(item for item in slotDict if item["Slot"] == "Gates of Olympus"))
casinoMessageReaction.add_field(name = str(xq['Slot']), value = str(xq['Symbol']), inline=True)```
just realised that this would send the new field 3 times as its set as that
🤦♂️
this would be way more code I think
cause I would need to put the new updated embed in the if statements evert time
Is anyone familier with sphinx-module ?
DM me, I need help with auto-documentation
If its related to bot making, then sure!
ok ima send a script
Hey @misty ridge!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
welp i cant
this is the link to my script
so do you guys have any opinions how to make it "prettier" and how do i make another slashcommand do i just make another @bot.slash_command()??
hello is there a way to make a prefix = when mentioned ?
!d discord.ext.commands.when_mentioned or when_mentioned_or
discord.ext.commands.when_mentioned(bot, msg)```
A callable that implements a command prefix equivalent to being mentioned.
These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.
can someone help me with this
let me grab the code rq
blanked out a bunch
but it doesn't display
the amount of servers
aged like wine
app.run completes an endless loop ig which stops the run method for the bot ¯_(ツ)_/¯
probably your command name is the same as your variable name
did you add the bot to your server?
dis is where the error occure :V (yes, replit)
hmm, can I see the whole traceback?
k
can you show ss of where you defined your bot?
nvm, Infernum is here
keep alive
you made a command named bot in your code, easy peasy
wait, where is the booster infernum
oh right :V k ty
bot = Client() #whatever, who cares
@bot.command #who cares about parantheses
async def bot(): pass #who cares about Context
idk where is he
:V k
Token exposed
No..
@slate swan
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)```
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 voice parameter and set it to None to kick them from voice
Ok
yeah, ping if you need any help
Sure
https://paste.pythondiscord.com/kajoxazihu.py
this is the link to my script
so do you guys have any opinions how to make it "prettier" and how do i make another slashcommand do i just make another @bot.slash_command()??
edit not defined ...
..
Delete that ss, we can see your token
eh?
Now u cant do anything its already leaked just reset it
thanku for reminding, continues writing nuke code
Help me
That aswell, + deleting it will prevent more people from seeing it too
lmao
show what you did
await edit()
lmao
its showing yellow line down
grab the member object and use the edit method on it ;-;
As i got in docs
cof cof
await user.edit sorry lol
its also for users
Oh user, then do that
yep, dsc from a vc channel
sorry for?
Ur time waste
took like 15 seconds, don't worry
Time is money
thats what I did my entire life
-_-
My bot is slow
🫂 c'mere have a hug
Cuz my pc is slow ;-;
if your pc is slow , reduce the numbers of task
Also , I'd never host my bot at a development stage
Just saying
Im not hosting now...
Ill also host after fully completed
in that case , check pins
Ok
the 4 message from newer
So much pins eh
embed=disnake.Embed(color=0x8400a8, title="Bot Stats", description="This bot is currently on " +str(len(client.guilds)) " servers.")
Why at the firt breacket it says that it is not closed
e
e
e
yelp me
use f strings when
and also uh
!e ```py
text = "is"
print("This " + text "a string")
@heavy folio :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print("This " + text "a string")
003 | ^^^^^^^^^^^^^^^^^^^^^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
see that? you missed a + but anyways use f strings
My bot was offline for more than half the day
Probably cuz they cannot handle the bots uwuness like its owner ¯\_(ツ)_/¯
ok
my friend have vps u know
So?
It's a VPS issue
Yeah ik, hope you'll fix it soon, good luck
Not a problem from my side
ahem ahem task manager exists
sue them
It's my friend's VPS
uhuh, i know, you flex about it every time
I don't really flex but okay
cof cof cap
Someone just ask where I host the bot and I tell them the truth
I don't see hows that flex ¯_(ツ)_/¯
hm?
why u bully me
???
bulldog
Bruh
She didn't bully you...?
this channel today is too boring and ot tbh
Yea
can any of u guys make me code for zoom cuz i wanna recreate zoom just dm me if u done with it
Also I'm getting -ve vibes from this channel for some reason
...?
code for me zoom and send me later
Wut
what do you even mean
zoom , as in the zoom app?
yes
💀
just send me when u done
And?
I can make one but I'll keep it myself
U know... this convo is better suited in #python-discussion
¯_(ツ)_/¯
bull
stop pls
stap what
what did i do 
being weird 🫂
You know it very well
n

stop it please , its getting annoying 🙏
and i wont step back pinging a mod or blocking you
Dude
what?
Stop now, I'm being serious. I won't hesitate to ping the mods now
i already stopped
why wouldn't this work???
@bot.command()
@commands.has_permissions(manage_messages=True)
async def dm(ctx, member : discord.Member,*,reason=None):
if member == ctx.author:
em2 = discord.Embed(description=f"**you** cannot send a `dm` to yourself", colour=discord.Colour.red())
await ctx.send(embed=em2)
else:
em2 = discord.Embed(description=f"the `dm` has been **sent** to {member.mention}", colour=discord.Colour.green())
em1 = discord.Embed(description=f"{member.author} has **sent** a `dm` to you through the bot", colour=0)
em3 = discord.Embed(description=f"{reason}", colour=0)
await ctx.send(embed=em2)
await member.send(embed=em1)
await member.send(embed=em3)```
hm
What's the error
there's no error
hm
U got an error handler?
what?
An on_command_error event
idk
+dm {member} {reason}
you didnt provide a reason maybe ?
so the embed3 fails
Then it should have sent None
what does it say when u do the command
it doesnt send anything
!e print(f'{None}')
@maiden fable :white_check_mark: Your eval job has completed with return code 0.
None
em3 = discord.Embed(description=f"{reason}", colour=0)
no ig
it would be same as 0x00000 which is black
^
!e print(0x00000)
im not gonna edit it now
!purge
Then resend it
..
@slate swan :white_check_mark: Your eval job has completed with return code 0.
0
Hmm
Wrong chat bruv
why do you think this will work?
!e printz9
@nimble plume :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'purge' is not defined
!d discord.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
@commands.command()
async def userid(self,ctx, id : int = None):
if id is None:
return
date_format = "%a, %d %b %Y %I:%M %p"
user = self.bot.get_user(id) or await self.bot.fetch_user(id)
embed = discord.Embed(color=0x3498db, description=user.name)
embed.set_author(name=str(user), icon_url=user.avatar.url)
embed.add_field(name="Registered", value=user.created_at.strftime(date_format))
await ctx.send(embed=embed)```
no errors, just doesnt work
Rip
how to get text channel in cyx
do you have an on_command_error event?
why does everyone say this even i said it b4 lol
Ctx*
ctx.channel
whats that?
ctx.channel
Ok
I'll just go and grab something to eat, best of luck helping them, Sarthak
its an event used to handle errors , please check if you have any
lol
how do i check?
have fun :0
@commands.command()
async def userid(self,ctx, id : int = None):
if id is None:
return
date_format = "%a, %d %b %Y %I:%M %p"
user = self.bot.get_user(id) or await self.bot.fetch_user(id)
embed = discord.Embed(color=0x3498db, description=user.name)
embed.set_author(name=str(user), icon_url=user.avatar.url)
embed.add_field(name="Registered", value=user.created_at.strftime(date_format))
await ctx.send(embed=embed)```
no errors, just doesnt work
um just use ctrl+f and search for on_command_error maybe
what are you trying to do
getting userinfo of a user that isnt in the guild / mutual guilds
thats easier
no?
I mean the thing you sent*
yea
still not working, no errors
doesnt work
Help purge not working
mhm so seems like you dont have it
nothing shows up on using the command?
whats ur command
also , do other commands work?
await ctx.channel.purge(limit=1)
yes
ur whole command, not one line
they dont work either
or maybe u can put a print() at the end of the command to check if the code even goes thru
Help
my entire cog doesnt work
for extension in initial_extensions:
bot.load_extension(extension)
print(f'loaded {extension}')```
it isnt getting loaded properly
i think u can make commands without cogs?
¯_(ツ)_/¯
do you have an on_message event?
what abt after each line?
def setup(bot):
bot.add_cog(warns(bot))```
possibly
are other cogs and commands working?
wdym
yeah i got an on message
if none of them work , read the on_message faq
tried making mod mail
like do a print after each line on the command
Yeah but it's a bad idea
y tho
u can do that too if u want
@commands.guild_only()
@bot.command(name="clear")
async def clear(ctx, * , int1):
if int1 is None:
s = discord.Embed(title="Pls specify a integer",color=red)
await ctx.send(embed=s)
# elif type(int1) is not int:
# s = discord.Embed(title="Pls specify a integersss",color=red)
# await ctx.send(embed=s)
else:
try:
await ctx.channel.purge(limit=int1)
s = discord.Embed(title=f"Deleted {int1} Messages",color=green)
await ctx.send(embed=s)
except:
s = discord.Embed(title="Cannot delete msg",color=red)
await ctx.send(embed=s)
Code is going to be incredibly unorganized and help command
well i just finished a bot without cogs-
same
hardly a problem
doesnt have alot of command tho
alright, got an error now
Very common beginner mistake
Help
welcome to the gang , hope you wont be rewriting the bot 4th time
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In user_id: Value "Necro" is not snowflake. the user id's name was necro
maybe when i make my next bot, i will learn cogs
no?
yep the code goes through
u better start it now
told ya , use discord.User typehint
Me who made a discord bot for a project and got turned down due to cogs in school ¯_(ツ)_/¯
I am
well im not creating anything rn
wait u have a error handleer
@commands.command()
async def userid(self,ctx, user : discord.User = None):
if user is None:
return
date_format = "%a, %d %b %Y %I:%M %p"
user = self.bot.get_user(user) or await self.bot.fetch_user(user)
embed = discord.Embed(color=0x3498db, description=user.name)
embed.set_author(name=str(user), icon_url=user.avatar.url)
embed.add_field(name="Registered", value=user.created_at.strftime(date_format))
await ctx.send(embed=embed)```
Yes. Your code is going to be incredibly unorganized and your help command is going to be shit
whats the issue ¯_(ツ)_/¯
why are fetching/getting the user then!
@slate swan
just use the user
no need for that?
i dont have a help command c:
nope
the issue is?
whats the prob
alr my bad, couldve known that since I use a lot of discord.object
where does it show that?
Cannot clear msg
permissions
Then your code is unorganized
All
my bot isnt public, its only for my server.
Administration
only for moderation.
uhuh, try printing the Exception
@dm.error``` this is also a command specific error handler
well , just add `else : raise error` to it and you'll start getting the errors \:)
wat is a modmail
Ok
ww
uh
i do that if i accidently type w to hide it
ohh, where do i add else : raise error
in the @trail vapor.error function
Rip
A name 💀
It's also open source
¯_(ツ)_/¯
xd
Doesn't matter
Dude stop it
its just a joke chill
it was offending
no offecne
beautiful
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: '>' not supported between instances of 'str' and 'int'
Ignoring exception
saying that doesn't really fix everything yk
typehint amount to int
convert int1 to an integer by typehinting
Okk..
*she kinda forgave me tho
bai bai, take care
im doing both
Just saying for the future. Not everyone is like Ashley ¯_(ツ)_/¯ (also who knows the truth)
yes it does- its only for mods to use kick and ban command as well as mod commands.
i have offline classes so i cant be you.
Study Boring
lmaooooooo
thats torture
I just came from those, like 30 min ago lmao
i do it rarely
Actually they are fun
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
thank me later
yea yea
whats a hemlock
idk
He's a mod...
ohh
oh
it’s from apex legends
what
!ot
^
who even listens to me after all ¯_(ツ)_/¯
da fuck
after which line in the function?
there's a reason I stopped using that command
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
because hunter too uwu for this shit
Cz no one really cared about it
Dan Dan, can you send the hapi emoji pls
welp
sure
Don't... just forget about it
can i do such that only admin and role abc can run a command
@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including caps and spelling.
If an integer is specified, you must give the exact snowflake ID of the role.
If the message is invoked in a private message context then the check will return `False`.
This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
!d discord.ext.commands.bot_has_any_role
@discord.ext.commands.bot_has_any_role(*items)```
Similar to [`has_any_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_any_role "discord.ext.commands.has_any_role") except checks if the bot itself has any of the roles listed.
This check raises one of two special exceptions, [`BotMissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BotMissingAnyRole "discord.ext.commands.BotMissingAnyRole") if the bot is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`BotMissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BotMissingAnyRole "discord.ext.commands.BotMissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic checkfailure
has_role*
ahhh i give mutiple roles
use has any role
because it cna take in X number of arguments as args
!d discord.ext.commands.has_any_role
@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.
Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.
This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
@commands.has_permissions(administrator=True)
or
@commands.has_role('abc')
can i do like this
either is fine
i wanna do like admin can use this command or if the guy has this specific role...i dont know if the server has admin role available
administrator is a permission
but i can also be a role right ?
@commands.has_role('admin') does that work if there is no role named admin
no
so how can i do like the user has admin permission or has abc role
the check will fail if there is no admin role
@commands.has_permissions(administrator=True)
@commands.has_role('abc')
you can also put the ID of roles in has_role
ok how does this work....requires both or requires either one of the two
has permissions checks the permissions of the channel the command is being executed in
has role checks to see if the user has that role
thats means user needs both admin permission and the role abc right ?
ye
how can do i do either or
!d discord.ext.commands.check_any
@discord.ext.commands.check_any(*checks)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if any of the checks passed will pass, i.e. using logical OR.
If all checks fail then [`CheckAnyFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckAnyFailure "discord.ext.commands.CheckAnyFailure") is raised to signal the failure. It inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Note
The `predicate` attribute for this function **is** a coroutine.
New in version 1.3.
Since not every guild will have the abc role
use this to check any of case
Forgot about that
kk so i can pass a function in it and in that function my either or statement
@check_any(has_role(), has_permissions())
Arey you watching some tutorial?
Ah
that's maybe the reason
yeah a lot has changed
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
is there any good module for translating text into languages? Like any language that is detected the message is in it will translate to english
so on_message is outdated ?
hey guys, i am thinking of making an ai chatbot but i am concerned whether should i use the on_message event for it or something else(sorry for bad english)
Before anything make sure you read this https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1
Nope
so why don't it work ? (my english is bad lmao)
you should search it up on google
please show more of your code
ok wait
anyone?
And i don't see print(message.content) there
yea that's how a chatbot would work , or you can use application commands to make the bot reply to messages
just some modification (already tried to print message.content and it doesn't print anything)
wild card import oh no
So does it not respond when you write ok?
nop
@check_any(has_role("abc"), has_permissions(administrator=True)
this says either i am admin or i have abc role ?
remember to do
if message.author.bot:
return
That's weird , lemme think what can be the possible issue
so do you think on_message would be good for a chatbot, because i am thinking of implementing over a thousand responses in it, maybe it might weaken the speed, what do you think?
like this ?
also, to process commands you need await client.process_commands(message) underneath (given you don't want to put @bot.listen()
if message.author.bot:
return
The order of these matters
Well I'm not experienced with any such thing , also about the on_message events that's how commands in discord.py work too so i don't think it would affect it ( you may talk to a guy named hunter here , he's good with chatbots )
thank you very much for your help, i'd love to ask hunter about it
tysm :)
change the order
of course
thanks
If you're manually adding responses it's not an AI
you could use some machine learning
can be easily done with a db in the backend...
yes sir im thinking of using a db as well
that's your most efficient option
but for replies & message content fetching, i can't decide whether should i use on_message or other function
what other function would you use?
that's the problem i can't think of any, other than the on_message
but i am concerned with the speed
there aren't any others
Then learn something in the c family
that I know, at least

If you're looking for speed, python is not what you're looking for
i know that sir, but currently python is the only language i know and i am more concerned about the load other than the speed itself
imagine running a bot on only one function
if you want a faster language learn like rust or cpp
if you use node it will be faster and lighter. And that's not something too hard to learn
on_message is fine, you do realize the most popular bots use this event while being in thousands of servers?
^
it wouldn't exist if it couldn't handle that
yup, and you bet your ass leveling is more called than commands
^
so sir should i use the on_message event for my bot, that's the only answer i am looking for and yes if it's capable of handling most of the part then i am good with it
depends on what your bot should do... an AI is pretty vague
whenever word X/sentence that looks like Y is said, respond, that's on_message stuff, yes
yeah that could be a problem
alright thank you very much sir, i think you're right i should go with on_message event, have a very good day!
and all other people who helped as well
have a very very good day!
👍
why this error shown?:
TypeError: string indices must be integers
yes
Then u can't do result["wallet"]
Since it's the same as doing "Some String"["wallet"]
that code i try to acces current and add more
that why u see 2 output printed
Try doing int(result) then
well wait
if i get the db it will give {'_id': 838640428060246046, 'bank': 0, 'wallet': 1204}
i only want the 1204 as int
yes on the shortcode
???
👀
help
how to make the bot put reactions to all messages in a separate text channel
if message.channel.id == <your_stinky_id>:
Currently, which is the best library to make Discord bots?
id use nextcord or disnake
But there are other libs like Hikari and Pincer that are in alpha
They have tons more features
Are all of them derivatives of discord.py?
Thanks for the info!
np
def checkfor(ctx):
allow = False
for i in ctx.author.roles:
try:
i = i.lower()
except:
pass
if "support" == i:
allow = True
if ctx.author.guild_permissions.administrator or allow:
return True
return False
@bot.command(name='test')
async def hahaha(ctx):
if checkfor(ctx):
await ctx.send("yeahhhh")
any fault ?
just use a custom check
whats that
def checkfor(ctx):
allow = False
for i in ctx.author.roles:
try:
i = i.lower()
except:
pass
if "support" == i:
allow = True
if ctx.author.guild_permissions.administrator or allow:
return True
return False
@commands.check(checkfor)
@bot.command(name='test')
async def hahaha(ctx):
await ctx.send("yeahhhh")
like this ?
i.lower() would make perfect sense won't it
yeah i did that ..i added try incase any role has a number in it
you are calling lower() on the role object, not the name.
If you want it to make the name lowercase, do
for i in ctx.author.roles:
var = i.name.lower()
Shouldn't the check decorator be under the command decorator?
Or does it not matter
how can I compare the emoji of a reaction to a custom emoji of a server?
hmm...i printed i variable and it gave me role names
self.bot.members
oh, thanks
^
send the code for that
it's not from what I know, but they probably made a bot variable for it
there's bot.users though
anyone know how to loa jishaku in disnake
!pypi disnake-jishaku
if i want to check when a message is deleted, should i use on_message_delete or on_raw_message_delete
Depends what you're looking for
Check the docs
imagine using jishaku
disnake-debug hmmmm
Imagine Imagining
Can i Voice channel get an other id. When something is changed?
what are you trying to do?
on_voice_change ? or something
Sometimes my bot won't do his command. I dont know why
How to make a discord bot send a specific image on command?
so we are trying to use a ship command for our fun configs but, we can restart the bot and the command only works once
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 542, in transform we keep getting errors like this
Scroll a little bit up
?
!d discord.File
class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.
Note
File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
.send() takes a file kwarg
use a discord.File object there . with the path to the file
Python
ill choose to learn code first 🙋♂️
in which language
You don’t learn how to code without learning a coding/programming language
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
for py
Unreal engine
yep
i think unite is better yea?
oh
i know small codes in python and javascript
in python using pygamei created 2 games like ping pong and snake game
and i create 2 type of calculator
I just like how there are talks about every topic here except python discord bots
and in javascript i create discord bot, which can mute member, kick and ban member, embeds
oh sorry
It do tend to be that way. Learn the ways of this channel.
Not talking about u
wrong chat
where is general
I still took it personal. I hate you Hunter <\3
i cant find it
@slate swan mind helping me 👀
He gonna make you uwu me

Ik its annoying sigh
What's most used method for creating Discord reminders
After restarting the bot, it resets those events.. right?
well then you must join us uwuing hunter
what kind of events?
Okay I think I will just go play some games
User created reminders example: .remind 25/1/2022 blabla
how to add multiple lines in 1 string like
await ctx.send("...
...")
stay , or prove that you're uwu
ah , well you can just convert the time user provides to a datetime , and save it in a database
and then use a task.loop which runs each day
None
if the datetime is same as current datetime , send the message
@commands.Cog.listener()
async def on_guild_channel_update(self, before, after):
async with aiohttp.ClientSession() as session:
async with self.db.execute(
f"SELECT webhook, guild_id from 'logging' where guild_id = {before.guild.id}",
) as cursor:
config = await cursor.fetchone()
if config is not None:
webhook = Webhook.from_url(config[0], adapter=AsyncWebhookAdapter(session))
if before.guild.id == int(config[1]):
async for entry in before.guild.audit_logs(action=discord.AuditLogAction.channel_update,
oldest_first=False):
embed = discord.Embed(
description=f'Channel was updated ({after.mention})',
color=discord.Color.dark_theme()
)
embed.set_author(name=entry.user, icon_url=entry.user.avatar_url)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text=f'{self.bot.user}', icon_url=self.bot.user.avatar_url)
embed.add_field(name='Creation date', value=f'<t:{round(before.created_at.timestamp())}:D>',
inline=False)
if before.overwrites != after.overwrites:
if before.overwrites > after.overwrites:
before_overwrites = [i for i in before.overwrites]
after_overwrites = [i for i in after.overwrites]
for after_overwrites in after_overwrites:
if not after_overwrites in before_overwrites:
new_overwrites = after_overwrites
embed.add_field(
name="overwrites",
value=f"+ {new_overwrites}",
inline=True
)
else:
before_overwrites = [i for i in before.overwrites]
after_overwrites = [i for i in after.overwrites]
for before_overwrites in before_overwrites:
if not before_overwrites in after_overwrites:
new_overwrites = before_overwrites
embed.add_field(
name="overwrites",
value=f"- {new_overwrites}",
inline=True
)
await webhook.send(embed=embed)```does anyone know why the field is not added, although I add a permission to a channel
!pypi time-str
thought of using some sort of sched python pagage
use \n
to change lines
amazing aint it
But how do I make code execute it precisely on time? @tasks.loop(seconds=1) xd
you can compare datetime objects
and see if the difference between those datetime is not more than 1
hm
Hello, I'm not able to import discord.ui
Solutions?
!discord.ui
!pypi discord.ui
you cant import discord.ui
thats not how imports in python work
thanks but just gonna triplequote
a docstring as a multiline string ,sure
your discord.py version?
lemme check
you used the commands in dms
discord_ui, not discord.ui
thats not gonna work
use discord_components?
thats a library , they are trying to use discord.py 2.o
never
y?
That's the lib they showed?
oh wait , what's id there?
I'm lost again, lol
discord==1.0.1
discord-components==2.1.2
discord-py-slash-command==3.0.3
discord-ui==5.1.6
discord.py==1.7.2
!d discord.ui.Button , they just used a random command
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
cursed combos
you need to use the master branch of dpy
oooh, make sense
the id is either wrong , or you used string form of the id?
why dont u just ctx.guild?
and you have a guild argument already there? , just provide the id while using the command
the beta version of discord.py
but just use a fork tbh they have slash commands , button etc included
id is a function name in python! dont use it as a variable
I think he meant like "id" is a function and you should change the "id" to a var
because from his sentence i think he meant like you are using the "id" function of original python
i think you need to make like guild.id or sum
@commands.Cog.listener()
async def on_guild_channel_update(self, before, after):
async with aiohttp.ClientSession() as session:
async with self.db.execute(
f"SELECT webhook, guild_id from 'logging' where guild_id = {before.guild.id}",
) as cursor:
config = await cursor.fetchone()
if config is not None:
webhook = Webhook.from_url(config[0], adapter=AsyncWebhookAdapter(session))
if before.guild.id == int(config[1]):
async for entry in before.guild.audit_logs(action=discord.AuditLogAction.channel_update,
oldest_first=False):
embed = discord.Embed(
description=f'Channel was updated ({after.mention})',
color=discord.Color.dark_theme()
)
embed.set_author(name=entry.user, icon_url=entry.user.avatar_url)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text=f'{self.bot.user}', icon_url=self.bot.user.avatar_url)
embed.add_field(name='Creation date', value=f'<t:{round(before.created_at.timestamp())}:D>',
inline=False)
if before.overwrites != after.overwrites:
if before.overwrites > after.overwrites:
before_overwrites = [i for i in before.overwrites]
after_overwrites = [i for i in after.overwrites]
for after_overwrites in after_overwrites:
if not after_overwrites in before_overwrites:
new_overwrites = after_overwrites
embed.add_field(
name="overwrites",
value=f"+ {new_overwrites}",
inline=True
)
else:
before_overwrites = [i for i in before.overwrites]
after_overwrites = [i for i in after.overwrites]
for before_overwrites in before_overwrites:
if not before_overwrites in after_overwrites:
new_overwrites = before_overwrites
embed.add_field(
name="overwrites",
value=f"- {new_overwrites}",
inline=True
)
await webhook.send(embed=embed)```does anyone know why the field is not added, although I add a permission to a channel
No problem haha
No
The guild works like It checks
In what servers the bot is and then makes the move like if you want to get a guild id from a server you are in but the bot is not in it won't work
😉
What's best slash command handler for discord.py?
Disnake
😆
use disnake and disnake-debug while you're at it 
what are the advantages of disnake over nextcord?
everything.
you get access to disnake-debug and disnake-jishaku
better maintainers, collaborators and docs
okay
how did I start making a discord bot and my token's getting glitched
just how
oh well I found it and we ain't gonna talk about it
Talk about it
no
well yes I will
it was cuz of the new looking dev portal
it confused me
probably a user bot, dev portal is still the same
any pycord users here?
whats the issue?
no issue; just here cause im bored
oof
is there a way to check for users in the voice channel the bot is in? (so if the bot is the last person in a voice channel)
Ew pycord
are you a nextcord user?
No
ic
lets not start again
yeah
Even Danny has said he doesn't like pycord
i think its alright, i mean, its hardly any different from the discord.py 2.0.0 beta
it just adds slash commands and a few other things
That's the only part that' sucks.
btw how different is hikari from discord.py?
how to get in a json file like this a thing that just prints the messages but not the ids
{"695229645021015040": {"messages": 17639}, "618741491932266506": {"messages": 318}, "884492383923339295": {"messages": 1334}
"a link to your privacy policy"


well , am gonna study now