#discord-bots
1 messages · Page 311 of 1
global 
Do you know both?
choose one you know better
Yes
GPT knows all indeed 🤓
But which one is good
Didnt robin answer you question already?
both are good
Uff typical discord issue, messages aint loading
Both have advantages and disadvantages. Which do you know better
what lmao
And equally :)
Why
Gasy ask
Gasy?
???
Omg
???
Is it possible to get the id of the channel the command was used in?
I need it for my logging system
alr tysm
!d discord.ext.commands.Context.channel for more info
Returns the channel associated with this context’s command. Shorthand for Message.channel.
Check the Context class actually, useful stuff u may find for your logging system
Also how to get guild name the command was used in
ctx.guild.name ?
mmk tysm
!ot
Please read our off-topic etiquette before participating in conversations.
A type hint indicates what type a variable is expected to be.
def add(a: int, b: int) -> int:
return a + b
The type hints indicate that for our add function the parameters a and b should be integers, and the function should return an integer when called.
It's important to note these are just hints and are not enforced at runtime.
add("hello ", "world")
The above code won't error even though it doesn't follow the function's type hints; the two strings will be concatenated as normal.
Third party tools like mypy can validate your code to ensure it is type hinted correctly. This can help you identify potentially buggy code, for example it would error on the second example as our add function is not intended to concatenate strings.
mypy's documentation contains useful information on type hinting, and for more information check out this documentation page.
!src hi
Unable to convert 'hi' to valid command, tag, or Cog.
!src typehints
Unable to convert 'typehints' to valid command, tag, or Cog.
!source [source_item]
Can also use: src
Display information and a GitHub link to the source code of a command, tag, or cog.
it comes from tags
idk
hello, right now I am using subprocess to execute ffmpeg commands, which blocks discord, is there a better way to execute ffmpeg without blocking?
subprocess.run(['ffmpeg', '-protocol_whitelist', 'file,http,https,tcp,tls,crypto', '-i', temp_file, '-bsf:a', 'aac_adtstoasc', '-loglevel', 'fatal', ffmpeg_output])
Use subprocess.Popen. run calls communicate internally which is blocking
!d discord.Member.kick
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/latest/api.html#discord.Guild.kick).
!d discord.Member.ban
await ban(*, delete_message_days=..., delete_message_seconds=..., 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/latest/api.html#discord.Guild.ban).
Should be about all you'd need
hey, i am making a suggstion command but i cant seem to work it out.. can you help?
the code:
@bot.command()
async def sug(ctx, *, suggestion):
embed = discord.Embed(title = f'{message.author.name} has punlished a suggestion', description = f'The suggeestion that {message.author.name} has created is: {suggestion}', color = 0x749FDC)
embed.add_field(name = "Suggestion id:", value = f"{suggestion.id}")
await suggeestion.send_reaction(":white_check_mark:")
await suggeestion.send_reaction(":x:")
await ctx.send(embed = embed)
the error:
Command raised an exception: NameError: name 'message' is not defined
I think, I'm not sure but replace the {message.xxx} with {ctx.xxx} and it may work
Also, if you have a suggestion channel, I suggest you make this command send the embed to that channel.
And not the channel where it was executed
gave me this error:
embed.add_field(name = "Suggestion id:", value = f"{suggestion.id}")
^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'id'```
how do i do it
ok, could you tag me and tell me what you changeed?
yep :)
🤗
What is suggestion.id supposed to be?
The ID of the message? Something you generate yourself?
the message id
You can get the message ID using ctx.message.id
Also unrelated but suggestions lend themselves well to a modal
I fixed the command for you, but I'm not gonna spoon feed so please look up a tutorial on how to make it send to different channels
Current Code:
@bot.command()
async def suggestion(ctx, *, suggestion):
characters = string.ascii_letters + string.digits
suggestion_id = ''.join(random.choice(characters) for _ in range(7))
embed = discord.Embed(title = f'{ctx.author.name} has published a suggestion', description = f'The suggestion that {ctx.author.name} has created is: {suggestion}', color = 0x749FDC)
embed.add_field(name= "Suggestion ID:", value = f"{suggestion_id}")
embed.add_field(name= "Message ID", value=ctx.message.id)
await ctx.message.add_reaction('✅')
await ctx.send(embed = embed)```
ok thanks
no problem, if you need further assistance, feel free to ping me
I love the kindnes in this world 
Bro how can I make / command in my bot and I have to make bot in JavaScript or something else
You can make slash command in python
huh
Plz I can’t download
gave me the error:
characters = string.characters+ string.digits
^^^^^^
NameError: name 'string' is not defined```
about the script part:
``` characters = string.ascii_letters + string.digits```
can you help?
@</ Astral >
works, but i tried to give the embed the reaction instead and didnt succeed can you help?
@desert kiln
So you want the reaction on the embed correct?
yes
Give me 2 mins
ok
ctx.send returns the sent message. You should add the reaction onto it like so:
message = await ctx.send(embed=...)
await message.add_reaction("😀")
maybe: embed.add_reaction("reaction") ?
You can only add reactions to messages, not embeds
ok
so, i need to create a buttons that will update the embed everytime someone press the button am i correct?
I don't know how you want your command to be like
something like this
ok, ho do i add them?
I'm doing it now
Buttons are usually recommended
I dont really carwe
yea but then you have to make even longer of a command
Debatable. I think buttons are more ergonomic to code.
Is this fine?
yes
so as i m creating an discord bot for python
@client.event
async def on_message(message):
if message.content.lower().startswith('?hi'):
await message.channel.send(f"Hello! How can I help you today?")
i m writing this block of code for an command when it got triggered however its not working and rather when i send message on a dm to bot it then replies so how can i fix it ?
Check your intents
all true
stuck on this for a long time aha
any solutions or help from u all i can get
Well, are you wanting it a command, or on_message event?
on_message event like when an user send?hi the bot on the reply send hi and blah blah
like just as an prefix aur should i also set the prefix default ?
Just make your hi thing, into a command
if you're gonna use a prefix to begin with
also if i am just sending msg hi and removing '?' from code aswell the bot is not replyign to me
Sounds like a message content intents issue
hey robin i have set it to be true
Can we see?
can you send me?
yeah sure lemme share the code
#firstly we need to connect to the discord bot using out token
import discord #discord module to add
token = ""
intents = discord.Intents.default()
client = discord.Client(intents=intents) #connecting to the discord API
intents.messages = True
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
@client.event
async def on_ready ():
print(f"Bot logged in as {client.user}")
user_count = sum(guild.member_count for guild in client.guilds)
await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
#for server await.client.change_presence(activity=discord.Game(name=f"listeing to {len(client.guilds)} servers"))
@client.event
async def on_message(message):
if message.content.lower().startswith('hi'):
await message.channel.send(f"Hello! How can I help you today?")
client.run(token)
dont mind the comments i m an begnieer in this so to remind myself i add cmnts
i have also enable from here aswell
you have duplicated some text
You set the intents after passing it into Client
Anyways, imma go back to working on my economy bot :)
good luck with what your doing @still spade
You shouldn’t be using on_message to create commands, there’s an actual commands extension for that
when you will be free pls send me... @desert kiln
Does it although matter as overall i have set the intent from developer tool
The order does matter. You can't change the intents after you've already passed it in
No i m not making an cmd from thier just as for an particular thing it react
Well, I guess technically you can but you completely re-assigned it with a new object so
Previous code you showed had a prefix in front of hi
@bot.command()
async def suggestion(ctx, *, suggestion):
characters = string.ascii_letters + string.digits
suggestion_id = ''.join(random.choice(characters) for _ in range(7))
embed = discord.Embed(title = f'{ctx.author.name} has published a suggestion', description = f'The suggestion that {ctx.author.name} has created is: {suggestion}', color = 0x749FDC)
embed.add_field(name= "Suggestion ID:", value = f"{suggestion_id}")
embed.add_field(name= "Message ID", value=ctx.message.id)
message = await ctx.send(embed=embed)
await message.add_reaction('⬆️')
await message.add_reaction('⬇️')```
Yes ik but it as just an trigger for an particular thing
Commands do what you just described
Tho if u just want that on the msg 'hi' it trigger would it work like not including any prefix
Okay so, which are you wanting.
- It To Trigger When You Have A "?"
- It To Trigger Any Time Anyone Says "hi"
It to trigger any time says hi
I would like to create a Flask server, and when the server receives a request, the bot sends a message to a Discord channel. I've been working on it for days
I'll fix your code for you, and send you it, and give you some helpful tips
Send me your current code
@desert kiln Bro send me a /command with py
Read #rules
Fixed but same issue
Alright
Read Rule Number 8.
Ok
@desert kiln
#firstly we need to connect to the discord bot using out token
import discord #discord module to add
token = ""
intents = discord.Intents.default()
client = discord.Client(intents=intents) #connecting to the discord API
intents.messages = True
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
@client.event
async def on_ready ():
print(f"Bot logged in as {client.user}")
user_count = sum(guild.member_count for guild in client.guilds)
await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
#for server await.client.change_presence(activity=discord.Game(name=f"listeing to {len(client.guilds)} servers"))
@client.event
async def on_message(message):
if message.content.lower().startswith('hi'):
await message.channel.send(f"Hello! How can I help you today?")
client.run(token)
dont mind the comments i m an begnieer in this so to remind myself i add cmnts
@.error.404.
Also i just want hi only
Ok thx so much
please can someone help me?
Still the same thing. You're changing the message content intent after passing it into client
I change it like in vs tho same issue
Also Can u share me the edited part so i can run that also
import discord
from discord.ext import commands
intents = discord.Intents.all() # Bot Intents (all)
token = "" # Put Your Bot Token Here
# Change The Prefix To What You Want
client = commands.Bot(command_prefix="!", intents=intents)
@client.event
async def on_ready ():
print(f"Bot logged in as {client.user}")
user_count = sum(guild.member_count for guild in client.guilds)
await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
@client.event
async def on_message(message):
if message.content.lower().startswith('hi'):
await message.channel.send(f"Hello! How can I help you today?")
# Run The Client Instance
client.run(token)```
I added notes for you to understand what the code is doing
If you need further explanation ping me about anything
@desert kiln
I'm not skilled in Flask Servers, I Can't Assist You There, Sorry.
Oh ok
Thanks
@still spade
Hey @sick birch can you suggest some stuff for me to make, I'm wanting a challenge, but I'm not sure what to code, for a discord bot
Z
@sick birch
I would just use a webhook
Hrmm. I don't really have any feature requests but it's fun to play around with the devops side of things. Try to containerize your app, set up some CI workflows, deploy in k8s, perhaps even setup CD in k8s
My Brain: error 404
you just spoke another language 
I have to do it through the bot
Why is that so?
because it also needs to send a message to the user's dms
the request provides an id, and it needs to send a message to the dm using that id
Do it without wrapper
This is terrible
Spoonfeeding poor code is another level
It was the users request, he needed help with that, I didn't make it for him, I fixed it.
Still Spoonfeeding poor code. Spoonfeeding doesn’t help people learn
^
Helping a user would be linking to documentation and examples. Not directly making it for them
Most people just copy and paste the code in, and don’t understand what it does
^
In my experience, this leads to a ton of beginners asking for help with fixing their code, when they don’t know what it does
I blame tutorials mostly for that
The amount of people that don’t know what an object is because a tutorial spoonfeed them code is too high
why my commands r not getting registered
@bot.command() async def add(ctx, user_or_role: discord.Member): # Example: Add the user/role to a ticket system await ctx.send(f'Added {user_or_role} to the ticket.')
@bot.event async def on_ready(): print(f'Logged in as {bot.user.name} ({bot.user.id})')
help me out plz 😭
`import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.typing = False
intents.presences = False`
anyone here plz help
!message-content-intent
The Discord gateway only dispatches events you subscribe to, which you can configure by using "intents."
The message content intent is what determines if an app will receive the actual content of newly created messages. Without this intent, discord.py won't be able to detect prefix commands, so prefix commands won't respond.
Privileged intents, such as message content, have to be explicitly enabled from the Discord Developer Portal in addition to being enabled in the code:
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
bot = commands.Bot(command_prefix="!", intents=intents) # actually pass it into the constructor
For more information on intents, see /tag intents. If prefix commands are still not working, see /tag on-message-event.
my / command isnt getting registered i dont need ! i need /
You did not mention slash commands until now
i needed /command xd not !
@naive briar why my commands dont get registered tho??
Because what you wrote are not slash commands duh
whcih is one for slash command??
discord.py 2.0+ slash command info and examples. GitHub Gist: instantly share code, notes, and snippets.
Read that
k
how
!message_content
The Discord gateway only dispatches events you subscribe to, which you can configure by using "intents."
The message content intent is what determines if an app will receive the actual content of newly created messages. Without this intent, discord.py won't be able to detect prefix commands, so prefix commands won't respond.
Privileged intents, such as message content, have to be explicitly enabled from the Discord Developer Portal in addition to being enabled in the code:
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
bot = commands.Bot(command_prefix="!", intents=intents) # actually pass it into the constructor
For more information on intents, see /tag intents. If prefix commands are still not working, see /tag on-message-event.
how do i get the channel that some one wrote the like ctx.author.channel?
how does it work?
ctx.channel will do
thank you
can i link the channel like #rules ?
ctx.channel.mention
TY
i assume the issue is with the embed, but i can't see where i'm going wrong
@client.event
async def on_message_delete(message):
server = client.get_guild(1153285434907045888)
if message.guild == server:
author = message.author
deleter = message.guild.get_member(message.author.id)
content = message.content
avatar_url = author.avatar_url
channel = client.get_channel(1159728026641240124)
embed = discord.Embed(title=f"Message deleted by {deleter.display_name} ({deleter.id})", description=f"{content}")
embed.set_footer(text=f"Author: {author.display_name} ({author.id})", icon_url=f"{avatar_url}" )
await channel.send(embed=embed)
oh wait
nvm
i thought i found the issue
what's the issue
nothing happens on message delete
previously, i used the same command without an embed and it worked
client.get_channel(1159728026641240124)
this channel exists?
yes
it's 100% an issue with the embed
i've changed nothing other than adding one
isn't it author.avatar.url?
well, i have this code of message edit:
@bot.event
async def on_message_edit(message_before, message_after):
embed = discord.Embed(title = f"{message_before.author.name} has edited a message (user id: {message_before.author.id}).", color =0x0051FF)
embed.add_field(name = "Before Message", value = f"{message_before.content}", inline = False)
embed.add_field(name = "Afetr Message", value = f"{message_after.content}", inline = False)
embed.add_field(name = "Channel:", value = f"{message.channel.mention}", inline = False)
embed.set_footer(text ="This bot was made by _mr3x. ")
channel = bot.get_channel(1139331476559757412)
await channel.send(embed = embed)
and I want to tag the channel in the last field i tried message.channel.mention
should i try message_before.channel.mention?
no
it's author.avatar_url
what version are you on
did u tried to print content?
yeah it works
i said earlier, up until i added the embed, everything worked fine
ignore the weird image
😭 dude
💀
can i see your preiviois code
@client.event
async def on_message_delete(message):
server = client.get_guild(1153285434907045888) # Replace YOUR_SERVER_ID with your server's ID
if message.guild == server:
author = message.author
deleter = message.guild.get_member(message.author.id)
content = message.content
reupload_message = f"Message deleted by {deleter.display_name} ({deleter.id})\nAuthor: {author.display_name} ({author.id})\nContent: {content}"
channel = client.get_channel(1159728026641240124) # Replace with your desired channel ID
await channel.send(reupload_message)
what discord.py version
latest
so nothinh gets sent at all?
yeah
print(avatar_url)
try removing your icon url and see if it sends
fuck u man
that shit worked 😭
why he say fuck me for
cus i was sure that wasnt the issue
and it was
it's because your icon_url variable is wrong
thx for the help
you can still use icon just fix the variable
message.channel.jump_url
or just message.jump_url
you probably also have an incorrect error handler since you didn't receive any error
message_before.channel.mention actualy worked
and adding user avatar as a thumbnail in event is ctx.user.avatar
code:
async def on_member_join(member):
logchannel = bot.get_channel(channel ID)
embed = discord.Embed(title = "new member joined", description = f"{member.mention} has landed from the battle pass!", color =0x095dfc)
embed.set_footer(text ="This bot was made by _mr3x. ")
await logchannel.send(embed=embed)
what i should do:
add embed.add_thumbnail(url = ctx.user.avatar) ?
!d discord.Guild
class discord.Guild```
Represents a Discord guild.
This is referred to as a “server” in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guild’s hash.
str(x) Returns the guild’s name.
nono its ctx.author.display_avatar.
Check the docs
it work can u also tell me where the error was so i can know that what mistake i am making and improve ?
I want to host this discord bot 24/7 ? https://github.com/cheran-senthil/TLE
I am new to open source
please anyone tell me step by step guide
I watched YT videos but didn't got clear idea

you have to use vps, hetnzer is a good place. cheap starting prices too
import discord
from discord.ext import commands
class Ping(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('[+] Ping')
@commands.command()
async def ping(self, ctx):
latency = round(self.bot.latency * 1000)
embed = discord.Embed(title="🏓 Pong!", description=f'Latency: {latency}ms', color=0x800080)
await ctx.send(embed=embed)
def setup(bot):
bot.add_cog(Ping(bot))
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.ping' raised an error: TypeError: object NoneType can't be used in 'await' expression
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
~~~~^~~
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
bot.add_cog(Ping(bot))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "C:\Users\<USERNAME>\Downloads\bot\env\Lib\site-packages\discord\ext\commands\bot.py", line 947, in _load_from_module_spec
await setup(self)
TypeError: object NoneType can't be used in 'await' expression
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\<USERNAME>\Downloads\bot\main.py", line 68, in <module>
asyncio.run(main())
File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "c:\Users\<USERNAME>\Downloads\bot\main.py", line 63, in main
await load()
File "c:\Users\<USERNAME>\Downloads\bot\main.py", line 60, in load
await client.load_extension(f'cogs.{filename[:-3]}')
File "C:\Users\<USERNAME>\Downloads\bot\env\Lib\site-packages\discord\ext\commands\bot.py", line 1013, in load_extension
await self._load_from_module_spec(spec, name)
File "C:\Users\<USERNAME>\Downloads\bot\env\Lib\site-packages\discord\ext\commands\bot.py", line 952, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.ping' raised an error: TypeError: object NoneType can't be used in 'await' expression
You need to change the setup function in your extension file into an async function, and await the add_cog method
yo guys I have problem with my bot
this is the list of bad words
but when I say yapicam he block my message
but yapicam isn't in the list?
There pic inside the word yapicam that is why it's deleting
Even if you type picture it will get deleted too
ahh yes
[2023-10-12 16:33:38] [WARNING ] discord.ext.commands.bot: Privileged message content intent is missing, commands may not work as expected.
holy this doesnt even get fixed i even enabled in dev portal also restarded bot and stuff still doesnt go away
Show how you’re passing it to your Bot/Client constructor
When someone explains something and you respond simply with "wdym" or "I don't understand", that is extremely unhelpful. It tells us nothing about which part you didn't understand or how we can target the explanation to help you. It roughly translates to
Please re-explain everything and pick random different words in the hopes that I get it this time.
Ask targeted questions about what you did not understand. If you didn't understand anything, split it up into individual parts and ask about one at a time specifically.
nvm i fixed
it got fixed
oh ok mb 😭
[2023-10-12 17:01:58] [INFO ] discord.client: logging in using static token [2023-10-12 17:02:00] [INFO ] discord.gateway: Shard ID None has connected to Gateway (Session ID: 488f34c7f241278193a7f31edaa74566). Logged in as BotX-acc-lister
got fixed xd
@final iron 1 more help commands dont get registered even im using await bot.tree.sync()
`@bot.event
async def on_ready():
try:
await bot.change_presence(activity=discord.Game("Made by BotX"))
print(f'Logged in as {bot.user.name}')
except Exception as e:
print(f'Error in on_ready: {e}')
await bot.tree.sync()
Event for handling command errors
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandError):
output_text = f"An error occurred: {error}"
await ctx.send(output_text)
`
also im using @bot.command
anyone can help me fix it??
what's the problem?
im not able to register commands
im here
``@bot.event
async def on_ready():
try:
await bot.change_presence(activity=discord.Game("Made by BotX"))
print(f'Logged in as {bot.user.name}')
except Exception as e:
print(f'Error in on_ready: {e}')
await bot.tree.sync()
Event for handling command errors
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandError):
output_text = f"An error occurred: {error}"
await ctx.send(output_text)
`
im using this but still not able to register commands
also im using @bot.command
@bot.command(name="ticket_add", description="command to add a user to a ticket") async def ticket_add(ctx, user: discord.Member): # Implement /ticket-add command logic here output_text = f'Added {user} to the ticket.' await ctx.send(output_text)
this is command :(
do you get any output errors, or is the command not registering altogether?
nope
no error in
python bot.py [2023-10-12 17:12:26] [INFO ] discord.client: logging in using static token [2023-10-12 17:12:28] [INFO ] discord.gateway: Shard ID None has connected to Gateway (Session ID: f06c08f0b4d59edc1218e93e536c600c). Logged in as BotX-acc-lister
none of commands are getting registered
strange
idk why
I suggest using cogs, if you aren't
This is a prefixed command
It won’t register as a slash command
You also shouldn’t be changing your presence, or syncing your tree in on_ready
Fix what
register commands
Like I said, you cannot register prefixed commands
Prefixed commands are handled by you
You’d need to create app commands
ok
where do we change our presence then
In commands.Bot
It accepts an activity arg
ok thx
Or you can use a task incase you want to change presence at specific intervals and start it in setup hook or along with your sync command or something similar so that the request to start the task is sent only once
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client) you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin) to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.
async with x Asynchronously initialises the bot and automatically cleans up.
New in version 2.0.
!d discord dont dm command
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
What are you looking for
i have an AI bot but its interacting with other people in DM i want it to interact only in guild and with me. i have tried all the code guild only command but its still replying other in DM
Just check who the author is, and don’t reply if so
what you mean by author ?
can you help me i can give you the bot tocken too !
i am tired of it !
Is it a command, or triggered in on_message?
Don't give anyone bots' tokens
yaa
what are the scripts to create add roles and remove roles from people
** I DONT WANT THE SCRIPT**
I already gave you an answer
O
hello everyone. im new to python and i want to do my discord bot ig so im searching for someone to code with me and i could learn something from it
embed.set_image()
can we like set personal properties for it like how much width i want or height etc /
no
ight thnx
What
You want to suggestion an addition to the discord API?
no
like i want to create like this on my own is there any documantation of api on it ?
Well there is no API on suggestions. You have to create that feature yourself with embeds
That’s not how Discords API works
The API and discord.py provide you with a toolset, and you have to create the features yourself
alright got it
so like we would generate random suggestion id or like there would be any ? @final iron
I’d just use the message ID as its unique
so like we can just use msg id right
yeh got it
hey im trying to get back into coding after a long break and i downlaoded vsc and started to set up a bot with discord.py and it says discord isnt a module i can import, did something happen that prevent this or am i just dumb
Are you using a venv
They’ve been around for a lot longer than that
Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.
To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)
Then, to activate the new virtual environment:
Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate
Packages can then be installed to the virtual environment using pip, as normal.
For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.
Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.
Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
@final iron so yeh need help i have create an async def suggestions (sugg)
And then the code but the thing i want is that like i it should be do on a command like ! Suggestion like that also when i m trying to get the user id do we need to add on_message ?
Do you know how to create commands
commands.Bot(command_prefix="!")
Yes i have set up to this and while adding a suggestion things i m doing like this
Client.command
Async def suggestion (ctx):
Tho i need help to understand how would we fetch the user id as in this now
!d discord.ext.commands.Context.author
Union[User, Member]: Returns the author associated with this context’s command. Shorthand for Message.author
property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.id)
@final iron @client.command
async def suggestion(ctx):
embed = discord.embed(title='An suggestion Published by {message.author.name} user',description="The suggestion that {message.author.name} has published is {message.content},color = discord.Color.pink()")
embed.add_field(name = "Message ID",)
await client.reply(embed=embed)
await client.add_reaction('⬆️')
await client.add_reaction('⬇️')
i have wrote this tho when doing the command in server the bot doesnt response also there is no error in the terminal how can i fix it ? / whats the error
Whole ton of issues
You should be getting an error
client.add_reaction doesn’t exist
client.reply doesn’t exist
message is undefined
discord.embed isn’t a class or function
value is a required arg
Slash commands using discord.py?
What about them?
How are they made?
I was wondering if there was documentation for them using discord.py
A ton
!d discord.app_commands.CommandTree
class discord.app_commands.CommandTree(client, *, fallback_to_global=True)```
Represents a container that holds application command information.
I would definitely look at the examples in the repo
Where is the repo for examples?
“discord.py github”
discord.py 2.0+ slash command info and examples. GitHub Gist: instantly share code, notes, and snippets.
Strange no error coming
I have list of roles how I can check if there is a role in user.roles and know what is it
like
[role1, role2, role3]
if the user have any of this role an action will happen also I will know what the role
Loop over the list of roles and check if the role (assuming that they're discord.Role objects) is inside the user.roles 🫠
If one is, break the loop
Can you show example ?
Of?
Like any for-in-loops
How to check if only 1 thing in list in user.roles?
The in statement:
something in some_list
But the user has another roles that not in the list
What's about them? You just want to check if any of your defined roles is in them, isn't it?
roles = [role1, role2, role3, role4, role5, role6, role7]
for i in roles:
if i in interaction.user.roles:
print("Yes")
Like this?
Yes
ahh no error in terminal i didnt get it
can someone help me in #1162303866113634344
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
i m getting this error although there are no help cmnd there is just one that shows however it is now showing error that it already exist
You have to remove the default one.
What are you doing?
Mind sharing.
client.remove_command('help')
like this i m doing but the one i created then doesnt respond
bot.remove_command("help")
yep, can I see your help command. And how have you defined client.
define bot.remove_command("help") above the help command
but use client, i use bot, but you use client
i m using client
ight lemme share
i just say that lol
He doesn't have to necassarily, depends how he's running the code, using cogs etc.
cogs?
boringgg.
What?
client = commands.Bot(command_prefix="!", intents=intents)
client.remove_command('help')
@client.event
async def on_ready ():
print(f"Bot logged in as {client.user}")
user_count = sum(guild.member_count for guild in client.guilds)
await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
#two things happening in the api if on_message 1 reply on the mention and one reply when an bot detects the triggered message and lastly !help trigger
@client.event
async def on_message(message):
if message.content.lower().startswith('hey'):
await message.channel.send(f"Hello! How can I assist you today?")
if client.user.mentioned_in(message):
await message.reply(f"My prefix is '!' if you need more help type '!' help")
@client.command()
async def help(ctx):
#make the things in embed version and send its feature of the bot
embed = discord.Embed(title="Commands of Bot", description="This is the description of the embed.",color = discord.Color.red())
embed.set_footer(text ="An project of Abdullah development !",icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTEHfmHcrz102p1QsLJuo0XPOgofu4WaMpQp_M1_3kBXw&s")
embed.set_thumbnail(url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRnoWVyWgqFjnNyli14PKLfell97OCM7BlmrJnhG-R9dA&s")
embed.set_image(url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTRmAqo26QA87kUluxNHgdnNYtRfFF5f1LHU4EWcscL7w&s")
await ctx.reply(embed=embed)```
better 😭
yeh sorry i forget how to use it
you good lol
and the bot is running, like it prints Bot logged in as ...
thats on_ready
Yes Ik, im asking if it's actually running.
nops giving error discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias
@client.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
print("The bot is now ready for use!")
print("------------------------------")```
the bot is not even starting when i m running it says
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias
async def suggestion(ctx, *, suggestion):
print("Suggestion command trigger ed.")
embed = discord.Embed(title=f'An suggestion Published by {ctx.author.name} ', description=f'The suggestion that {ctx.author.name} has published is that **{suggestion}**',color=discord.Color.pink())
embed.add_field(name = "Message ID",value=ctx.message.id)
message = await ctx.send(embed=embed)
await message.add_reaction(':arrow_up:')
await message.add_reaction(':arrow_down:')
client.run(token)
uhh how do i do this
also the code below is this
thxnx bud
lemme make txt file send u qwhole code
alright
You need to add
await client.process_commands(message) in on message.
do you know anything about hybrid?
Whats that gotta do with anything?
import discord
from discord import app_commands
from discord.ext import commands
from env import TOKEN
class Bot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
intents.reactions = True
intents.typing = False
intents.presences = True
intents.guilds = True
intents.invites = True
super().__init__(command_prefix="!", intents=intents)
async def setup_hook(self):
await self.tree.sync()
print(f"Synced slash commands for {self.user}.")
async def on_command_error(self, ctx, error):
await ctx.reply(error, ephemeral=True)
bot = Bot()
@bot.hybrid_command(name='test', description='Test')
@app_commands.guilds(1099856442686701630)
async def test(ctx):
await ctx.send('Test')
bot.run(TOKEN)```
how to make a certain command
sync to a certain guild
@client.event
async def on_message(message):
if message.content.lower().startswith('hey'):
await message.channel.send(f"Hello! How can I assist you today?")
if client.user.mentioned_in(message):
await message.reply(f"My prefix is '!' if you need more help type '!' help")
await client.process_commands(message)
like this or where
yeah
In await self.tree.sync() you gotta add guild=..
why doesnt my discord code work it gives always invalid token error but the same code runs on github, replit etc!
Okay so i want like 80 commands to be global, but like 5 to be private
thats the goal, so how can i do that?
why replit...
bcoz i can?
same issue
where should i add the line
await client.process_commands(message)
@client.event
async def on_message(message):
if message.content.lower().startswith('hey'):
await message.channel.send(f"Hello! How can I assist you today?")
if client.user.mentioned_in(message):
await message.reply(f"My prefix is '!' if you need more help type '!' help")
await client.process_commands(message)```
Hmmm, well. Im not sure about this one.
😭
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
I'll look into it
did exacly like this uhh
i just dont know how to do it, and its sucks for me cuz im a visual learner right? and everyone just sends me text, and expecting me to understand the most
anywhere in your on_message event, it's up to you to decide under what conditions you want your commands to be triggered
examples help the best for me 😭
GUSY TELL ME
and even tho i do what the text says, it still fails, thats the sad thing
alright u should work for him aha
if they pay me sure lmao
you've probably created a custom help command without removing the built-in one
he did
thats why hes trying to do that lol
Send ur code again.
GUYSSSSSS
who?
ali
Bro shush, we only help if you show us, we arent gonna help if you just beg us?
you gave us no code
alright
beacuse ur token is probably invalid? reset it
and you prolly didnt install libraries
@mystic marsh here is the whole code
solved one error in suggestion thing and this error poped up lmaao
send error
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
change the name of ur command
i saw ur code the code u using is used in .py
ayo ik that tho i dont wanna do that i want help only
https://paste.pythondiscord.com/RHGA
updated code
can u tell me what u updated
changing the name of the custom help command
no not like that i wanna like do help identify the problem why is it doing like this
exactly what do u need to know??
why is this error comming cant i just use help as the one i dont wanna change it helpme or help_command
i want help only and hence how can i do it
the help command u using is used in .py
ok
ty all
@mystic marsh
You’re sure the token is valid, correct?
Remember about guild syncing, if anyone ever asks, this is how you do it, just figured it out basically, just so you can help others if they ask.
import discord
from discord import app_commands
from discord.ext import commands
from env import TOKEN
class Bot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
intents.reactions = True
intents.typing = False
intents.presences = True
intents.guilds = True
intents.invites = True
super().__init__(command_prefix="!", intents=intents)
async def setup_hook(self):
await self.tree.sync()
print(f"Synced global slash commands for {self.user}.")
await self.tree.sync(guild=discord.Object(1154935757631406080))
print(f"Synced guild slash commands for {self.user}.")
async def on_command_error(self, ctx, error):
await ctx.reply(error, ephemeral=True)
bot = Bot()
@bot.hybrid_command(name='test', description='Test')
@app_commands.guilds(1154935757631406080)
async def test(ctx):
await ctx.send('Test')
bot.run(TOKEN)```
discord dpy helped me on this one
again don't auto sync
That's a bad practice
yes i know that, but issue is i gotta figure out how to make it do syncing like that with a sync command, which ill just do later, im tired and wanted to get it done lol
If you could do this then it shouldn't be hard putting it in a command
i just use a flag while running the bot whenever I want to to sync
python main.py --sync does the task for me ( you can use argparse to detect flags)
@bot.command()
@commands.guild_only()
@commands.is_owner()
async def sync(ctx: commands.Context, spec: Optional[Literal["~"]] = None) -> None:
if spec == "~":
synced = await ctx.bot.tree.sync(guild=ctx.guild)
else:
synced = await ctx.bot.tree.sync()
await ctx.send(
f"Synced {len(synced)} commands {'to the current guild.' if spec == '~' else 'globally'}."
)```
something like this should work
just for what i need
You don't need the if else statement
And neither the spec parameter
Just use this command in server for which you have created it
@bot.command()
@commands.guild_only()
@commands.is_owner()
async def sync(ctx: commands.Context) -> None:
synced_global = await ctx.bot.tree.sync()
synced_guild = await ctx.bot.tree.sync(guild=ctx.guild)
await ctx.send(
f"Synced {len(synced_global)} commands globally and {len(synced_guild)} commands to the current guild."
)```
so this?
to where !sync would just do both
instead of doing !sync then doing !sync ~
just make !sync do both and gg easy lol
thanks for reply but it got fixed :))
yeah i noticied that with auto sync
was annoying, but now ion have to deal with that
can you send that sync thing again
that shows when you should sync or whatever it was
imma save that.
where at on the website
is it possible to fetch the avatar of user ?
yes
!discord.Member.avatar
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar)
thats author lol, but yeah
@still spade
@bot.hybrid_command(name="avatar", description="Shows the mentioned members avatar")
@commands.guild_only()
async def avatar(ctx, *, member: discord.Member = None):
if not member:
member = ctx.message.author
embed = discord.Embed(
title=f"{member.display_name}'s Avatar",
color=0x5865F2
)
embed.set_image(url=member.avatar)
await ctx.send(embed=embed)```
i dont wanna copy paste like i wanna do on my own
heres a basic avatar feature, just change bot.hybrid_command to client.command
Wdym in which section?
Thats fair lol
I literally fetched you the docs
W
i m learning thats why if i want to copy paste i would have use open source hehe
nvm
And one more thing avatar returns an asset
!d discord.Asset
class discord.Asset```
Represents a CDN asset on Discord.
str(x) Returns the URL of the CDN asset.
len(x) Returns the length of the CDN asset’s URL.
x == y Checks if the asset is equal to another asset.
x != y Checks if the asset is not equal to another asset.
hash(x) Returns the hash of the asset.
also like can we get what roles user have
and when user joined server and dsicord ?]
yes
!d discord.Member.roles for a member yes
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#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.
you can do that, thats really simple
!d discord.Member.joined_at
An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.
theres a lot of cool things for discord bots
!d discord.Member.created_at
property created_at```
Equivalent to [`User.created_at`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.created_at)
heres an example of one that ive made
This returns datetime object of when acc was created
discord timestamps are better hehe
That also uses datetime object
sh
okay so basically only sync when i update commands right? or when i add commands?
discord just provides a simple way to format it
Can anyone help with me error in a music bot?
update the structure of the command, like name, description, arguments or options
if you just edit your callback code there's no need to sync
!ytdl
Nvm you're not using Ytdl
im using FFmpeg i guess
use import yt_dlp
!d discord.Guild.voice_client You need to access the client using
property voice_client```
Returns the [`VoiceProtocol`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceProtocol) associated with this guild, if any.
They are against ToS
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
i already created 2 command that could “join” and “leave”
and i want to make another command to decide the music going play from storage
How can i fix that error?(where is problem?)
so no more music bots..?
You need to use a guild object instead of just ctx
how?
where should i edit? (First pic is my code)
How would you take out a guild from ctx?
so music bots for youtube is against YouTubes ToS..? thats kinda stupid...
L YouTube moment :/
Not really it's just if they are against ToS you won't get help here
And does anyone even care about ToS
then how can i fix?
Thats a L
so whats the best to use
spotify? cuz my whole bot uses youtubes URLs XD like 😭
I asked you a simple question how can you check in which server the command is used from ctx? That's simplest thing
Also against its ToS
so i should use ctx?
YouTube together exists
Bruh, what..? what music app lets you use their api..?
sound cloud..?
Yep as long as you're not downloading the tracks
Don't know haven't checked SoundCloud
Hm
is extracting counted as downloading 😭
Yeah u need to use ctx but first take the guild object from it
And then use voice_client on it
You can download in memory but not download and distribute
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}```
kinda how i do it for yt, but now i have to completely take that out
i have to use a whole new music app or api
Welp it's your choice
I am expecting some biased answers here, but I'll ask anyways:
A discord.py bot that I host and run for various tasks on my server is long out of date. I am going to do a full rewrite.
Does anyone have some experience/opinions on how I proceed? Discord.py vs pycord vs discord.js
damn, soundclouds api is closed :/
is it posssible done on slash command’s interaction command? (I use enter str to choose songs)
discord.py and discord.js
i prefer discord.py, but js is more popular, but thats up to you
If i have to choose I'll just use discord.py
JS is far more popular for discord bots tho sadly
Yeah interaction is a bit similar to ctx
Dpy is better than pycord
Decide between dpy or djs by the amount of experience you have in python and javascript
im broke ^
Djs except for voice receive has no features that dpy doesn't support
While dpy has many of them like command handlers and views
Does it matter what u use when u know what u are doing?
well
I personally prefer hikari over all forks and dpy lol
XD
so whats the best option for music right now?
Spotify isnt allowed, youtube isnt either, soundcloud has their api closed
Don't know i'd use wavelink
But that also uses yt and spotify to play music
You will need a lavalink server inorder to make it work as wavelink is wrapper for that
It's a lavalink wrapper
https://github.com/lavalink-devs/Lavalink
I told you almost everyone breaks ToS in someway
so what exactly i should add/edit?
(Sry >< I’m not very good in this)
!d discord.Interaction
class discord.Interaction```
Represents a Discord interaction.
An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.
New in version 2.0.
cap, i never break tos my alt wasnt banned for breaking ToS totally...
i broke tos without knowing i broke it, and i just broke it again for using youtube
Check out the above embed i fetched and see how to get the guild object
to many rules, who needs rules? thats for LOSERS, ToS is for losers, get rid of it, lets riot :)
Replying to a bunch of ppl here on mobile, sorry, read what's relevant to you.
I heard there was a time when d.py was not being maintained but now is being picked back up? A lot of migration of bots happened then but unsure if that matters in my case since I didn't touch my bot for that whole duration.
Pycord seems like it's now out of the question since it looks like I can get the same / more support with just d.py
I only did a bit of JS in post secondary, I don't imagine it being too hard to learn. Only think I am worried about is one OCR component to my bot that I will need to learn how to do in JS all over.
https://discord.com/channels/267624335836053506/1162373954963513374
r u possible teach me here?
dpy is back lol, that was a hot minute ago bro
dpy is being developed again
that was like 2021 or sum
it has all latest features as of now
bros way behind 😭
Yeah, haven't touched my bot in years, it just worked lol. Only have a few commands that I needed but was looking to write a new one and clean things up
Let me tell you one thing most of discord api wrappers are a fork dpy
ye
😏 not wyvern
Tbh there is nothing to teach
okay so we all agree to riot youtube? so we can use their api?
It's just a simple solution
I'm in
bet
Nah I'm doing fine as it is
L
Yeah, that's what I heard from reading. dpy was going out, everyone forked it, then it's now back. Don't know what that fragmentation did to the support, but from these replies it seems like dpy is still the best py for discord.
but im still don’t understand what should i edit (sry)
beside i also got some other things want ask (about my other command)
any fork version is usually not the best, so best option use dpy or use js
personal opinion^
Welp discord.py gives you more control than others as far as i know
Exactly what I was looking for, thanks for sharing it
As you have to handle everything yourself so you know what you are doing and what not
dpy just has more support than any fork, the forks are like not as good as ive learned, but its personal preference but i like dpy
And slash command implementation is best as far as i saw
nextcord has good slash commands i think..?
💀 nah man what's a tree and why name slash command as app command, all interaction commands are reffered to as app command by the API
Alright, made up my mind. Going to try d.js just for the learning experience, if I run into too much trouble I'm going to fall back to an updated dpy and you'll see me begging in #1035199133436354600
Thanks all'y'all
Welp it's my opinion I'm not stating a fact
fair
Now how tf does mee6 do this, and im wondering if its possible in py?
ive seen people do it in js, but not py.
U need to use pillow
!pip pillow use the imagine manipulation library
is it easy or annoying 😭
Both
can i ask a question?
im doing pillow image these day
Just state your question instead pf saying can i ask
You can use easy-pil
is it easier tho...?
But it has little features compared to pillow
idk anything about pillow tbh
Its a fork of pillow
question 1 : i was doing image.paste and i found that the image have transparent background cant use paste.image
question 2 : how can i limit the text in a box?
Did you make the image round?
uh
okay so this video is 3 years old, but would this tut still basically work?
In this video, we will learn Image Manipulation with Pillow. We also make an image command like Dank memer using discord.py (rewrite) in 2020.
If you have any suggestions for future videos, leave it in the comments below.
Some Useful Links -
Discord Developer Portal- https://discord.com/developers
My Discord Server- https://discord.gg/TX...
idk how often pillow is changed
Welp i could show you how to do it with easy-pil but not now
no
im learning by this
XD
this is result
how can i force texts in the box? (And make it at middle)
Explain the question 1 a bit first
You can
But honestly you don't need a tutorial for pillow
The code is very simple just look at examples in the docs
oh alr
just never used it, and im a visual learner, so seeing it, helps me better
I still don't get what you mean by can't paste it?
Cool cool, pillow (itself is a fork of PIL) doesn't have any breaking changes in any versions so there should be no problem with the tutorial
this seems really fucking simple imma be real
it could paste but the the picture got no background will automatically add one and how can i remove it?
told ya
Then u should make a habit of reading
You will need to create a mask on it first
how?
yes i try, issue is i suck at reading, i cant focus while reading, ADHD fucks me over in that aspect 😭
when im coding im focused, when im reading im not :/
i was doing like this
Welp u should try to focus on reading as you will need to do alot of it if you are trying to get into the field
yeah sadly, right now im learning cpp
my main goal is game development and maybe game hacking
wheres a good spot to get a welcome image 😭
rgb?
welcome channel?
Red green blue
yah i know that
welcome message kinda like mee6
Google or you can use canva to make your own
it not pretty undestand it
god im ass at canva 😭
Just make sure your image has low pixels that way your image will take less time to process
Making your code faster
imgs r small i guess
but im not pretty sure how should i make it
Well it's a bit complicated process
😭
But I don’t understand it 💀
I just use easy-pil since most i have to do is make the image round or just put a text nothing fancy
Then can i use some other way instead of that?
alr
then i might will try it next time when my friend online, then how can i fix the text problem?
oh ok , didn’t know that channel exist
i might could help if i free
this is easy to me
i suck as design 😭
it cost a little time
OCD, so when i make anything, my brain just makes me think it looks bad in some way
I usually do it when i got bored in class
paid or free?
free
W
i love drawing
supporting the poor out here, get this man a raise :)
There is an anchor and align arg in ImageDraw.text
You need to use either one of them
To center the text
I'm not sure which one tho
wdym?
Like the line where you put text on the image the text functions accepts anchor and align argument you need to use that
oh
ok
how can i fix this error?
dam nice i m trying to create like this hehe
XD
It's keyword-only arg
Iirc set_thumbnail(url=guild.icon.url)
You should at least tell why using url on icon rather than spoon-feeding
Yes it is
embed.set_image(url=member.avatar)
avatar is also an asset
imma make you an asset
K
Also yeah that's not really spoonfeeding
for role and top role can u share me the documantation @vapid parcel
For some might be if they don't know what's key-word and positional
Giving code for person to look at is much more efficient than spending 15 minutes trying to explain basic concepts, if person is a beginner they will get there eventually
Fixed ty
1 line is not a big deal anyways
Can be in some cases
ask @turbid condor
i made my userinfo a long time ago
he knows the documantation :)
!d discord.Member.roles for all the roles
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#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.
!d discord.Member.top_role
property top_role```
Returns the member’s highest role.
This is useful for figuring where a member stands in the role hierarchy chain.
This for top role
w
thnx bro
I don't know any documentation it's just most of the commonly used stuff
yeah my userinfo command is at the top
so i made this shit a long time ago, i have 88 commands in my bot 😭
which one is one of the hardest for u to create ?
command?
prolly level system, i made a whole level system in my bot, thats prolly the hardest ive made, besides the music part of my bot which has to be taken out.
(haven’t worked on the fuction part)
next i m creating music system
what app?
yt
against ToS
epic tos breacher
yep
me when !ytdl
ok then which one is allowed ?
yeah
Put parenthesis next to RoleView i believe that's the class name
none
ok my bot will have no music then
good choice
YEAHHHHHH i made a whole music for no reason

ahaha
L youtube.
i was creating music bot for my portfolio tho
which line?
74
Yeah you forgor to instantiate view
so
😭
lets all agree on raiding youtube tonight?
and like allow us to use their music for discord bots? and if not we completely NUKE them and end their company? joking totally...
Attacking youtube would require a botnet of quantum computers
Ah you mean like 💥 🦅
Did this server had a Balkan programmer?
Wtf is balkan programmer
Everything alright in here? 
yes..
yes
Yeah hi robin ☺️
dont tell youtube we are nuk- NOT nuking them
Is there anyone from the Balkans here?
balkans..?
ok lemme do my bot work now i m already tired lemme get more tired for a peaceful sleep
it worked ty
is there anything i should know about give role fuction?
Nah an evil plot is being made here
everything
nuh uh, hes lying, ban him
why does that matter here?
Idk just asking
What more do you want to know?
!ot off topic is for just asking
Please read our off-topic etiquette before participating in conversations.
how should i give role?
(I haven’t checked any tutorial yet, just asking)
we arent off topic, idk what you mean
we were talking about music bots and nuking youtube for not letting us use their api, clearly on topic imo
Ok
im literally reviewing it now
how do u write the txt have link?
Thanks 🤗
!d discord.Member.add_roles
you cant
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/latest/api.html#discord.Role)s.
You must have [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles) to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role)s must appear lower in the list of roles than the highest role of the member.
[text](link)
k
that simple XD
k
Similarly there is a remove_roles function too
i should change “*role” to id?
No you will need to get the role first
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
Changed in version 2.0: `role_id` parameter is now positional-only.
/ is id?
what is coding master talking abt
Use this to get the role first
im so lost?
random off topic stuff we can fully ignore
So i should put id in "/"?
wait what
what are you doing?
security bots are usually closed source
the good ones, anyway
yeah, i only have anti spam, anti discord links and anti raid
