#discord-bots
1 messages Β· Page 797 of 1
Nah its easy
await self.bot.wait_until_ready() at the top
But yeah whenever you get that NoneType error it usually means that it couldn't find the channel object for whatever reason
why?
On a more technical note, it's possible cache is not fully populated when you perform the query, so waiting until ready should fix that
if they save the id as a string in the json , get_member wont ever get the channel
Yeah, that's why you need to 100% be sure it's an integer
That will not run any code until the bot's cache is fully populated with all the stuff
oh lemme see
when discord.py doesn't actually dispatch on_ready when receiving READY
ποΈ ποΈ
Traceback (most recent call last):
File "c:\Users\e\riot bot #4, the bruh.py", line 45, in <module>
@commands.has_permissions(manage_members=True)
File "C:\Users\e\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 1779, in has_permissions
raise TypeError('Invalid permission(s): %s' % (', '.join(invalid)))
TypeError: Invalid permission(s): manage_members
and here comes andy π
that's for dpy 2.0 ( by that i mean manage_members permission)
you lost me at dpy im so sorry
Don't think that should be a problem Β―_(γ)_/Β―
(bot is boring)
No, I thought it was a botvar at first
You're not the first, someone else thought the same haha
imagine
mhm
Me who named his bot object HunAI π€£
I name mine conventionally
different breed
ποΈ ποΈ
how do i fix issue
Well I've gotta head out now, and looks like all the smarties are here so you should be alright spooky :)
Okimii??
No
how tf
install the master branch from git
thanks ah lot
i name mine ||andy_is_a_qt|| π
π©
@dry kelp mind verifying the ID?
Don't. Start. This. With. Andy. Now.
fine ughπ π
which
π
if i open it up from the root is going to be a empty dic
but there's stuff
Huh?
imma run the bot from vsc so i can show ya
oh, even discord.py 2.0 does not have the perms
Okay...
i have that in alr, do i need to import something?
shit
Yea
yea is weird i should rr my root but im lazy
Haha okay...
you cant do that without using a fork
or, make your own timeout method
which makes a request to the API
use some other perm simply
Just use the manage roles perms smh
I have made my own API Wrapper too...
Was a total pain ngl
if i run it from the pc the command wont run
just copy the source of some dpy fork with timeout and use it
weird lemme see
good idea
it will send the owner error for some reasons
ok so onw
it says the message, but doesnt add the role
bruh
ποΈ Lets see the codebase
πΌ
that summoned Andy real quick lmao
am i doing this right????
Cuz it couldn't find the key
await
i don't think its a kwarg...?
it's a pos arg right?
await member.add_roles?
ima be real infernum
yea. but u need to await the member.add_roles
Because I'm absolutely downbad rn for application command implementations, I need a good inspiration
Yes
whatever weird
i dont know wha tha means
@maiden fable if i run it from the root
it works like this
no key errors
but it will load the channel id
Haha, fair enough
and for unmute its remove_roles instead of add_roles
it's not for "unmuting" But yeah removes roles
alr
you can just do something Andy suggested if you want to remove all roles, Member.edit(roles=[])
Role based mutes are very much useless now, ever since the timeout feature was added
Andy is dum
How!
well, they're still useful for perm mutes 
^^
Timeout can only go up to 28 days
Permissions or permanent?
permanent
Ah yes permission mutes
i dont get why the method is named remove/add_roles when it takes a single snowflake
you can pass multiple
^
but there is wtf
how?
member.add_roles(role, role2, role3)
i see
member.add_roles(*args)
It cant get the channel in the bot's cache
Sure, but you could just pass a stupidly high ISO8601 timestamp
show code
bro the mute role isnt working
Not to mention timeouts are persistent, meaning no database would be required anymore
no, it only allows up to 28 days
why
Error?
What are you trying to do
Oh do they mention that in the docs
yes
Ok that's good to know
the role itself
remove the muted role
The error bro
the mute command works
the stupid role itself dont work
Json, ew
@commands.Cog.listener()
async def on_guild_channel_create(self, channel):
async for i in channel.guild.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.channel_create):
with open(whitelist_path, "r") as f:
whitelisted = json.load(f)
if str(i.user.id) in whitelisted[str(channel.guild.id)]:
return
await channel.guild.ban(i.user, reason="Anti-Nuke: Creating Channels")
await i.target.delete(reason=f"Anti-Nuke: Deleting user created channels")
with open(channel_path, "r") as f:
config_channel = json.load(f)
channel_config = config_channel[str(channel.guild.id)]
try:
channel_id = channel_config[0]
except:
pass
if not str(channel.guild.id) in config_channel:
return
log_channel = self.angel.get_channel(channel_id)
embed = discord.Embed(title=" Anti-Nuke ", description=f"**CHANNEL LOGS**\n\nMember: {i.user}\nMember ID: {i.user.id}\n\nMember created a channel!\n\nMember has been **banned** out of the guild!\nChannel has been **deleted**!")
await log_channel.send(embed=embed)
dude i am converting all this shit just look
I was looking at the member object's attribute, they don't show the 28 days there
π
You are not
log_channel = self.angel.get_channel(int(channel_id))
oh aii
Uhhh, imma pass
Do it bro
Was it from scratch or
πΌ
More of a timepass project and yea, from scratch
Andy's urge to shit on other dapi wrapper libs
π reasons I ain't sharing the codebase
Iβm not shitting on! I just want to see how others plan to do things
its crazy
You sure? π
just do it, whenever he says something send an image of rin tohsaka
Yes Iβm lost on how I should do application commands, I could write a fast implementation but it would be bulky as hell
Iβve seen some implementations but they are all the same
And end up being huge in implementing
guys discord.py presence using application ID is working on phone but it shows 19k days on pc
why
that's a long time
must be quite an addiction 
shit.
Oh Dutchy here π
No 
Yes π
ur hallucinating
Wait what
Totally not

its true
Wait, how did u manage to give yourself custom presence with images with discord.py? π
implementing presence in app
Why not use pypresence or smth
You can say its a work around for pypresence
just because why not \π
isnt today her bdayπ³
πΌ yes
but any idea why is it showing a lot of days
im cultured

what can i say
Touch grass + L
Nova look at the new example I added today
It's super cool!
Ok π¦
Just use MultiRPC for custom game status 
Shows the same on mobile for me
How will u be able to tho?
Oh wait it shows 15 hours on mobile
I don't know I haven't read the docs yet
Woah! 5 members joined all in 1 second.
let's ban them all
Want a suggestion?
Ok but besides that it's great for anti raids or whatever
Sure
I also flexed the concurrent ratelimiter with gather
You will get a stroke reading through pypresence's source code, so u better not see that
Also, sadly, discord says they have added support for different activity types, but as usual, the API is bugged Β―_(γ)_/Β―
πΌ yeah saw
πΌ Me and the boys rocking concurrent requests
Semaphores are on a tight rope though, buggy as hell with gateway/bot
how i can connect to proxy with socket module
what's the best way to grab a random image of a specific type from the web?
@commands.Cog.listener()
async def on_guild_update(self, before, after):
async for i in before.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.guild_update):
with open(whitelist_path, "r") as f:
whitelisted = json.load(f)
if str(i.user.id) in whitelisted[str(i.guild.id)]:
return
if before.icon == None and after.icon:
await after.ban(i.user, reason="Anti-Nuke: Changing Guild Icon")
await after.edit(icon=None)
try:
before_icon = await before.icon.read()
except:
pass
if before.icon:
if before.icon != after.icon:
await after.ban(i.user, reason="Anti-Nuke: Changing Guild Icon")
try:
await after.edit(icon=before_icon)
except:
pass
else:
return
with open(channel_path, "r") as f:
config_channel = json.load(f)
channel_config = config_channel[str(before.guild.id)]
try:
channel_id = channel_config[0]
except:
pass
if not str(before.guild.id) in config_channel:
return
log_channel = self.angel.get_channel(int(channel_id))
if before.icon == None and after.icon:
embed = discord.Embed(title=" Anti-Nuke ", description=f"**ICON LOGS**\n\n**__MEMBER__**\n\nMember: `{i.user}`\nMember ID: `{i.user.id}`\n\n**__ABOUT__**\n\nNon-Trusted member uploaded a guild icon!\n\n**__ACTIONS__**\n\n Non-Trusted member has been banned out of the server!\n Icon has been set back to none!")
await log_channel.send(embed=embed)
if before.icon != after.icon:
embed = discord.Embed(title=" Anti-Nuke ", description=f"**ICON LOGS**\n\n**__MEMBER__**\n\nMember: `{i.user}`\nMember ID: `{i.user.id}`\n\n**__ABOUT__**\n\nNon-Trusted member uploaded a guild icon!\n\n**__ACTIONS__**\n\n Non-Trusted member has been banned out of the server!\n Icon has been replaced!")
await log_channel.send(embed=embed)
why are the logs not sending here?

@grim oar @maiden fable
found the error
is it possible to make video bot that generates and streams video to discord? wondering if it makes sense at all/possible at all
Not possible
Discord doesn't allow bots to stream video
but i can stream music?
so the closest is i can keep posting mp4?
Yes but that would get you ratelimited
Better to just host the stream on a webserver and send a url
50 requests/second
It's 5messages per 5 seconds
does that connect into discord? or will it bring people out of discord?
Out of discord yes
this is across all bots or just the bot on one server?
Per bot
You could also try one of those integrations like YouTube together, but I'm not at all sure of how they work
maybe the rate limit was updated? All bots can make up to 50 requests per second to our API.
maybe the rate limit is bigger now?
they even let people go beyond 50 requests per second https://discord.com/developers/docs/topics/rate-limits#global-rate-limit
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Can someone pls help me with this problem? Its picking up amount and guess as the same thing?
@commands.command()
async def guess(self, ctx, amount:int, guess:int):
"""Guess a number 1-10
guess: The number to guess.
E.g:
mother guess 100 2
command is:
guess <bet> <guess>
"""
user = ctx.message.author
bal = await update_bank(ctx.author)
try:
if bal[0] < amount:
await ctx.send(":red_circle: **{}, you can't bet more than you have!**".format(user.name))
return
if amount < 0:
await ctx.send(":red_circle: **Must be greater than `0`!**")
return
if guess == 0:
await ctx.send("Pls input a guess! <3")
return
if guess < 10:
await ctx.send(":red_circle: **{}, you can't guess more than 10!!!**".format(user.name))
return
final = []
for i in range(1):
b = random.choice(["1","2","3","4","5","6","7","8","9","10"])
final.append(b)
await ctx.send(b)
if final == guess:
await ctx.send("**{}, you won ${} coins!**".format(user.mention, amount))
await update_bank(ctx.author, 1*amount)
else:
await ctx.send("**{}, you lost ${} coins!**".format(user.mention, amount))
await update_bank(ctx.author, -1*amount)
except:
await ctx.send("Didnt work")
Try sending 6 messages consecutively, you'll notice a delay after the 5th
hello i need help i want the input to be with speech recognition how to i implement it in the code?
try:
bot_input = input("You:")
bot_response = get_response(bot_input)
talk({bot_response})
print(f'Gideon: {bot_response}')
except (KeyboardInterrupt, EOFError, SystemExit):
break;```
the bot is meant to be used in a lot of different servers though, as long as its not global rate limit its ok
Not global, it's probably per channel
ok
Speech recognition from what, a discord voicechannel?
is it possible for a bot to join a voice chat and listen to what people are saying?
so technically the bot could join the voice chat, while people stream from some private youtube url video?
so it would be a simulation of the video bot
@commands.Cog.listener()
async def on_guild_update(self, before, after):
async for i in before.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.guild_update):
with open(whitelist_path, "r") as f:
whitelisted = json.load(f)
if str(i.user.id) in whitelisted[str(i.guild.id)]:
return
if before.icon == None and after.icon:
await after.ban(i.user, reason="Anti-Nuke: Changing Guild Icon")
await after.edit(icon=None)
try:
before_icon = await before.icon.read()
except:
pass
if before.icon:
if before.icon != after.icon:
await after.ban(i.user, reason="Anti-Nuke: Changing Guild Icon")
try:
await after.edit(icon=before_icon)
except:
pass
else:
return
with open(channel_path, "r") as f:
config_channel = json.load(f)
channel_config = config_channel[str(before.id)]
try:
channel_id = channel_config[0]
except:
pass
if not str(before.id) in config_channel:
return
log_channel = self.angel.get_channel(int(channel_id))
if before.icon == None and after.icon:
embed = discord.Embed(title=" Anti-Nuke ", description=f"**ICON LOGS**\n\n**__MEMBER__**\n\nMember: `{i.user}`\nMember ID: `{i.user.id}`\n\n**__ABOUT__**\n\nNon-Trusted member uploaded a guild icon!\n\n**__ACTIONS__**\n\n Non-Trusted member has been banned out of the server!\n Icon has been set back to none!")
await log_channel.send(embed=embed)
if before.icon != after.icon:
embed = discord.Embed(title=" Anti-Nuke ", description=f"**ICON LOGS**\n\n**__MEMBER__**\n\nMember: `{i.user}`\nMember ID: `{i.user.id}`\n\n**__ABOUT__**\n\nNon-Trusted member uploaded a guild icon!\n\n**__ACTIONS__**\n\n Non-Trusted member has been banned out of the server!\n Icon has been replaced!")
await log_channel.send(embed=embed)
why is this not sending to the log channel?
Yes it could, but I don't understand what you're trying to do
You want the bot to stream video right?
make a bot that listens to people and streams realtime video based on what they say
I see, that's interesting
not a serious thing i'm just seeing what discord supports
You could definitely do the first part
i see people stream all sorts of stuff on discord video chat
nvm then, it just doesn't make sense to simulate a video bot
someone would have to open the private youtube url, then stream their pc
too much of a hassle to make sense
i dont think video with bots really works because it typically is through a screencapture and most bots are hosted on servers that dont necessarily have screens
i meant it would just generate video as a realtime stream from the server as data, just like all those 24/7 youtube radio channels i guess (idk how youtube stream servers work but my guess is they just stream data 24/7 from servers)
log_channel = get(self.client.get_all_channels(), guild__name="Testing Server", name = "testing-area")
I use this when collecting channels but it also could be you put an int in the get_channel command
my goal was to emulate the 24/7 youtube radio stream, but as an interactive experience from discord, but it looks like it won't really work
ah
interactive/personalized video stream experience
probably not possible
Can someone pls help figure out why its picking up guess as amount?
@commands.command()
async def guess(self, ctx, amount:int, guess:int):
"""Guess a number 1-10
guess: The number to guess.
E.g:
mother guess 100 2
command is:
guess <bet> <guess>
"""
user = ctx.message.author
bal = await update_bank(ctx.author)
try:
if bal[0] < amount:
await ctx.send(":red_circle: **{}, you can't bet more than you have!**".format(user.name))
return
if amount < 0:
await ctx.send(":red_circle: **Must be greater than `0`!**")
return
if guess == 0:
await ctx.send("Pls input a guess! <3")
return
if guess < 10:
await ctx.send(":red_circle: **{}, you can't guess more than 10!!!**".format(user.name))
return
This is the only part of the code affected
The guess == 0 is redundant. Your guess arg has to be satisfied. The if statement following that is also incorrect, reverse the operator. As for the rest, the code seems fine.
It shouldn't be swapping amount and guess
So how would i make sure that the person doesnt guess more than a certain number?
Use the < > operators accordingly
ahh ok
if AFK_PPL in message.content:
TypeError: 'in <string>' requires string as left operand, not list
huh?
AFK_PPL is a list.
if guess < 10:
await ctx.send(":red_circle: **{}, you can't guess more than 10!!!**".format(user.name))
return
if guess > 0:
await ctx.send("Pls input a guess")
return
like this?
i have the googleapiclient installed but its giving this error
Did you restart the program?
after you installed it?
i did not. forgot to do that
just making sure
looks like that fixed it
Lmao
thats caught me once before and i forgot about it
Ive done the same thing many times when i first started
anyone know why the bot isnt replying to any commands??? no errors btw.
do you have an on_message event?
yes
tysm
youre trying to load a cog that doesnt have a setup function
the cog ;-;
yea ik
then add one
so i closed it in the explorer forgot to recycle the blank files
ik i added blank cogs oops
not explorer i mean editor
no comments
im stupid
I saw, no need to tell
haha
Can someone pls help me hide a cog file?
i use the
class hello(commands.Cog,command_attrs=dict(hidden=True)):
but it didnt work?
cogs require a setup function
def setup(client): client.add_cog(class_name(client))
ik i accidently added a file in the cogs folder closed it in the editor but didnt actually delete it in the folder
client π‘
whom do you wanna hide it from?
cof cof
help command
oooof
indeed
This is now becoming an issue of not understanding the fundamentals of Python. You need to take a step back and learn the basics (!resources in #bot-commands)
oh, I see, why not use the remove help command func?
no i fixed it sorry
Glad to hear it, but you should still learn the basics
they don't want the cog to display in the help command i guess
only a single cog
def setup(bot):
bot.remove_command('help')
bot.add_cog(uwu(bot))
this wont work?
that removes the default help command
that will remove the whole help command altogether no?
thats what I'm asking
sure?
Yes
it will, and that's not what they want
hm, I see
they only wanna hide a single cog
i understood this well because I also didn't know how to do that earlier lol
well i still don't
i see
hide a single cog from displaying in the help command
in your help command just have a list of blacklisted cogs and check if the message they send is in the blacklisted
caeden and his help commands
let me link to my help command
no i think u didn't understand
wait
cogs/helpcommand.py line 102
if cog.qualified_name not in self.data:```
what is this bot feature's called?
This is when I do a.help in my help command and I wanna hide the Misc cog from displaying there (and it's commands)
i see thank you!
oh lemme look
select dropdowns
okk
With the blacklist the only blacklists i use are generally banned words at the moment, So if i put names of cogs into a list right would that work at all?
if so how would i have the code skip over such cog?
it didnt edit my nick?
- Check if the bot has the permissions to do so. The bot can't edit nicknames of those that have a higher role than itself.
- Check if user_name is a string
- Confirm that you're using the command in the server, and not the bot's DMs
Other than that, it'd be great if you could mention any errors you get on using the command
@client.event
async def on_slash_command_error(interaction, error):
if isinstance(error, commands.MissingPermissions):
embed=disnake.Embed(color=0xb30000, title="Error", description="You do not have the permission to use this command.")
await interaction.send(embed=embed)
does isinstance have to be in a event or can i put it into a command?
Do u have multiple Python versions?
.
U have multiple of those
no i fixed
3.10 and 3.9
Now install again and select that version in yr IDE
Yea
send it in on_command_error
i will suggest you to downland it from the website
im too on windows 11, i use the one i downland from the site
i have 3.9 isnt that fine?
as u like
ok i had that one installed
but it still doesnt let me have it
it was nextcord.py 0_0
Download the vsc python extension, it allows you to choose your python interpreter
watch some videos on youtube, that will help
And then Choose the interpreter with nextcord installed
await kick(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.kick "discord.Guild.kick").
Disnake has the same method
yeah im using slash one then i have to use inter right?
Are you adding a member option for the slash command?
yes
how to make it so that if the bot doesnt have the permissions to do a command, it sends a message
so just , member_option.kick()
Error handler
on_command_error/on_error event
Eh
!d discord.ext.commands.BotMissingPermissions
exception discord.ext.commands.BotMissingPermissions(missing_permissions, *args)```
Exception raised when the botβs member lacks permissions to run a command.
This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
hey i migrated to nextcord but i cant find how to make buttons
m
m?
If you're going to choose a new library, go for hikari, and if you want a fork of dpy, use disnake
Or use edpy 
question r u dutch?
cause i am

The issue is, is that the slash command doesnt send a error in console when it doesnt have perms to ban someone
so that doesnt work
Really? Lol
Well you can anyway handle that exception cuz it will rise anyway, in the handler you can print the error so you will know what goes wrong with the command
how to do that
The error is going to be printed in the console anyway, if the command doesn't work
ok
The issue would be that the slash command would show an "Interaction failed" error of some sort
If you want the user to see "Could not kick/ban user...", the simplest way to get that would be to wrap everything in a try-except block - with that statement being shown if it fails
async def ban(inter, member: disnake.Member):
try:
...
except Exception as e:
await inter.response.send("I can't do that lol")
print(e)```
Hey guys I'm working on a bot for a MMO clan and one of the features my clan needs is for it to be able to track prices of market transactions internal to the clan where you could input how much you bought/sold something and then it can be checked later by other members. I wonder how to approach this, I'm thinking perhaps a Dictionary will work here where each category materials/full items/etc will be a dictionary and each item within it another dictionary where every sale can be added together with the date as a list and then easily checked. Is this a good approach? I wonder how to tackle this best.
A try-except block is quite literally what the name states - it tries the first part of the block (under 'try') and runs the 'except' part if it fails.
@commands.has_permissions(kick_members=True)
@client.slash_command(description="Kicks a user")
async def kick(ctx, user: disnake.Member=None, reason="The reason was not entered"):
try:
if user is None:
embed=disnake.Embed(color=0xb30000, title="Member not found", description="Please enter the user you want to kick.")
await ctx.send(embed=embed)
elif user == ctx.author:
embed=disnake.Embed(color=0xb30000, title="Error", description="You cannot kick yourself.")
await ctx.send(embed=embed)
elif user.guild_permissions.administrator:
embed=disnake.Embed(color=0xb30000, title="Error", description="You cannot kick a admin.")
await ctx.send(embed=embed)
else:
await user.send(f"You have been kicked from {user.guild.name} for **{reason}** by {ctx.author.mention}")
await user.kick(reason=reason)
embed=disnake.Embed(color=0x00d60e, title=f"Successfully kicked {user}", description=f"Kicked {user.name} for **{reason}** by {ctx.author.mention}")
await ctx.send(embed=embed)
except Exception as e:
await ctx.send("I can't do that lol")
print(e)
i tried it and it didnt wor
@commands.has_permissions(administrator=True)
async def createticket(self, ctx, *args):
format_args = list(args)
guild_id = ctx.message.guild.id
channel_id = int(format_args[0].strip('<').strip('>').replace('#', ''))
title = ' '.join(format_args[1:])
with open('ticket.json', 'r') as file:
ticket_data = json.load(file)
new_ticket = str(guild_id)
# Update existing ticket
if new_ticket in ticket_data:
ticket_data[new_ticket] += [channel_id]
with open('ticket.json', 'w') as update_ticket_data:
json.dump(ticket_data, update_ticket_data, indent=4)
# Add new ticket
else:
ticket_data[new_ticket] = [channel_id]
with open('ticket.json', 'w') as new_ticket_data:
json.dump(ticket_data, new_ticket_data, indent=4)
# Create new embed with reaction
ticket_embed = discord.Embed(colour=randint(0, 0xffffff))
ticket_embed.set_thumbnail(
url=f'https://cdn.discordapp.com/icons/{guild_id}/{ctx.message.guild.icon}.png')
ticket_embed.add_field(name=f'Welcome To {ctx.message.guild} Server', value=f'{title}')
send_ticket_embed = await self.bot.get_channel(channel_id).send(embed=ticket_embed)
await send_ticket_embed.add_reaction(u'\U0001F3AB')
``` guild_id = ctx.message.guild.id
AttributeError: 'str' object has no attribute 'message'
The commands.has_permissions decorator comes after client.command
AttributeError: 'str' object has no attribute 'guild
Is this in a cog?
I assume not, since you're using client.command
you don't need self there
^
and do you even know what *arg does?

You could've easily made channel an arg and continued with *, title now that I look at the code
Why cant it send a embed?
Which embed are you referring to, from your code?
thx
oh wait, it doesnt work on some members
Probably because they have their DMs closed?
That would give a 403 error
Also, you can just do ctx.guild.icon.url for the guild's icon
Check the console then

Ah alr
[<Role id=937845206894669865 name='new role'>]
how do i get the role id from the list?
If you're getting it from the user's roles, it's a good idea to use utils.get
role = discord.utils.get(ctx.member.roles, id=role_id)
You have to run the kick method on member, not pass it as an agrument.
i.e., await member.kick(reason=None)
i gave it admin but still it's asking for permission
idk why but it doesnt send the welcome message when someone joined my server.
@bot.event
async def on_member_join(member):
guild = bot.get_guild(931454966781079553)
role = discord.utils.get(member.guild.roles, name="unverified")
await member.add_roles(role)
embed = discord.Embed(description=f"hey, {member.mention}! welcome to {guild.name}!", colour = 0)
embed.set_author(name=member.name, icon_url=member.avatar_url)
embed.set_footer(text="royale high trading | coded by mar.#9585")
await bot.get_channel(938291931367219291).send(content=None, embed=embed)```**no errors!**
sorry guys this is not related directly to bots but i have a lapsus and i'm going crazy:
n = [m.upper() for m in ms]
what is the name of this expression?
!list-comp
Do you ever find yourself writing something like this?
>>> squares = []
>>> for n in range(5):
... squares.append(n ** 2)
[0, 1, 4, 9, 16]
Using list comprehensions can make this both shorter and more readable. As a list comprehension, the same code would look like this:
>>> [n ** 2 for n in range(5)]
[0, 1, 4, 9, 16]
List comprehensions also get an if statement:
>>> [n ** 2 for n in range(5) if n % 2 == 0]
[0, 4, 16]
For more info, see this pythonforbeginners.com post.
thanks
List comprehension?
Do you have member intents?
In your command line, use pip install <module>
That's one way of doing it
forgot-
PoV: They write pip install <module>
:lolol: Well, they asked how to install /<module>
Hmm
Are you trying to make it kick another admin user?
Also , that content=None is not really required there
How do I randomly generate an embed from a defined list?
A list of embeds?
Ye
!d random.choice ?
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
use random.choice
i got it
Say for instance here
Alrighty
Say it is a command and not an event
So, I want to put multiple embeds
embed1
embed2
embed3 like that
So how should I modify the last line?
oh, multiple embeds together?
embeds=
and wrap that in a for loop if need be
Do you want all the random embeds to be different?
Abhi, go work on the guide π
okay thanks
Do it now
I needed a break lol
yes
different descriptions, titles, and so on
Go and touch grass
Do it faster so we can just link it to everyone when we suggest ppl to use disnake
Bruh
That's the aim yes 
Outside in the garden
Well then, I'll go write smth
Y'all link some stackoverflow answer for this
Yes.
!d discord.Member.ban
await ban(*, delete_message_days=1, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
!d discord.Guild.ban also exists BTW
await ban(user, *, reason=None, delete_message_days=1)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
!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...
@client.command()
@commands.has_permissions(administrator=True)
async def purge(ctx, amount: int):
if amount > 100:
amount = 100
await ctx.channel.purge(limit= amount + 1)
I want this code to show the error if the amount is not written
Like, when the number of messages is not written, the error shows in terminal
I want it to give message in chat instead
Tried using else: function
did not work as expected
sorry im noob lol
best way to check if a message is not from a dm in on_message ?
if message.guild : # the message is sent in a server```
it raises a commands.MissingRequiredArgument exception, use the on_command_error event to handle it
hmm
thanks
how do i use it in the code?
i tried seeing example on stack overflow but it shows that it was defined in async def on_command_error(error, commands.CommandNotFound)
Okay, we've made it to part 12! Be forewarned, this is going a long one. This part is going to be about how you can make error handlers for your commands, like you saw briefly in the previous part about cooldowns.
nooo, not like that
ah thanks
use member.edit(nick=None)
user.edit(nick=None) probaly
lol
we both edit at same time
should be a Member, not User
im talking about the variable's class, not the variable name
@commands.command(aliases=["b"])
@cooldown(1, 2, BucketType.user)
async def buy(self, ctx, item):
""" Buy an item from the market"""
member = ctx.author
bal = await ecomoney.find_one({"id": ctx.author.id})
if bal is None:
await self.open_account(ctx.author.id)
bal = await ecomoney.find_one({"id": ctx.author.id})
return
elif item == "sgiveaway":
sgive = 1000
ubal = bal["bank"]
role = discord.utils.get(ctx.guild.roles, 938709559462207518)
await ecomoney.update_one({"id": ctx.author.id}, {"$inc": {"bank": - sgive}})
for role in ctx.guild.roles:
await member.add_roles(role)
await ctx.send(f"You bought {item} for {sgive}$TPET!")
if ubal < sgive:
await ctx.send("Check your balance, I don't think you have enough. . .")
elif "sgiveaway" not in ctx.message.server.roles:
await ctx.send("That role doesn't exist.")
elif "sgiveaway" in ctx.message.author.roles:
await ctx.send("You already have that role, wanna waste more money on that eh?")
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/container/cogs/shop.py", line 135, in buy
await member.add_roles(role)
File "/home/container/.local/lib/python3.8/site-packages/discord/member.py", line 777, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
File "/home/container/.local/lib/python3.8/site-packages/discord/http.py", line 250, in request
raise NotFound(r, data)
discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role
in the utils.get,pass the id with the id= kwarg
ah
role = discord.utils.get(ctx.guild.roles, id=938709559462207518)
The role doesn't exist
did you double check
yes
hm
for role in ctx.guild.roles:
await member.add_roles(role)
``` this is the line from where the error comes right? it may be because the bot tries to add all the roles including the `everyone` role, and other integrated rples
what version of dpy are you on?
i believe its 1.7.3
since 2.0 has role.is_assignable() which may help
the latest-stable one
you would have to check that None of these are true for the role
well you loop thru all the roles in the server no
so should i just remove for role in ctx.guild.roles:?
you want to add a single role right?
yup
yea so there's no need of it
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
just define that role ( you already did ) , and member.add_roles(role)
why cant i use - btw in function name
nope. but if you are making a command you can use it inside the command name parameter
@command(name='it-has-dashes')
async def name_it_anything(...```
so guys i want to make my command to have cooldown and i know how to , but , when someone runs the command and it causes an error like not enough arguments or umm anything like BadArguments , and they can't use it untill the cooldown is over even they didn't used the command correctly before
yea it should work. but it needs member intents
hello ?
bot = commands.Bot( command_prefix= (prefix), intents=intents)
@slate swan how to get permmision of a member
!userinfo
mainly
wdym by major permissions
permissions
like manage_roles
kick
ban bla bla ..
!d discord.Member.guild_permissions
property guild_permissions: discord.permissions.Permissions```
Returns the memberβs guild permissions.
This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").
This does take into consideration guild ownership and the administrator implication.
k
@cog_ext.cog_slash(name = 'openevent', description = 'Open voice channel event', guild_ids = [933988798218506331])
@commands.has_any_role(938511801262420008)
async def _openevent(self, ctx: SlashContext, name = choice['monopoly', 'bunker', 'mafia']):
await ctx.send('test')
``` not working(
dont use 3rd party libraries, use some fork instead
I got a small problem, no idea whats causing it. the problem is that every command with an embed in the bot gets sent 3 times but it is just the embeds. if the bot sends a normal msg it will only send it once and all the commands is shared up in different cogs and files so Im not sure how I would show the code if not showing all of it. but if you got any ideas that could help pls tell me , thanks
Show one of the commands
here is one of the commands that has that problem
class cogs(commands.Cog):
def __init__(self, Bot):
self.bot = Bot
# Server Information
@commands.command(name="serverinfo", aliases=["server", "sinfo"])
async def serverinfo(self, ctx):
name = str(ctx.guild.name)
description = str(ctx.guild.description)
owner = str(ctx.guild.owner)
server_id = str(ctx.guild.id)
region = str(ctx.guild.region)
member_count = str(ctx.guild.member_count)
icon = str(ctx.guild.icon_url)
embed = discord.Embed(
title=name + " Server Information",
description=description,
color=0x007011
)
embed.set_thumbnail(url=icon)
embed.add_field(name="Owner:", value=owner, inline=True)
embed.add_field(name="Server ID:", value=server_id, inline=True)
embed.add_field(name="Region:", value=region, inline=True)
embed.add_field(name="Member Count:", value=member_count, inline=True)
embed.set_thumbnail(
url='https://cdn.discordapp.com/attachments/776904474458980364/785904953868550194/RoseCliff_'
'Test_3.png')
await ctx.send(embed=embed)
print(f'{ctx.message.author} said - "!server"')
def setup(bot):
bot.add_cog(cogs(bot))
do you have on_message events in the cog?
if yes, remove the process_commands thing from them
I dont have on_message in the cog
well the command seems ok, how many times does it print user said - "!server"
Im using pycharm
useless variables
check the tasks and see if there are multiple instances running, that "may be" the issue
so the name will show up in commands other then function name
yea! the name would be the command name
yea Ik but that shouldnt cause the problem of multiple embeds
you set the thumbnail twice?
try refreshing your token, and use that one
they're doing it. but thats not the problem i guess, right?
it overwrites the old thumbnail
yeah, just wondering
did I? dont think I did. the icon = str(ctx.guild.icon_url) is not being used if u meant that
7 useless variables
And then there's me who made a program of 300 lines just cz my teacher and I wanted to play around with tkinter π
IDFK how many useless variables it has
Damn
oh I didnt see that, thanks but that or what @final iron said wont solve the problem. the problem is not just this command in this cog, the problem is around every command that has an embed in all cogs.
And I have fixed the stuff that you both said, still same problem around all commands that has an embed tho
Reset your token
if you turn off the bot, is the embed still appearing?
@surreal sierra do u have an on_message?
any way to use opencv with discord bot...it works but its blocking.
!d asyncio.loop.run_in_executor
awaitable loop.run_in_executor(executor, func, *args)```
Arrange for *func* to be called in the specified executor.
The *executor* argument should be an [`concurrent.futures.Executor`](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor "concurrent.futures.Executor") instance. The default executor is used if *executor* is `None`.
Example:
the embeds stays in the channel when I turn off the bot
no, I dont, not a single on_message event in any cogs
I will try that
Oh okay
is this same as using a thread with no return ?
!d asyncio.loop.create_task
loop.create_task(coro, *, name=None)```
Schedule the execution of a [Coroutines](https://docs.python.org/3/library/asyncio-task.html#coroutine). Return a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") object.
Third-party event loops can use their own subclass of [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") for interoperability. In this case, the result type is a subclass of [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task").
If the *name* argument is provided and not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").
Changed in version 3.8: Added the `name` parameter.
Wouldnt this work instead of run_in_executor?
No
try open task manager, and search for python, end task, then try to run the bot and trigger the command
that happens on me too sometimes
oh that did somehow fix it, it doesnt send more than one of same embed anymore ty. it was a weird problem tho
yeah that's multiple instance running issue
its solved now and that was the first thing I tried to do
it doesn't fix the issue?
you should end both Python and Python <version> too
well that wasnt the problem, I tried to do that more than 5 times but still had the problem. its solved now anyway...
yeah
tic tac toe
Just steal someone else's code
My main.py is getting larger and is getting cluttered. How should I proceed with moving the commands to other files?
Use cogs
Cogs are a very important part of discord.py which allow you to organise your commands into groups - not to be confused with actual command groups, which will be explained later in the tutorial.
is there an event to detect server owner transfership?
nope
on_guild_update, check after.owner and before.owner
or after.owner_id and before.owner_id if you don't have member intents 
how do i check for a specific role of user?
!d discord.Member.roles
property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [β@everyone](mailto:'%40everyone)β role.
These roles are sorted by their position in the role hierarchy.
mailto:'%40everyone'
what's this in the embed
oh mobile discord smh
Yea
this isn't related to discord bots..
that is not allowed by discord
what library?
i think it is anyways
mobile discord on a bot
what does that prove?
no idea
yeah there's no rules regarding that.
ok
what library is your bot using?
How do I delete my bot's own message?
but danny doesn't propagate this and we should always trust danny lol
!d discord.Message.delete
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other peopleβs messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
get the message object, use that on it
thanks
yessir
@slate swan
Modify the lib in file discord/gateway.py. Find lines 292 - 293
'$os': sys.platform,
'$browser': 'discord.py',β
and edit them to get
'$os': 'ios', # or 'android'
'$browser': 'Discord iOS', # or 'Discord Android'
``` if you really want this
but it isn't that cool imo
it says invalid syntax!
File "main.py", line 41
await delete(*, delay=5)
^
SyntaxError: invalid syntax
that's not how you use methods
oh
Use the delete method on an object, dude
I'm not that good at python so
you need a message object ```py
message = ...
await message.delete(**kwargs)
and everything after * are kwargs
Discord bots are complex, dude
but it was easy until now
Ok cool, best of luck
but it's not easy for people to help you
its isn't tho
someone,please help me with adding the
"Add" command to my discord bot Zer0
i lost all my codes for my bot in vsl can someone help
run your bot with the normal way, with the source code edited. After it's online, it will have mobile status
Guys I have some subcommand in my code, my question is:
When i call subcommand, first of all the code executes the original command, if I write some code in there it will be executed, no metter what subcommand is called. Now i want to add a description which will be called when i use the command without any subcommand, how to not let the other subcommand execute that description too?
any idea why this returns []
@disnake.ui.button(label="Nickname History", style=disnake.ButtonStyle.green)
async def nicknames(self, _,interaction: disnake.Interaction):
async with bot.db.execute("SELECT prev_name, time FROM usernames WHERE userid=?", (self.member.id,)) as cursor:
data = await cursor.fetchall()
print(data)```
bot is a subclass of discord.Bot?
use invoke_without_command=True in the parent command decorator
I'll check that, thanks
nope
it can't find any result from the db
doesnt that just return None? I might be wrong
Then how it works lol? what is bot? why you call it before the db. Btw if the list is empty means that he founds nothing
I just checked the database, there is a record
I don't always have to subclass bot...?
is userid integer or..
π
of course not, but if you call bot.method means that you have a class or a directory which contains that method/function
just trying to understan what "bot" is
You mean bot.db?
yes
I just made a bot variable
and what is this variable D_D
bot = commands.Bot(command_prefix=';', intents=intent)
bot.db = bot.loop.run_until_complete(aiosqlite.connect("database_name.db"))
no, maybe the you updated websocket library and your code became broken? Unsure..
Finally, lol. So the problem is the query, it founds nothing in the record and returns an empty list
π
yeah
@disnake.ui.button(label="Nickname History", style=disnake.ButtonStyle.green)
async def nicknames(self, _,interaction: disnake.Interaction):
async with bot.db.execute("SELECT prev_name, time FROM usernames WHERE userid=?", (self.member.id,)) as cursor:
data = await cursor.fetchall()
print(data)
this prints []
can you try selecting everything first? SELECT * FROM usernames
did you save userid column as TEXT?
they didn't say so
iirc Sqlite won't take an INT / REAL larger than 16 digits, and a user's id is 18 digit long
I'm pretty sure I worked with user ID's before in a DB like that
yeah
also I'm getting sqlite3.OperationalError: no such column: before_nick now
why did i think xcirno was that one russian guy who always asks for help here hm

It doesn't exist then
just found that this will not work for me π’
I'm using slash commands
is sqlite hard
no
not at all
ok
Whats the best remote database service i could use for discord bots
why do you need it to be remote?
Many people prefer Mongo
someone knows how to take a list of disnake object (list, roles, guilds) as parameter in a slash command using disnake?
Uhhh, mind explaining your use case?
whats the option type for timeout
Mongo isn't a good database for bots tho, postgresql would be the best option
what are con of mongo tho?
i have a slash commands which will accept a list of roles as parameter
well, i don't have it yet cuz i have to code it lol
Okay dutchy π
It's a non-relational database while most discord data ur gonna store is relational
hey...is using opencv for image processing in discord bot a good idea ? i assume its gonna need some serious compuation power to process hundreds of images same time ?
Why would a discord bot need to process hundreds of images at the same time? 
like a user upload a image and bot needs to find some shapes in it and return the image with locations marked
i think this needs a lot of cpu power
ty
I'm not sure if opencv can be used with asyncio
yeah its blocking
then is not possible
i tried searching non-blocking opencv on google...got nothing useful
Well maybe
will You save the image that the user will send? even for a moment only?
async is the correct term
you can also put the blocking code in an executor to make it async if really necessary
it is not necessary, if he can run the opencv script from a different interpreter it could work
it will be a little slower but with opencv you can never say how many time it will take to operate
What is the difference between @client.command() and @commands.command()?
first one is a command decorator outside a class, second one is in a class (a cog)
more about this can be found when looking for Cogs in the docs
no one can help with this? i don't want to check it from a string :L
yes, you can typehint them and it'll convert them by itself
and if you're talking about a list, you have 2 options
or you use *, shits: shitClass
or you can use
shits: typing.Greedy[shitClass]
sniper and his shits
It has the same function as @client.event, but can be used in cogs
Yep
I have created a discord bot that sends embeded message to a channel. How do i close the bot so it can sent another message
why would you close the bot to send another message?
are you even using an API wrapper for this?
I created this:
class Discord_bot:
def discord_message(self, id, test1, test2, test3):
@client.event
async def on_ready():
channel = client.get_channel(id)
embed=discord.Embed(title=test1, url=test2, description=test3, color=0xff0000)
embed.set_footer(text="Test")
await channel.send(embed=embed)
# Run the client on the server
client.run(DISCORD_TOKEN)
in another python file i call this function in a loop. Everytime when test1 == test1 for example i would like to call the function. This is not possible because the bot is not closing
message = discord_bot.discord_message(id, test1, test2, test3)
message()
inherit commands.Bot to your class please
and I just don't know why you wouldn't choose the easy way, this doesn't seem right
you run the bot on_ready

I tried getting an epoch timestamp from an embed and converted it into a datetime timestamp but when i try to use sleep_until it yields instantly even tho the time is 12 pm est.
wait what, there's not even a client
on_ready() shouldn't be nested inside a function which itself is inside a class
You can either have it on the outermost level, or have it within a commands.Bot subclass and override on_ready, without the @bot.event decorator
Yes you can print in on_ready but that should be about it
naming conventions:
but the bot can't be ready if there's no bot in the first place? sort of a paradox lol
ποΈ ποΈ
Philosophical bot dev
we'll never know
how that works
how can i assign the display roles above everyone permission to a role
discord.py
how do i fetch the message link of a message
!d discord.Message.jump_url
property jump_url: str```
Returns a URL that allows the client to jump to this message.
Look above
what about my other question
not .id
message.jump_url
I want to create a command which randomly assigns a role
From a list
then do it
make a command and append all guild roles to a list
role ids
oooh
should they be in the form of strings?
no
no
add roles only accepts a role obj or ints
it doesnt accept int
you can use
uh
self.client.get_role
dont billy me im a 1 month old coder
it doesnt what does it take?
@async def on_message(message):
if message.content == "give me admin"
role = discord.utils.get(server.roles, name="Admin")
await client.add_roles(message.author.id, role)
penises
@async def on_message(message):
if message.content == "give me admin"
role = discord.utils.get(server.roles, name="Admin")
await client.add_roles(message.author.id, role)
its going to be self assignable
!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/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
How do I make timeout user command?
!d disnake.Member.timeout
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.
thanks
guess it doesnt
what the fuck is disnake i took a 2 month vacation and idek what these new stuff is
its a fork
oh
!pypi disnake
disnake is the only discord fork
caeden with his conspiracies
π
looks nice
sexy
π³

You're missing the @client.event or @bot.event decorator
no no
be a chad and use listen
Or that too
and robin you can react here aweπ
Though on_message particularly has a useful case for @bot.event
i.e:
@bot.event
async def on_message(m):
if m.author.bot:
return
did you know that creating a bot.event for on_message event is exactly the same as overriding the on_message function in subclassed Bot?
Yep, same with all the other events iirc?
True I think on_message is a special case since it's kind of a gateway to the command handlers i guess you'd say
That's why a lot of people forget the process_commands() at the end and none of their commands work
You can kind of use that to your advantage sometimes
Such as blacklisted users, blacklisted guilds or channels, not picking up bot messages, etc..
checks:
disnake-debug:
sorry, had to slip this cheeky boy into the convo
heh
!pypi disnake-debug
I tried getting an epoch timestamp from an embed and converted it into a datetime timestamp but when i try to use sleep_until it yields instantly even tho the time is 12 pm est. any idea why?
kek
troll server
i hope one sees it n copy pasta it n bans yall
yeah wtf is server
hmm
anyone who types gets admin
@slate swani mean aperently u dont even know how to make a simple variable
they wont get admin the admin part is copy pasted
CommandInvokeError: Command raised an exception: TypeError: Object of type TextChannel is not JSON serializable``` the hell does this mean
@slate swanu still has no clue of python and cant make a simple variable
your error is what u learn when u try make a hello world python script kinda
print("hello world")
!tempban 417154674555224077 1w This attitude is not appropriate for our server. You will not be rude to the people asking for help.
:incoming_envelope: :ok_hand: applied ban to @honest vessel until <t:1644511645:f> (6 days and 23 hours).
servers are referred to as "guilds", so to get the "server", you would do message.guild
thx lol
yeah did that just now
Im getting an epoch timestamp from an embed and converting it into a datetime timestamp but when i try to use sleep_until it yields instantly even tho the time is 12 pm est. any idea why?
thanks
Great! Working now?
robin a helper now??
Robin poggin
What were you trying to do that threw the error?
well another error popped up but previous one is gone
let me send
thanks for the help btw
You're looking for member.add_roles
hmm
!d disnake.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://docs.disnake.dev/en/latest/api.html#disnake.Role "disnake.Role")s.
You must have the [`manage_roles`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_roles "disnake.Permissions.manage_roles") permission to use this, and the added [`Role`](https://docs.disnake.dev/en/latest/api.html#disnake.Role "disnake.Role")s must appear lower in the list of roles than the highest role of the member.
or yeah that
youll need to know oop basic python and async programing and heres a good tutorial 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.
If you have any specific questions such as why isn't a part of your code working or how would you go about implementing a certain feature, we would be more than happy to help
anyone?
You can get the discord.Member instance from message.author, which is the person who made the message


