#discord-bots
1 messages · Page 648 of 1
how can i fetch all of the channel on a server?
!redbot
I’m dead
What actually is a red bot?
I don’t know
!d discord.Guild.channels
property channels: List[GuildChannel]```
A list of channels that belongs to this guild.
But there is someone called red in one of my servers
Just upgrade pip is pip install --upgrade pip iirc, but could you please tell what your python version is?
3.9
Try downgrading to 3.8, I had similar issues with installing scikit, after I downgraded it all went back to normal
Change client.change_presence to self.client.change_presence
Ok tks
Guys how do I make a LFG thing in discord.py?
I guess I'll just switch to pycord in a bit tho
what's that
Looking for Game, like, when someone is playing a multiplayer game and wants someone (in the server) to join his game, he uses this command to "post a request for someone to join"
Wait I'll send an example
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Always add self before ctx when want to make command in cogs
Can't find one, but as long as I can say an example (it's not how every LFG work but still)
When someone sends a command like "!createlobby" you either put the required arguments directly in the command (id, pass if there is one) and then it posts an embed into a channel (it's a private bot so I know which channels it'll post it in) or the bot asks you separately id and password to join and still posts the embed in a channel
People can join by putting ID (and pass) and, if possible, it makes a channel (or a thread, but I think they're not implemented in discord.py) to chat
Aight, LFG
for this
how do i delete the message that activited the command?
nah
Or u use command and it will be deleted after the bot activited it?
yes
i forgot
Not in discord py I guess
await ctx.message.delete()```
is there any event similar to on_message but about rections - on_reaction_added for example
discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.
Note
To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
Note
This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
thanks!
is it possible to have 2 bot.wait_for in a messagE?
use
prtscsysrq+f12 to take screenshot then ctrl+v to paste it in chat
in a message? But yea, you can use it twice. Although your usecase might not work as expected
i am trying to make a business command and this is what i thought
@bot.command()
async def business(ctx, invest: str):
success = random.randint(400, 1000)
lost = random.randint(150, 300)
guess = random.randint(success, lost)
conn = sqlite3.connect('test.sql')
msg = await bot.wait_for('message')
if msg.content == "invest":
await ctx.send('hmmm')
else:
await ctx.send('where?')
if msg.content == "(A)":
await ctx.send(f'you invested in blah and got {guess}')
else:
await ctx.send('sad')
if msg.content == "(B)":
await ctx.send(f'you invested in blah and got {guess}')
else:
await ctx.send('no money')```
I mean thats only 1, so easy as
its giving dis
i guess something is wrong with the random.randint
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: empty range for randrange() (973, 159, -814)
How to get the bot to take the msg variable From the emb command to on_reaction_add??
What is guess meant to be? And why do you take 3 lines for it
What?
Explain your usecase if you dont mind, am confused
soo like i want to make a possibility such as
50/50
Code?
Why not just randint(150, 1000)
ohh
there is an msg = await bot.wait_for('message', check=check, timeout=None ) in the emb command and I want to take it from the Emb command to @bot.event on_reaction_add
okay so its now replying with all the 3 messages
Can’t you try to indent the event
I said database
what do you mean?
Is this for roles?
which database
Or just a command
my team: The user writes a message after that, the bot sends it to the channel for verification to the moderators to approve his questionnaire after they have approved, the bot should send it to the anketa channel
code:
how will the database help me?
Saves stuff even when shutdown
Indent the event
should I just upload this code to the database and it will work?
It doesn’t work that way
Try doing this pls
Tab or four spaces
@bot.command()
async def business(ctx, invest: str):
guess = random.randint(150, 1000)
conn = sqlite3.connect('test.sql')
await ctx.send('where?')
if ctx.content == "(A)":
await ctx.send(f'you invested in blah and got {guess}')
else:
await ctx.send('sad')
if ctx.content == "(B)":
await ctx.send(f'you invested in blah and got {guess}')
else:
await ctx.send('no money')
```error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'content'
Change ctx.content to ctx.message.content
so I'm fine with the code
now its replying with 3 message at once
Try to put four spaces on each of the line starting with @bot.event
This looks more familiar
What’s the problem
you mean like this?
No
@slate swan change your name to bot.event
Do it also to bot.event and async def

Does it send sad and no money!
?
Search python if elif
Don’t use multiple if else statements
Use await bot.wait_for
I don’t think ctx.message.content is the thing you need
okay
how to get emoji by code points?
bot.get_emoji(int('\U0001F642'))
whats a codepoint? the unicode value?
yeah
oh, ok. thanks
it works with emoji IDs? for example - 916266870980640788?
yes
why my code can't see my reacted emoji?
it doesn't see the IF statement where my print('debug') located
@bot.event
async def on_reaction_add(reaction, user):
channel = bot.get_channel(916255565896892426)
if reaction.message.channel.id != channel:
return
if str(reaction.emoji) == "1️⃣":
print('debug')
await channel.send("let's play")
the channel
channel is a channel object, u cant use the operator on that, ur also using the id attribute to check if it isnt equal to a channel object and not a channel object's id
but it runs well when i try to await channel.send(text)
Hm
runs well meaning?
seems like this one is causing issues:
if reaction.message.channel.id != channel:
return
yeah, it prints on discord text-channels
do channel.id
k, i try it
yeah lol, that was the issue
@boreal ravine thanks
@commands.Cog.listener()
async def on_member_update(self,before, after):
guild = self.bot.get_guild(645753561329696785)
member = after
if after in guild.members:
if 'a1b2c3' in str(after.activity):
role = guild.get_role(916271809333166101)
await after.add_roles(role)
else:
role = guild.get_role(916271809333166101)
await after.remove_roles(role)
Hey why do I get the error
discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role
The role ID is correct
how do i send a dm to the user using their ID?
Use user.send
like dis?
@bot.command()
async def msg(ctx, user: discord.User):
user = bot.get_user(856914222549958689)
await user.send('hmm')```
error:
discord.ext.commands.errors.MissingRequiredArgument: user is a required argument that is missing.
👍
What are you doing in
user = bot.get_user(856914222549958689)
Hardcoing the users ID?
i guess i am adding the ID of the user?
You sure it's correct
I mean you can mention the user
mention?
Because you didn’t pass all the arguments
ohh
You can mention the user
Like
msg @Bob
No need to hardcode
@boreal ravine do you know how to immediately delete reaction in on_reaction_add event?
error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'
yes
Because the user is none
!d discord.Message.remove_reaction
wtf
Remove the get user
await remove_reaction(emoji, member)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.
The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
The user should be the user:discord.Member
@gentle rose
thanks!
!d discord.Reaction.message for the message instance
Message this reaction is for.
but how i get message id?:D
My bot post this message at on_ready(). Do i need global vars to store message id?
I'm gonna work on pybot
how much millions you got?
millions wtf
done
what pybot?
like dis?
async def msg(ctx, user:discord.Member):
user = bot.get_user(856914222549958689)```
Okimii and I are collaborating
you hardcoded it
you're not supposed to do that
- id attribute
- I guess lol
but Caeden said no global ;-;
wait so what I do now?
let me contrib 😎 👌
remove get_user
I'll ask him
agreed, global is bad but they dont have a db and using global is the only choice ig
hmm but i cant ping him
because he isnt in my server
there is a giveaway winner from other server which I want to message with his ID
if ctx.author.id in team1_ids.values() and outcome in win_outcome or ctx.author.id in team2_ids.values() and outcome in loss_outcome:
``` Is there a way to simplify this? Just seems so verbose
if statements ig
yeah
just use discord channels
they're awful as a "db" but much better than global variables
wdym
store values in a channel
he doesn't want that
Why not use bot variable instead of global?
becase it isnt gonna be the same value ig
And how would that be different with globals?
no difference
why'd you use a bot var then? 😨
To keep it consistent and accessible everywhere with the bot
same thing with a variable
just import it, it isnt that big of a deal
yo
how do I make this not dm the user
await user.send("Please enter your paypal address in the following format: +paypal example@gmail.com")
Like this
@client.command(name = "commandcall")
async def _commandcall(ctx):
await ctx.author.send(f"answer")
async def on_reaction_add(reaction, user):
if reaction.emoji == "💸":
roleID = 915961885738819604
roleObj = user.guild.get_role(roleID)
await user.add_roles(roleObj)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['Payment Method'].append("Paypal")
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
await user.send("Please enter your paypal address in the following format: +paypal example@gmail.com")```
give me 2
i dont really know this code
i dont really know how to make it say tell it in the channel with parameter
can someone give me like a code that if i say ?role {role} {member} it gives the role to the member
I cant give you like a code, but just pass the role and member in as arguments, and add the roles to them
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'PosixPath' object is not subscriptable
what does this error mean?
this is the code:
import json
from pathlib import Path
def get_path():
"""
A function to get the current path to main.py
Returns:
- cwd (string) : Path to main.py directory
"""
cwd = Path(__file__).parent[1]
cwd = str(cwd)
return cwd
def read_json(filename):
"""
A function to read a json file and return the data.
Params:
- filename (string) : The name of the file to open
Returns:
- data (dict) : A dict of the data in the file
"""
cwd = get_path()
with open(cwd+'/client_config/'+filename+'.json', 'r') as file:
data = json.load(file)
return data
i get the error when i use read_json()
data = read_json(blacklist)
async def role(ctx, role: discord.Role, member: discord.Member):
ty
thats not gonna do anything, im just telling u what to put as arguments
okayy
this is not really a dpy thing. Really just a general python question. Means you can’t index or slice whatever that object is.
Oh yay hi tylerr
👋

How are you
Tired.
?
I forgot my shoes
So I have to play in my school shoes
😭 and it’s raining
:sadge:
Felt that.
is there a way to add multiple reactions together?
does disnake support slash commands?
or do we need to .addreaction('for_each_reaction_separately')
Yeah
Wrong reply
Meant to reply to the one you just sent. But the closest thing you got is using a for loop with Message.add_reaction
yea
hey so how I make a command such as dis
user: !confirm
bot: you confirm?
user:!confirm
bot: ok
Are you trying to make confirm a command or are you just wanting them to say confirm and it does whatever
confirm command
!d discord.Client.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
async def on_reaction_add(reaction, user):
if reaction.emoji == "💸":
roleID = 915952966022856725
roleObj = user.guild.get_role(roleID)
await user.add_roles(roleObj)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['Payment Method'].append("Paypal")
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
await reaction.channel.send("Please enter your paypal address in the following format: +paypal example@gmail.com")
How can I make it so reaction.channel.send works? I can't pre-define channel as it changes per user. Can I fetch like the channel the role was reacted in?
reaction does not have a channel property , you would be using reaction.message.channel
message isn't defined?
why wont it be?
lemme try 1s
is it possible to use 2 bot.wait_for in a single message?
AttributeError: 'Member' object has no attribute 'channel'
Elaborate what you're trying to do.
show your current code
and no. Each of them will wait separately for on_message to dispatch. Both of them wont be triggered by the same message.
@bot.event
async def on_reaction_add(reaction, user):
if reaction.emoji == "💸":
roleID = 915952966022856725
roleObj = user.guild.get_role(roleID)
await user.add_roles(roleObj)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['Payment Method'].append("Paypal")
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
await user.channel.send("Please enter your paypal address in the following format: +paypal example@gmail.com")
You trying to send a dm or something?
send a message in a channel, but can't define channel
Or do you want it in the channel they reacted in?
yes!
we tried that, fetched an error
I edited again. My bad. but man I’ve been messing up lately with telling people what to do
i asked you to do reaction.message.channel and you did user.channel
I know, sent the wrong code
AttributeError: 'Reaction' object has no attribute 'channel' is the error
@bot.event
async def on_reaction_add(reaction, user):
if reaction.emoji == "💸":
roleID = 915952966022856725
roleObj = user.guild.get_role(roleID)
await user.add_roles(roleObj)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['Payment Method'].append("Paypal")
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
await reaction.channel.send("Please enter your paypal address in the following format: +paypal example@gmail.com")
and if I change it to reaction.message.send, the error changes to:
AttributeError: 'Message' object has no attribute 'send'
……
ty ,3
async def on_reaction_add(reaction, user):
if reaction.emoji == "💸":
if user == bot.user:
return
How do I make it so if the bot reacts, it returns the code?
if user==bot.user : return
#help-corn help pls
I guess
Me too. I told someone how to get the ID of a server instead of a channel
@bot.event #User leave with bannedfromtrading role
async def on_member_remove(member): #When someone leaves
for server in bot.guilds:
for channel in server.channels:
if member.id in channel:
await channel.delete()
How can I get this to work?
TypeError: argument of type 'CategoryChannel' is not iterable is the error
Hi
Why are you trying to deleting channels?
when someone leave the server I wanna delete a channel that was created when they joined
,
Hmmm.....Interesting
do you know how to do it or no?
Nope
o oke
Either try getting the channel name
I mean thats what im doing
database?
bro what
store the channel ids that the users create
the user's ID is in the channel name
ok what would you change in that code then?
member.guild will return the guild
then i'd do guild.text_channels
!d discord.Guild.text_channels
property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
The channel name.
async def on_member_remove(member): #When someone leaves
for server in member.guild:
for channel in server.channels:
if member.id in discord.TextChannel.name:
await channel.delete()
so you would do something like that @sullen shoal
should work
k lemmme try
and what is discord.textchannel.name?
str
yes
TypeError: 'Guild' object is not iterable
you didnt get the text channels of the guild
you mean guild isn't defined?
actually the code is entirely wrong, i just realised
oh xd
all member info
Im going to make friend server because I'm lonely
what do you think a guild is
should it be bot.guild
a guild is a discord server
member.guild will return the guild the member was from
.guild will be an instance of discord.Guild
which has a property named text_channels
!d discord.Guild.text_channels
property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
it says list
hm alr, so what do I change?
so what do you think you should do
how do you get and do stuff on each element of the list
a for loop?
yes
for server in guild?
so sum up all this info and show me your code
thats the class not an instance
.
it will return an instance of it
can you be more specific with 'instance'?
for that you have to know the use of a class
thats not the right attribute of the instance
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 132, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line
995, in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 887, in invoke
await self.prepare(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 821, in prepare
await self._parse_arguments(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 727, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 579, in transform
return await run_converters(ctx, converter, argument, param) # type: ignore
File "C:\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1182, in run_converters
return await _actual_conversion(ctx, converter, argument, param)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1076, in _actual_conversion
return await converter().convert(ctx, argument)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 395, in convert
raise ChannelNotFound(channel_id)
nextcord.ext.commands.errors.ChannelNotFound: Channel "None" not found. ```
how to solve?
!e ```py
class Foo:
...
print(Foo) # The Foo class
foo = Foo() # Create an instance of the Foo class
print(foo)```
@lament mesa :white_check_mark: Your eval job has completed with return code 0.
001 | <class '__main__.Foo'>
002 | <__main__.Foo object at 0x7f8a0c494fd0>
@slate swan see, without the right knowledge of classes, everything is so confusing?
i made a ticket system but it gives this error
that is why you should first learn about classes and OOP
me?
been like 3 years since i've looked at OOP xd
then make a bot
im a function man now 🙂
please help me
I mean it's fine, I just get stuck sometimes!
the entire library is object oriented
bot.ticket_configs = {}
@bot.event
async def on_ready():
async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
pass
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
lines = await file.readlines()
for line in lines:
data = line.split(" ")
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]
print(f"{bot.user.name} is ready.")
@bot.event
async def on_raw_reaction_add(payload):
if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]
if payload.message_id == msg_id:
guild = bot.get_guild(payload.guild_id)
for category in guild.categories:
if category.id == category_id:
break
channel = guild.get_channel(channel_id)
ticket_channel = await category.create_text_channel(f"ticket-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)
message = await channel.fetch_message(msg_id)
await message.remove_reaction(payload.emoji, payload.member)
await ticket_channel.send(f"{payload.member.mention} Thank you for creating a ticket! Use **'-close'** to close your ticket.")
try:
await bot.wait_for("message", check=lambda m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close", timeout=3600)
except asyncio.TimeoutError:
await ticket_channel.delete()
else:
await ticket_channel.delete()
@bot.command()
async def configure_ticket(ctx, msg: nextcord.Message=None, category: nextcord.CategoryChannel=None):
if msg is None or category is None:
await ctx.channel.send("Failed to configure the ticket as an argument was not given or was invalid.")
return
bot.ticket_configs[ctx.guild.id] = [msg.id, msg.channel.id, category.id] # this resets the configuration
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
data = await file.readlines()
async with aiofiles.open("ticket_configs.txt", mode="w") as file:
await file.write(f"{ctx.guild.id} {msg.id} {msg.channel.id} {category.id}\n")
for line in data:
if int(line.split(" ")[0]) != ctx.guild.id:
await file.write(line)
await msg.add_reaction(u"\U0001F3AB")
await ctx.channel.send("Succesfully configured the ticket system.")```
christ
this is the error
it gave
the error says the channel is not found
you tried to get a channel by passing None
didnt get u
well basically what your code does is,
.get_channel(None)
and im not helping more than that until you use an actual database
async def on_member_remove(member): #When someone leaves
for guild in bot.guilds:
for channel in guild.text_channels:
if str(member.id) in channel.name:
await channel.delete()
well that wasn't that hard! Sometimes you just have to point people in the right direction
send full error
database..in ticket system..
this is the full
no
dumb way to do it
it works no?
it works but its slow
yes..
so dont use a json as db
you're iterating through every server for no reason when all you need is the member's guild object
bu the channel is None
i didnt
what else do you use a database for? storing your minecraft videos?
I use json for my minecraft videos!

this isnt your code.. isn't it?
which line can u point out?
so, I got a command that reads in arguments like this
async def test(ctx, var1: int = None)
but if I have message before ctx as I need to get the authors ID it counts that as being a variable
message before ctx? wut
followed a tutorial
because to get author id you need to have message in the parameters
im on somehost, how can I make the bot send pics that are on my computer?
just use ctx
!d discord.ext.commands.Context.author <= is a discord.Member instance
Union[User, Member]: Returns the author associated with this context’s command. Shorthand for Message.author
..help?
bot died
you can't just post code and not say why it's not working
i gave the error
..
channel none wasnt found
its a category ig which i gave..
its copy and pasted https://gist.github.com/dpy-manager-bot/42c9170675bed8cb6c570fd41757fa13
A file by Ilay#8374 in the discord.py guild. GitHub Gist: instantly share code, notes, and snippets.
i didnt even see this
#discordpy #python #tutorial
Welcome to the eleventh episode of my Discord PY Rewrite Tutorial Series where I go through and explain how to create an advanced ticket reaction system that could be deployed in a public bot, it is customisable and can easily be developed.
Thank you for watching! If you enjoyed, please subscribe as 99% of my viewe...
i followed this
tutorials shmuck, I cant help you but i recommend you use a real db, i can do this in mongodb in like 30~ minutes and for your error the channel wasn't found thats all I can say since im on mobile
I always used mysql whats different with mongodb?
havent used mysql before but mongo is like JSON, but much easier I guess imo
Making friend server
Yay happy
The hardest part is actually making the server, coding is the easy bit
I need to make a role and make nearly all the channels visible to verified people and only one channel visible to unverified people that just has a message
I also need to keep bot alive :sadge:
mongodb is a lot faster than any SQL database
it's not relational tho, but is document-like structured, basically json/dicts underneath
gl
Coding is easy
ik
Making the server is hard
btw my bot uses special custom made decorators to check for permissions so gl with that too 👍
😭
and with the mute command :kek:
Mute is easy as well
Check for permissions should also be ok
But the server hard af I don’t even understand what’s happening
my mute doesn't care whether i give the time at the start or at the end, it can also take in times such as "tomorrow" and a specific date
Oh
:kek:
that's cool
Well I’m going to have to make an if statement
To check if it’s a tomorrow or something
did you use datetime or a different package?
Or maybe create a different command to make a date and time
I don’t think it’s datetime, maybe some other more specific module
yes
uses datetime, parsedatetime, and relativedelta
and regex
👍
Yay
:kek:
I’m going to try to make it more complicated
Whenever your bot sent me a message or when you used the bot, pictures of an estimation of your code float across my head each time
It’s kind of annoying but cool at the same time
lol
I just also figured out how you can put the arguments wherever you put
@tasks.loop(minutes=30)
async def checker(self):
try:
fetchall = self.coll.find({}) # return all documents inside the db
current_time = datetime.utcnow()
async for x in fetchall:
if current_time >= x["BannedUntil"]: # do stuff after this
unbanuser = x["user_id"]
member = discord.Object(id=unbanuser)
guild = self.bot.get_guild(645753561329696785)
await guild.unban(member, reason="Tempban for new account expired.")
deletetime = await self.coll.find_one({"user_id": int(unbanuser)})
await self.coll.delete_one(deletetime)
except Exception as e:
print(e)
This is my code to unban users who were tempbanned, however with their being 800+ documents fetching all doesnt seem like the best idea, any alternatives?
just check the ban list of the server?..
😳
you could instead of looping over every single document, sort them by their BannedUntil and only take the top 5-10 earliest unbans
Me no like big code on mobile
thats like saying "just ban them using dyno"
fetchall = await self.coll.find().sort('BannedUntil', 1).to_list(5)
😨
1 is increasing right
Imagine using dyno
this will return a list of only the closest 5 documents sorted by the BannedUntil key
hm
I don’t like reading big code on mobile
1 -> from the lowest to the highest
-1 -> from the highest to the lowest
np
me neither, it looks like shit
Guys what perms would i put in ```py
@commands.has_permissions()
I can’t even understand
ban_members=True or stuff like that
Hey guys. Is it possible to make a command / feature that records the Audio in Voice Channels from every user's, also when you execute the command "!leave" it auto-sends the mp3 file of each user (or all together).
?
manage_messages + bool
like manage_messages = True?
yes
yeah that didn't work
Hey guys. Is it possible to make a command / feature that records the Audio in Voice Channels from every user's, also when you execute the command "!leave" it auto-sends the mp3 file of each user (or all together).
don't actually think it is, otherwise why would discord even consider adding such feature
Without permissions
yeah, especially without consent
you think
Without permission of the people
that's kinda creepy
I don't think discord.py supports receiving audio from voice channels
it was gonna afaik
well, yeah, without permission obviously
saw a pr for it
im definitely not making an excuse for not typing the code
but they're making it a command i believe so it's fine
yeah, there was a pr which is multiple years old
what command do i use to make sure the user is an admin in py @commands.has_permissions() to check if they are an administrator?
iirc pycord/nextcord is gonna have a receiving audio feature
i don't wanna go through the documentation again
@commands.has_permissions(administrator=True)
k thnx
lazy 💩
yes
It has all you need, why not read it for your own sake
too big much very
it isnt
okay im just lazy
ok
Did they add it to nextcord?
Traceback (most recent call last):
File "D:\6Mans\Heps6Mans\Main\mainwithdict.py", line 620, in report
set_new_mmr(pid, get_new_mmr(pid))
File "D:\6Mans\Heps6Mans\Main\mainwithdict.py", line 608, in get_new_mmr
expectedprob = expected[[playerid]]
TypeError: unhashable type: 'list'
Whats this tryna say
¯\_(ツ)_/¯
I thought it was a PR still pending
Huh?
y [[playerid]]
if you knew why are you asking??
You said that they added it
And I am not updated
oop, ty
Oof
ok
Not in discord.py but a fork of discord.py supports it
https://github.com/Sheepposu/discord.py
And it's pretty buggy if 2 people speak together
Guys my bot is logging all the messages sent like this in a csv, help
.JOIN
what?
i don't understand i've never used csv before why is it rainbow
Rainbow lmfao
bro this is not funny i am having a heart attack
The way you explained it was funny
ah, my reputation at it's finest
lol
I am pretty sure Cleaning up after 1800 task in 6 hours of the bot running isnt good right? I feel like I have something which is really eating a lot of memory suddenly
how can I get emoji image url
!d discord.Emoji.url
property url: str```
Returns the URL of the emoji.
Hey getting this error
'async for' requires an object with __aiter__ method, got list
.to_list is an awaitable which returns a list object
so there's no need to use async for, just loop over it like a normal list
every element in that list is a document which is basically a dict object
ah! when I print it
[{'_id': ObjectId('61992ddd00c75711b7e5af72'), 'user_id': 911052985486962770, 'BannedUntil': datetime.datetime(2021, 12, 3, 17, 18, 21, 431000)}
Thats one, how would I parse the time then?
mhh ?
it's just a datetime object, so just like you would before
ohh
help :x
i don't help with basic python errors
...
¯_(ツ)_/¯
I am French, I don't understand much
idk how to explain that error better than its already explained tbh 😔
the error already tells you what the problem is, it's a really basic python error
@slate swan When I reboot my bot Cleaning up after 6048 tasks. I get something like that after the bots been running for just a few minutes, recently I have been having low memory, Is 6048 tasks in like 5 minutes normal?
no, it's not normal
are you sure that it's an issue from your bot and not your pc?
I am running it on heroku. I never had memory issues until like a day back
weird
idk from where all those 6048 tasks could come from
You used less space after line 239
...
Sorry, I'm so stupid, I didn't see that so I don't understand why it didn't work
@slate swanthx
is it possible to make a group roulette command for multiple users?
like i have a normal roulette command which is just color choosing like
!roulette red 50
if it comes red then user gets 2x
anyway i can get my bot to auto role on the new version of discord.py
so is it possible to make the command in group like 5 people will play each putting some money and the wheel spins and person who bets on red1 and if red1 comes then the winner will get everyone's money
Anything is possible if you try hard enough
how creating a text channel in a specific category?
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
there is a category parameter
any ideas how to delete message after for example 10 minutes?
is there any sleep function in discord.py?
await ctx.send("hi", delete_after=600)
oh, thanks! its bot messages, but how about user messages?
await message.delete(delay=600)
i need to do this in on_message event?
nope, you can do it anywhere
you just need the message object
in a command it will be ctx.message
hi,so bassicly i am making bot that auto screenshots my screen by pressing a button,and i have done that,but my problem is that i need it to be sent in a specific discord channel,how can i do this?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'id'
@bot.command()
async def create(ctx):
guild = ctx.message.guild
await guild.create_text_channel('easy', category = 916008353505890434)
why does it give this error?
fetch the id of the channel and send there
yeah,bassicly i have tried doing it but even if i try to log when user is ready it just ignores it,but it works to ss
yo anyone know a quick fix
await bot.delete_message(temp_list_4[0])
AttributeError: 'Bot' object has no attribute 'delete_message'
@icy mango here is code
\👍
anyone know how to make embed?
just like a normal one
Yea easy
plus footer and all of that
help
its ctx not bot
!discord.embed
wut
wait a second
kk
getting url
here you go https://python.plainenglish.io/send-an-embed-with-a-discord-bot-in-python-61d34c711046 @slate swan
ctx won't work as I don't have it in the parameter
bro what
whats the v2 attr to return a users banner as discord.Embed.set_image?
ty
invoke ctx its the only way
await reaction.message.channel.send will that work then/
await guild.create_text_channel('easy', category=bot.get_channel(916008353505890434))```
dont know
await ctx.message.delete()
send code
@bot.event
async def on_reaction_remove(reaction, user):
if reaction.emoji == "💸":
roleid = 915961885738819604
roleobj = user.guild.get_role(roleid)
await user.remove_roles(roleobj)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['Payment Method'].remove("Paypal")
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
await bot.delete_message(temp_list_4[0])```
seeing as Json_Items doesnt exist, what do you want it to be?
thank you, But, there are still mistakes discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'id'
is user an arg? u didnt classify it
!d discord.on_reaction_remove || user is an arg
discord.on_reaction_remove(reaction, user)```
Called when a message has a reaction removed from it. Similar to on\_message\_edit, if the message is not found in the internal message cache, then this event will not be called.
Note
To get the message being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").
This requires both [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
Note
Consider using [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") if you need this and do not want to enable the members intent.
hmm, did you save the file and re-run the bot?
yes, I can try again
?
it does ignore it
but impossible if lack of knowledge
whats the v2 attr to return a users banner as discord.Embed.set_image?
help?
ah lol, thank you, it work.
bro it all works other than this wait user.delete_message(temp_list_4[0])
user.avatar.url iirc
Not impossible still, just get knowledge
thats avatar, i need banner
!d user.accent_colour
No documentation found for the requested symbol.
what knowledge i need to make this type of system?
!d discord.User.accent_colour
property accent_colour: Optional[discord.colour.Colour]```
Returns the user’s accent colour, if applicable.
There is an alias for this named [`accent_color`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.accent_color "discord.User.accent_color").
New in version 2.0.
Note
This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
ah. mb
That's the banner
banner or just color
Banner
alright i guess
No wait that's probably the color
Uh
yeah figured
!d discord.User.banner
property banner: Optional[discord.asset.Asset]```
Returns the user’s banner asset, if available.
New in version 2.0.
Note
This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
Gotta go to class now sru
Guys, How do I make the bot create a text channel with rules so that no one sees the channel except the author?
@bot.command()
async def create(ctx):
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
guild.me: discord.PermissionOverwrite(read_messages=True)
}
await guild.create_text_channel('easy', category = bot.get_channel(916347066882592890), overwrites=overwrites)
you mean ticket system?
no, just so that the bot creates a channel so that only Tommyhellfrigger can see it#5503
thats actually like impossible
What’s the problem
because if the bot can make a channel it cannot be private
users/bot with admin perms can see the channel
i know its possible its it cant be complete prv
You can do it
he wants just the bot and the author to see the channel
That’s possible
not mods/people with admin perms
Make a role and then give the bot the role also
And make only the channel visible to the role
😂
@slate swan

People with admin perms will see it anyways
just so that he would set the rules for @everyone so that they wouldn't see anything, but the author who called the command Tommyhellfrigger#5503 so that the bot would give him access to the channel.
yes
Make role > assign role > make the channel only visible to the person and bot
I'm trying to make a discord bot using the discord.py module. I have structured my code in so called Cogs and now want to make one for creating text channels. The Bot has the permissions it require...
Not a straight answer
ik
how do I do it.
but still dis might help
You’ll have to manually create the role and the channels and then just assign it
Or you can do it via the bot
I mean making the server is the hardest bit
The bot is the easiest imo
The bot creates a channel, after that it sets the rules for @everyone and for author how do I do it.
@bot.command()
async def create(ctx):
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
guild.me: discord.PermissionOverwrite(read_messages=True)
}
await guild.create_text_channel('easy', category = bot.get_channel(916347066882592890), overwrites=overwrites)
I have done role creation via code
I did role creation only for mute
why do i get None when try to get and send custom server emoji by id?
my code:
ono = bot.get_emoji(916363012141637693)
await channel.send(ono)
its 100% correct id of emoji
maybe i need guild id to get guilds custom emojis?
do you have emoji intents
no
how do i use animated emoji in my embed
you need emoji intents
what is intents?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
Hi @manic wing
Don’t you also have to enable them in the dev portal?
it says that in the embed
To enable one of these intents, you need to first go to the Discord developer portal,
!d discord.ext.commands.Bot.get_emoji || as fare as I am aware, you can just put an instance of discord.Emoji inside an embed and if its animated it will just be animated
get_emoji(id, /)```
Returns an emoji with the given ID.
Ok
i enabled all intents(presence intent, server members intent, message content intent) at dev site, and still can't post custom guild emojis
You have to enable it in your code as well
did you do intents = discord.Intents.all() and pass it into commands.Bot(intents=intents, ...)

thanks
Me no have PC with me 😭
actually do i need to enable all intents in web site? maybe only message intents?
its easier
discord.Intents.default() is recommended, however all is easier

does this channel only help with discord.py?
i still can't send custom emoji
Do your bot share guild in which the emoji is?
No
maybe the reason is because i send emoji in on_ready event?
no
oh in that case ive come back to bot development after a while and im guessing discord.py shouldnt be used anymore?
Disnake, pycord, nextcord
Bot needs to be in the server the emoji is in
already is
You can still use it
Any library or discussion related to Discord Bots development (in python ofc)
But it’s just discontinued
You just said no-
He just forgot to enable intents
no, i have all intents
no, its not:D
ok
Umm can you share the code? @gentle rose
Or you know you can just pass it into whatever string as the !amegablobsweats form of the emoji…
intents = discord.Intents.all()
# prefix for bot commands
bot = commands.Bot(intents=intents, command_prefix='!')
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}.')
channel = bot.get_channel(916354676088254474)
text = 'Testing . . .'
hub = await channel.send(text)
ono = bot.get_emoji(916363012141637693)
await channel.send(ono) # not working, Reason: can't send empty text
await hub.add_reaction(str(ono)) # not working
with open("hub.json", "r+") as file:
data = json.load(file)
data.append(hub.id)
file.seek(0)
json.dump(data, file)
I can also help with hikari if anyone does that here
what mean this a?
Animated
It’s what discord does to flag the emoji as animated
oh, do i need to put flags to default custom emojis?
Hello all 😄
Literally just put a backslash behind whatever animated emoji in discord that you want to use
And copy whatever it outputs
Better 
Hi 
bot can use animated stuff without nitro?:D
Yes
It has nitro
Except animated avatars, server boost, umm.... multi avatars, and maybe more
how do I create an event where my bot will spam a message in everyhour
await channel.send('Hallll oo :pepe_rose:')`
still can't get custom emoji, wtf
It’s not supposed to look like that btw.
Emojis don't work like this
no, its just discord
Just put a backslash before an emoji and copy paste the output
Also make sure the emoji you're trying to use is in a guild it’s in.
gimme sec
roleid = 915961770961666118
roleobj = user.guild.get_role(roleid)
await user.remove_roles(roleobj)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['Payment Method'].remove("Cashapp")
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
await bot.delete_message(temp_list_4[1])
```
anyone know a fix?
```AttributeError: 'Bot' object has no attribute 'delete_message'
i did it, but discord kicks this emoji ID
It means bot can't access the emoji
not bot
You can't run ctx its not passed
then theres no way
Prob not sharing the server the emoji is in
how is there no way
help
So my bot gave me this error when i tried to kick my friend
so weird, i already did intents
What version of dpy?
my friend is admin
I hope by spam you don’t mean actually spamming.
Not intents, I mean bot is not in the guild the emoji is in
bot is in the guild that this emoji have:D
Anyone know why it gave me 403?
Either bot doesn’t have permissions, bot has a lower role than your friend or your friend is the server owner
here is my pepe_rose
but i gave it admin perms
no, I need a message like a reminder but in everyhour
so why then?
Use the tasks framework
does @commands.cooldown(1, 5,commands.BucketType.user) work on events\
No
You sure this emoji can be accessed by bot... If yes, idk why it's not working
uhhh, friend != owner, it has admin perms, but maybe it has lower perms than my friennd
it’s probably lower than your friend on the role hierarchy
dam, it does1
yeah that makes sense
so, how I do
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
does anyone know how to change the perms for a user, like not letting them text?
because i wanted to make a mute command
you can create a overwrite
ok
For a role or user
user
!d discord.TextChannel.set_permissions
await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sets the channel specific permission overwrites for a target in the channel.
The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that belongs to guild.
The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.
If the `overwrite` parameter is `None`, then the permission overwrites are deleted.
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...
what keyword is for sending messages?
send_messages
thnx
Set it to false if you don’t want them to be able to send messages.
okay
will the overwrite also overwrite the other perms to false?
No just the ones you set
okay
I’m back
Does anyone know how to get the symbol that’s in front of his name
I can’t find it in any ascii list
idk
idk
Works fine for me
If you just want the images you can probably just look online for the pngs or go to displace
They got an emoji for every discord badge
Oh thank you I’ll try. Don’t want the image just want the character
To copy paste kind of thing
do i have to use await ctx.send(embed=embed)? I've seen it done before but is it necessary?
Yes
For embeds you need to
Otherwise it would be <discord embed object> or something like that with a lot of nonsense
Yea basically your saying this:
await #its a coro
ctx.send(embed#embed kwarg
= #your embed var
em)
no i mean just direct messages likeawait ctx.send()would work?
Okimii still have not answered me what is breathing 🤬 🤬
Yes but your using the embed kwarg
? You have to put embed=name of your embed
No?
🤬
What is breathing 😭
💀
what is breathing
Damn not on pypi
so breathing does not exist?
I forgor
awwwwwwwwwwwwww
It isn't letting me mute someone, it says that member has no attribute server, BUT I NEVER USED MEMBER.SERVER
how to check if a message exist or not
so it tries to mute a user, but it just says it mutes a user but the user can still send messages
maybe the user has a role which allows him to send messages
@sage otter how?
nope this guy has 0 roles
use a mute role instead
how do that
did you just copy and paste what was in the embed and expect it to work?
make a role urself and drag it to the top and then make the bot give role to the person you mute and remove all its roles
yes, idk how
Okay!
""
Uh, im not the owner but i AM ADMIN so how do i make roles(im stupid)
I think there is a create role function
okay
But I gtg bye tylerr have a nice time

but a role should not be created every time a person is muted
👋 Bye I never existed here bye

how to make a memberroleupdates like this
how to copy emoji id? with RMB and copy id?
it works if its custom emoji?
dice_8:
\smile
ye
only for custom
and not name u have to paste that emoji
\pepe_rose
like this?
that emoji is in this server?
eh
thanks! it works
xD
I'm making a moderation bot, what features should i add?
lock, unlock, mute commands like tempmute and mute, image mute (get rid of image pemrs) ban kick softban
okay
kick, ban, addrole, createrole, mute, delete channel, create channel, purge channel, lock channel, change perms, softban
k
if ur on windows do win+v to check clipboard history (and if its off then u should prob use it from now on)
does anyone have any idea of encryption like base64 and stuff
no, i mean i don't need to copy it with Right Mouse Button and then by pressing Copy Id.
instead i need to copy whole emoji to get his ID
uh, idk maybe look up docs for import base64
well i need to decrypt a string someone sent in a server because i think it is against tos
oh i misread your thing
np
uh
maybe search up stuff for it?
idk
i cant figure out what encryption it i
#data-science-and-ml or smth, idk if that is for that
it looks like base64 but its not
send it
P6RFHIEOp7zfiPZ03tkX/fSvGmsa//alSLiBbQIVhnxqTjyJgeFyXqnHoUNih1nNbFSSw05syA3cWVCRX6rEOv4Ga9ZJ96w9Ez5so7KAwjT7K63yuBPbeEA+llzKOyPAV+A+fzq+jRYSCSiDVLFl0BObk9xkQbuRLlArGt7ewqo=
agreed
report to mods maybe?
probably the wrong channel.
i should probably make virtual envs now cus ive started to work on more than 1 discord bot so can anyone send a guide to working with them?
how do i check if the message sent was sent by a bot?
like, if a bot sends i message i don't want to log it
why do you need an env for multiple bots?
!d discord.Member.bot || if message.author.bot: return
property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
because im gonna use something other than discord.py
thnx
!pypi pyenv
@commands.cooldown(1, 5, commands.BucketType.guild)
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'User {member} has been kick')
Hey can anyone help me with ban cmds?
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
!code @commands.cooldown(1, 5, commands.BucketType.guild)
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'User {member} has been kick')
read the embed.
@commands.cooldown(1, 5, commands.BucketType.guild)
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'User {member} has been kick')```
can anyone help me with this cmd?
whats the issue
its showing error here idk why
from discord.ext import commands
class Commands(commands.Cog):
def __init__(self, bot):
self.bot = bot
#this was in a cog
# The below code bans player.
@commands.cooldown(1, 5, commands.BucketType.guild)
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'User {member} has been kick')
def setup(bot):
bot.add_cog(Commands(bot)) ```
whole ban.py code
hey is there a way we can delete this webhook message using bot ?
import discord
!d discord.Webhook.delete || webhook.delete if you have your instance of discord.Webhook
await delete(*, reason=None, prefer_auth=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes this Webhook.
you can't do member:discord.Member if you haven't imported discord. it doesnt know what discord is.
that deletes the webhook from that channel rite
i wanto delete this msg 'testin'

