#discord-bots
1 messages · Page 296 of 1
anyways can you see why its not in the apps menu
because you are dumb
ur the one tryna self bot
We dont use such language here buddy
waaa waa
I do
So please stop asking questions about this project, we wont help with it
no
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
mate i honestly dont care about your little self bot mate
I dont see a reason why it wouldnt appear in Apps
its strange
no
right. just leave the server if u aint gonna abide by the rules
i dont care if you dont care
whine
what in the…. not even a 11 year old would say that
what
Well if you wanna take the hard way
<@&831776746206265384> can you please apply some infraction
Your underage… NO ONE and i mean NO ONE above 13 would say i dont care if you dont care
you said "i dont care".... so? if you dont care, i wil still speak.
Because i dont care if you dont care
I am underage? You said "your"

mate im just trying to get help with a command, i honestly dont care about youre silly little argument
hhaha this guy
🤣
L||ol||
Anyways @onyx elk are you sure you invoke it on Member and not Message?
@finite sage that's no way to talk to people in this server, and we don't help with selfbots.
it is bot
wait member?
Yes its context menu for Member
👍
The only reason you'd get that error is if your token isn't a valid bot token, i.e its either straight-up invalid, or is a user account token - and you also said above that its a selfbot
haha
i dont know
that code is not wrong, i dont know why i get error. I use it 2 months ago and it work
Well the error says wrong token. So whatever token you're using isn't correct according to discord
Idk why you're so adamant that it's correct when the error coming from discord says otherwise. Maybe because it's being pasted, the encoding isn't what the system expects so you have unknown characters
If it would be correct you wouldnt get such error 🗿
I don't know why you think I would come in and lie for no reason
I dont know why you think library would raise exception when you provided valid token
I don't know why
Ok, here is discord telling you your token is wrong. You came here for help man, stop acting like you're better than everyone when you're here troubleshooting some code you copied and pasted
Cause its incoreect
That is why I made the post
It is not wrong

And that's why it's an improper token. User accounts aren't supported.
So you just admitted 4th time its self bot
Use a PROPER token and it'll work
While saying its not
I cloned a server with a user
And you've been told that we don't help with selfbots 10 times as well
It is not selfbot
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
i mean this should come to an end <@&831776746206265384>

Please dont ask questions about this project anymore
It is not illegal
They already been here haha
Still against rules
and it is not selfbot, stop lying or I will report you for defamation
No
yeah I saw but they didn't do anything
Sure go ahead
It's just another script kiddy lmao
No
!shh
✅ silenced current channel for 4 minute(s).
!warn 915149040931463218 We will not help with self bots. You have been told this previously. Using your user token to automate your account is selfbotting, which is bannable both here and by Discord
:incoming_envelope: :ok_hand: applied warning to @finite sage.
✅ unsilenced current channel.
🙏
can I use channel.edit for renaming threads? (in disnake)
thanks
yes
!d disnake.Thread.edit
await edit(*, name=..., archived=..., locked=..., invitable=..., slowmode_delay=..., auto_archive_duration=..., pinned=..., flags=..., applied_tags=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the thread.
Editing the thread requires [`Permissions.manage_threads`](https://docs.disnake.dev/en/latest/api/permissions.html#disnake.Permissions.manage_threads). The thread creator can also edit `name`, `archived`, `auto_archive_duration` and `applied_tags`. Note that if the thread is locked then only those with [`Permissions.manage_threads`](https://docs.disnake.dev/en/latest/api/permissions.html#disnake.Permissions.manage_threads) can unarchive a thread.
The thread must be unarchived to be edited.
Pass name ^
thanks!
👍
All these in this channel are dumb
Dude just drop it
What
Either you're pasting the wrong thing in as the token, or you're lying about not trying to run a selfbot
Where are you getting the token from?
From the console
which console?
no that is for bot
from within the discord app itself? that's going to be your user token, which bots don't work with
Thats the whole point
That's why you're having problems. You're trying to use a bot without a bot token.
If you are not using a bot account, you are self botting
No I am not self botting
The token is that one for my account
not the BOT
That is the definition of self botting
Why I did not break the rules
Automating normal user accounts (generally called "self-bots") outside of the OAuth2/bot API is forbidden, and can result in an account termination if found.
But they will not find out hahah
!ban 915149040931463218 seeking help for self botting
They won't find out because you can't run your code
:incoming_envelope: :ok_hand: applied ban to @finite sage permanently.
Finally
lmao
its not working, im not sure if Im doing anything wrong
I robbed the bank but no one will know that i did it, so i didn't break any rules
Check your bot console
How can my bot send a dm after a slash command ?
!d discord.User.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) objects. **Specifying both parameters will lead to an exception**.
!d discord.Interaction.user
The user or member that sent the interaction.
YO I GOT AN EMAIL SAYING IM OFFICIALLY UNBANNED FROM DISCORD DEVELOPER BADGE LETS GO
error : ``` await user.send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)
SyntaxError: iterable argument unpacking follows keyword argument unpacking
You are not supposed to copy paste the docs signature
oh
Its only there to show you what arguments it takes
so what do i need to write in my code if its not that
that was my question
or i will reformulate it
You use .send method on User you want to message
i have a mute slash command and i want my bot to send a dm to the persons mentioned in the mute command
await interaction.member.send(embed=embed)
@lyric sigil
u dont gotta do embed
it may not work if u have member differently although idk why u would
Its interaction.user
await interaction.user.send(embed=embed)

oh
user or User ?
i have done member and it works
as it is in message
user
thx
Maybe in other lib
i use discord.py u?
No such thing
Not even in disnake
discord.app_commands.errors.CommandInvokeError: Command 'mute' raised an exception: AttributeError: 'Member' object has no attribute 'member'
Show code
but idk why my mate found this command that use ctx
@client.tree.command(name="mute", description="add role 'mute' to someone")
async def mute(ctx, member: discord.Member):
# Rôle "Muted"
muted_role = discord.utils.get(ctx.guild.roles, name="Muted")
newbie = discord.utils.get(ctx.guild.roles, name="Newbie")
if not muted_role:
muted_role = await ctx.guild.create_role(name="Muted")
# Apply Restriction
permissions = discord.Permissions(send_messages=False, speak=False)
await muted_role.edit(permissions=permissions)
# Add "Muted" to member
await member.add_roles(muted_role)
print((f"{member.mention} Has been Muted."))
discord_channel=1139570394089660470
channel = client.get_channel(discord_channel)
await ctx.user.member.send("Test")(content=None)
await channel.send("User Muted :white_check_mark:")
await member.remove_roles(newbie)
@client.tree.command(name="name")
It makes sense. You have to be in guild to use interaction so there doesn't need to be any distinction
Why you do ctx.user.member?
Like i said its .user only
cuz interaction.user.send won't work
So if something wont work you add random attributes that doesnt exist?
ik but this one works with ctx
So your ctx varriable is actually an Interaction
yes but since interaction not defined that won't work
?
Didn't you originally ask how to send a message to a user after using a slash command
yes but my slash command use ctx
hold on
@client.tree.command(name="commands")
async def commands(interaction: discord.Interaction):
embed=discord.Embed(title="IG-Commands", description="/sethome homename (sets an home) \n \n /home homename (teleports you to your home) \n \n /hub (teleports you to the hub)")
await interaction.response.defer()
await interaction.response.send_message(embed=embed)
Just print out type(ctx)
this one use interaction
I see that you put ctx at the top, but you still need an interaction because that's what a slash command is
@client.tree.command(name="mute", description="add role 'mute' to someone")
async def mute(interaction: discord.Interaction, member: discord.Member):
# Role "Muted"
muted_role = discord.utils.get(interaction.guild.roles, name="Muted")
newbie = discord.utils.get(interaction.guild.roles, name="Newbie")
if not muted_role:
# Create the "Muted" role with necessary permissions
muted_role = await interaction.guild.create_role(name="Muted", permissions=discord.Permissions(send_messages=False, speak=False))
# Apply the "Muted" role to the default text channels (optional)
for channel in interaction.guild.text_channels:
await channel.set_permissions(muted_role, send_messages=False)
# Add the "Muted" role to the member
await member.add_roles(muted_role)
print(f"{member.mention} has been muted.")
# Send a DM to the muted user
embed = discord.Embed(title="You have been Muted", description="You have been muted in the server.")
await interaction.user.send(embed=embed)
# Send a message using interaction response
response_embed = discord.Embed(title="User Muted", description=f"{member.mention} has been muted :white_check_mark:")
await interaction.response.send_message(embed=response_embed)
# Remove the "Newbie" role (optional)
await member.remove_roles(newbie)
and this one ctx
And the other one uses too
try a little of this
We dont spoonfeed here
and i didnt ask for but thx
its not spoonfeeding just a little ediyting his message
Giving exact solution as code is literally spoonfeeding
Nah
No matter if you changed 2 lines or 20
no way that's working
fr i made editted it
Using the modified code i figured to create an unmute one thx
My discord bot is not showing me correct stats. What should I do?
you could try fixing it
send the code
could u send code maybe?
You have members intent enabled?
You're declaring the variables on a global scope that is processed only before the bot starts ( hence cache and ping are empty/Nan), move them inside the scope of function where you send the embed
okay guys
how do i get author.id from interaction?
i discovered that there are two different ids that don't matches
self.client.user.id returns a different id from ctx.author.id
or do i use self.cliient.author.id?
client => your bot, you probably don't want your bot's ID
ctx.author returns the user that used the command
yeah, exactly
i want user id
like who sent the interaction
So author ID is, as you've guessed - the other one
oh okay
And I said: the other
where do you see self.bot.author.id in that message
okay so since in my case i'm in an app_command
i need an alternative way to grab user id
like, there is no context
so there is discord.Interaction
so i don't know how to grab in a slash command without nexting
*nesting
@_character_default.app_command.command(name = "image_set_by_prompt",)
async def _character_default_image_set_by_prompt_slash(self, ctx: discord.Interaction, prompt: str, image1: discord.Attachment | None, image2: str | None):
user = discord.Interaction
url = image1.url if image1 else image2
result = await self.client.database.quick_search_default_character(user_id=user, prompt_prefix=prompt, new_image=url)
if result is None:
await ctx.response.send_message(f"you have no characters with prompt {prompt}")
else:
await ctx.response.send_message(f"image set to {url}")
i'm trying to grab user id here
character_default
what game is this for
that's a roleplay character
it's a super tool for discord roleplay servers
roleplay super tool
i'm trying to grab the member user id
what do you need userid for
You shouldn't name discord.Interaction objects ctx, by the way
!d discord.Interaction.user
The user or member that sent the interaction.
i wonder if you like cats 
!d discord.Interaction.user gives you the User/Member object who used the command
The user or member that sent the interaction.
Since you named your interaction ctx (which is weird) it would be ctx.user.id to get the id
Most people name their discord.Interaction 'interaction' to make life easier for everyone
can i use google sheets as database for example saving name of users and a amount os money for example?
no, no and no
You will run into rate limiting issues, data corruption, etc etc
Use an proper DB such as SQLite or Postgres
https://sqlbolt.com/ is the to-go place to learn SQL
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
General choices for SQL databases:
sqlite- a liteweight SQL variant, single file, no server. Lacks some features. The choice of driver for this is asqlite
postgresql - Standard-weight SQL server, very capable, good sql lib. The choice of driver is asyncpg
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
@meager rock @onyx elk
yea?
Explain your intent
okay so how do i check if the author is a webhook?
!d discord.Message.webhook_id won't be None if the message was sent by a webhoom
No documentation found for the requested symbol.
If this message was sent by a webhook, then this is the webhook ID’s that sent this message.
what's the function to revoke someone's timeout ? (i coulnd't find in the docs and sof)
!d discord.Member.timeout
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta).
You must have [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members) to do this.
This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit).
None
Just set the timeout until to none
oh ok thanks
until (Optional[Union[datetime.timedelta, datetime.datetime]]) – If this is a datetime.timedelta then it represents the amount of time the member should be timed out for. If this is a datetime.datetime then it’s when the member’s timeout should expire.** If None is passed then the timeout is removed.** Note that the API only allows for timeouts up to 28 days.
okay guys how do i grab by code the message response?
i'm planning this for responding to a person, edit a webhook message or switch webhook name by erasing it and re-writing the message inside an embed
maybe i also need to grab description from embed
also thanks for that
now my bot won't grab webhooks
Traceback (most recent call last):
File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 124, in wrapped
ret = await coro(arg)
File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 982, in _invoke
await self.callback(ctx, **kwargs)
File "c:\Users\Medra\Desktop\kalker\main.py", line 384, in memberinfos
if member.joined_at == None :
AttributeError: 'User' object has no attribute 'joined_at'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 375, in invoke
await injected(ctx)
File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'User' object has no attribute 'joined_at'```
Pretty sure that discord.User doesn't have that
Yes but i mean how can i know if a specific user ever joined the guild
joined_at is an attribute of discord.Member
It's impossible for a user to have joined_at
oh ok my bad
Why is your User object called member
let's use if statement to check if he's in the members list
Just check if its type is Member?
just like that bcz i'm trying to speed up
no i mean i have a project to start and i lost all my scripts when i finished them all
now i'm trynna speed the process up to open this project
Reason to use github
yes 😹
okay so?
i'm planning to do this
my code grab the message i'm responding
!discord.Message.interaction
!d discord.Message.interaction
The interaction that this message is a response to.
New in version 2.0.
!d discord.Message.reference Is this what you mean
The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.
New in version 1.5.
thanks
thought
how do i manipulate this i don't know
but i'm not memeing, you really helped me
im trying to fix my code but idk why it wont send the embeds to the channels in that file
embed = discord.Embed(title=game['title'], description="", color=discord.Color.blue())
embed.add_field(name='', value=description, inline=False)
embed.add_field(name='', value="", inline=False)
embed.add_field(name='Price:', value=price_text, inline=False)
embed.add_field(name='', value="", inline=False)
embed.add_field(name='Expires:', value=timestamp_format, inline=False)
embed.add_field(name='', value="", inline=False)
embed.set_image(url=game['keyImages'][0]['url'])
embed.add_field(name='** **', value=f"** **", inline=False)
embed.add_field(name='** **', value=f'[Support](https://discord) **-** [Add Me](https://discord.com/api/oauth2/authorize?s) **-** [Donate](h)', inline=False)
with open('epicenable.txt', 'r') as file:
channel_ids = file.read().splitlines()
for channel_id in channel_ids:
channel = bot.get_channel(int(channel_id))
if channel:
try:
await channel.send(embed=embed, view=epic)
except Exception as e:
print(f"Error sending message to channel {channel_id}: {e}")
except Exception as e:
print(f"Error fetching data from Epic Games Store API: {e}") ```
no errors
Check the docs for the MessageReference class and see what you can do with it
what does this return me?
this one is confuse
MessageReference.cached_message
hello can you help me ? ```py
import discord
from discord.ext import commands
class serverinfo(commands.Cog):
def init(self, bot: commands.Bot) -> None:
self.bot = bot
@commands.Cog.listener()
async def on_ready(self) -> None:
print("commande serveur info charger [2]")
@commands.command()
async def serverinfo(self, ctx: commands.Context) -> None:
boost_count = guild.premium_subscription_count
boost_level = guild.premium_subscription_level
channel_count = len(ctx.guild.text_channels)
vocal_channels = [channel for channel in ctx.guild.channels if isinstance(channel, discord.VoiceChannel)]
vocal_count = len(vocal_channels)
guild = ctx.guild
embed = discord.Embed(title=f"serverinfo", description="voici les information du serveur", color=0xffffff)
embed.add_field(name=f"Nom du serveur", value=f"{guild.name}", inline=False)
embed.add_field(name="Membre", value=f"{guild.member_count}", inline=True)
embed.add_field(name="ID du serveur", value=f"{guild.id}", inline=True)
embed.add_field(name="Nombre de channel", value=f"{channel_count}", inline=True)
embed.add_field(name="nombre de vocal", value=f"{vocal_count}", inline=False)
embed.add_field(name="Nombre de boost", value=f"{boost_count}", inline=False)
embed.add_field(name="Level du serveur", value=f"{boost_level}", inline=False)
embed.set_footer(text=f"by Space")
await ctx.channel.send(embed=embed)
async def setup(bot: commands.Bot):
await bot.add_cog(serverinfo(bot))```
when I do +serverinfo laf command does not display anything on the terminal or on the channel
so, whaht is the problem?
returns the message being replied to (reference) if it's cached
@severe sonnet
i think you forgot the ctx in guild @eager mural
cus boost_count and boost_level don't have much association
no
what is guild then?
oh sry
it's suppose to be ctx.guild
import discord
from discord.ext import commands
class serverinfo(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@commands.Cog.listener()
async def on_ready(self) -> None:
print("commande serveur info charger [2]")
@commands.command()
async def serverinfo(self, ctx: commands.Context) -> None:
boost_count = ctx.guild.premium_subscription_count
boost_level = ctx.guild.premium_subscription_level
channel_count = len(ctx.guild.text_channels)
vocal_channels = [channel for channel in ctx.guild.channels if isinstance(channel, discord.VoiceChannel)]
vocal_count = len(vocal_channels)
guild = ctx.guild
embed = discord.Embed(title=f"serverinfo", description="voici les information du serveur", color=0xffffff)
embed.add_field(name=f"Nom du serveur", value=f"{guild.name}", inline=False)
embed.add_field(name="Membre", value=f"{guild.member_count}", inline=True)
embed.add_field(name="ID du serveur", value=f"{guild.id}", inline=True)
embed.add_field(name="Nombre de channel", value=f"{channel_count}", inline=True)
embed.add_field(name="nombre de vocal", value=f"{vocal_count}", inline=False)
embed.add_field(name="Nombre de boost", value=f"{boost_count}", inline=False)
embed.add_field(name="Level du serveur", value=f"{boost_level}", inline=False)
embed.set_footer(text=f"by Space")
await ctx.channel.send(embed=embed)
async def setup(bot: commands.Bot):
await bot.add_cog(serverinfo(bot))
@eager mural there
okay, that is strange
do you know the error?
with my limited knowlege no
okk
thought i need help with MessageReference
i have the object but i don't know how to manipulate it
i have thi
*this
but i want is to grab the message content
like user name, ping and message
the basic code works just when I add the guild boost etc.
embed = discord.Embed(
title="title",
description=text
how do i make an text under "test"
I see no test here
already found an soulution 🙂
the pic i sent is pretty useful for knowing the different components of a discord embed
yes! i looked up what u can dowith embeds
So, I have a issue where i have an embed with button code which works alright when I used in replit but when i switched it into a technically faster host, the same code doesnt work. it sends the embed and the button but whenever its clicked gives me the unknown interaction error
https://paste.pythondiscord.com/XYTQ
how can I use auto mod in my bot
discord.AutoMod
did you not read the docs?
yes
nope
lemme run the ?rtfm command
why is your view nested within your command
that's not how it works
ok
AutoModAction is probably what you are looking for
is that an object?
do you even know what's the difference between an object and class?
yeah
There is no difference..?
wrong mate
So you're saying that classes aren't objects?
they aren't. If you learned Java, you will end up realizing that
Well this isn't Java.
this is python
the point is, in both lanauages, they work pretty much the same
a class is a blueprint, and an object/instance is that class running in memory
they get used when on_automod_* events happen
now within your guild, you can create automod rules
horrible codework but it worked?
should i put it outside
what args does it passs
yes
rtd
xdd
lol rtd stands for read the docs
😭
oh
that's the actual term btw
well uh ill check one sec
and also why use pymongo?
and there is no need to delay the command by 30 seconds
Name, Type, Image, Number, Logo, CarImage, Series, Max, Game = RandomALL()
RType, Style, Icon = GenRarity()
What the hell are even these variable names?
pep8 pep8 my dude
!d discord.User
dont ask its goofy
well its pretty fast usually..
usually
i mean with the newer host its like practically fast
i know my bot is shittingly messy
What have you got so far?
ok
Join vc channel command
@bot.slash_command()
error async def join(interaction: Interaction):
if interaction.user.voice:
channel = interaction.user.voice.channel
await channel.connect()
else:
await interaction.response.send_message("You are not in a voice channel")
print(f"I joined: {interaction.user.voice}")
The spot where error is is a error
Idk why
maybe share the error
imagine if its actually
error async def in code
new python keyword
3.14 reveal
bro lives in 3000
Whats this 😭 i fixed old error
pie-thon
pip install -U "discord[voice]"
iirc
zsh user?
Should i put that in my code?
no you need to run this command
no :(
i use zsh
thought so cuz of the "
i use fish
normally you can simply use discord.py[voice] but it would error out in zsh
iirc it error out in fish too
maybe, yet to try fish
it's good
@torpid dew
yeah it's discord.ext.commands.Bot
print this to console discord.__version__
Ok
It printed 2.3.2
@slate swan
Fastest way to solve it will be to run this script: #discord-bots message
Shell?
On shell?*
Nope its python script
Ok
Should i remove script after i execute
its to run only once
I did it doesnt work idk
It think snipy ruined my code
from discord.ext import commands
bot = commands.Bot(...)
``` discord doesn't include commands ( and tasks ) package in the discord.ext package so using it directly won't work
Ok
tf there's a clone of mine
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.
But why it doesnt work
command_prefix is required
You need to provide a prefix in it
intents too
How
Im just a starter sorry for many questions
so you don't know how to pass parameters to functions and classes
Whats that
!intents here's an example
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.
There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.
Afterwards in your code, 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
# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.
why is this example still using command_prefix as a kwarg lol, some linters might get angry
if you use only slash commands then use discord.Cllient instead
it will ask you only for intents
Ok
How do i install discord.client
!d discord.Client
class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.
async with x Asynchronously initialises the client and automatically cleans up.
New in version 2.0.
A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client).
i mean you have it already
Ok
you just need to use it
Is this good?
no
bot is not defined, also aclient_command doesn't exist
and why are you waiting the client to be ready in the on ready?
Uhhh
Bro my brain isnt braining anymore
there's a lot of mistakes in your code
Can you help pls
why use aclient_command
Idk
for me, i rather go with the default one instead of using classes
yeah ic 😔
Can you define bot for me
Thats all i need and i can fix other stuff
follow this example https://github.com/Rapptz/discord.py/blob/master/examples/app_commands/basic.py
ngl you should learn a bit of python first
we said that if you want to use only Slash commands there's no need to use a Bot, use a Client instead
bot = commands.Bot(command_prefix="!", intents=intents)
this is the basic way to define bot
What does the thing mean by guild id
Server guild id or user?
wrong ping?
well guild id means guild id so in common discord users language: server id
Send the code
Is it too large to type here?
yep
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
Read that embed 
None of your commands are slash commands they're text commands
Are you saying they don't show anything when you use them?
like
i run it and type / i dont see the bot commands
how do i make them slash commands
Because they aren't slash commands
Check out how the slash commands here are made
https://discord.com/channels/267624335836053506/1139753110244434021
Bot.tree.command() and interactions
Look at the last block of code there where it starts with @bot.tree.command()
that?
bot/exts/utilities/rfc.py
uh
omg
ive been trying to do it for 1-2 monthz
😭
Here's some other good examples
I'm not going to make it for you
ok
Also, delete your token from the last line of this
done
wait
@mighty pilot https://paste.pythondiscord.com/FUQQ
thats what happened when i added the slash cmd
Did you read it
It's expecting an indented block
Like
This```
u mean the spaces?
4 spaces is one indent
The generate_lineup_image function is empty, add something to it
Python always expected functions to have something in it
k
(comments don't count)
I ADDED SPACES BUT IT STILL SAYS THE SAME THING
!e
def a_function():
@a_deco()
def another_function(): ...
@naive briar :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 3
002 | @a_deco()
003 | ^
004 | IndentationError: expected an indented block after function definition on line 1
Same error, same solution
ok fixed that
xd
but new error
@naive briar @mighty pilot can u also help me solve this xd
Just wait for someone to answer
Are you using disnake?
ppy
I've only used discord.py so anything aside from that I'm unfamiliar with. It's saying line 2 , that location doesn't exist that you're trying to import
I understand the language is python
should i try that:
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_option
there is no interactions module in discord.py as far as i am aware there is however an Interaction class
!d discord.interactions.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.
what are you even trying to do?
card bot
yeah i meant in ext
He's trying to take someone's text command bot and make it slash commands
ic
ye
Doesn't fully understand what's going on so at this point it's hitting run and finding the next error
okay guys, how do tupperbox have the user who sent the tupper stored?
i need that for when a person needs to edit a webhook message
i don't know how tupperbox keep track of who sent the webhook
through the bot
That sounds like a question for the devs of that bot
unless i store their message ID
like a log
so peoples can edit the message related wqebhook
*webhook
Can anyone help me
can someone help in #1147522637522812958
whats the method for creating a channel
can you show the code, but that should mean that there's no mines command or you didn't create it properly (correct me if im wrong)
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, news=False, 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/latest/api.html#discord.TextChannel) for the guild.
Note that you must have [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels) 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) of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role)) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#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/latest/api.html#discord.TextChannel.edit) will be required to update the position of the channel in the channel list...
how do you define a guild again
you either get it with an api request or using the Context or Interaction objects
how do you do it with interaction
!d discord.Interaction.guild
property guild```
The guild the interaction was sent from.
so its just
guild = interaction.guild
```?
yep
server
@glad cradle how do i make the bot join VC
!d discord.VoiceChannel.connect
await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>, self_deaf=False, self_mute=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceClient) to establish your connection to the voice server.
This requires [`voice_states`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.voice_states).
Tysm
How do i make it join the exact channel i want
so my bot can create a guild? that makes the bot the guild owner? even though you cant manually transfer leadership to a bot account
you get that Channel object
So is discord.Voiceconnect for the bot to join a random voice channel or the voice channel im in
a Bot can create a guild tho i haven't ever tried it so i can't answer to the latter question
guess im gonna try it out and see what happens lol
no, VoiceChannel is the python representation of a discord voice channel, using a specific object and calling the .connect method you can join and connect to it
i suggest to learn python OOP before trying to build a Bot https://realpython.com/python3-object-oriented-programming/
do you know what the code argument is when creating a guild like that? it just says "The code for a template to create the guild with."
#1147522637522812958 help pls
lemme check the docs
nvm i think its supposed to be a link to a server template which you can generate in server settings
or the code inside the link
oh what you're referring to is a guild template link yep
How do i define ctx
sigh, you don't define it, you get it in a command
the library creates it and pass it as a command argument
wtf
!d discord.Embed.set_thumbnail
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing `None` removes the thumbnail.
my man
ty
it doesn't work like that at all
!d discord.Guild.icon
property icon```
Returns the guild’s icon asset, if available.
embed.set_thumbnail(url=guild.icon)
guild.icon.url
yes
import discord
from discord.ext import commands
class serverinfo(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@commands.Cog.listener()
async def on_ready(self) -> None:
print("commande serveur info charger [2]")
@commands.command()
async def serverinfo(self, ctx: commands.Context) -> None:
guild_icon = ctx.guild_icon.url
boost_count = ctx.guild.premium_subscription_count
boost_level = ctx.guild.premium_tier
channel_count = len(ctx.guild.text_channels)
vocal_channels = [channel for channel in ctx.guild.channels if isinstance(channel, discord.VoiceChannel)]
vocal_count = len(vocal_channels)
guild = ctx.guild
embed = discord.Embed(title=f"serverinfo", description="voici les information du serveur", color=0xffffff)
embed.add_field(name=f"Nom du serveur", value=f"{guild.name}", inline=False)
embed.add_field(name="Membre", value=f"{guild.member_count}", inline=True)
embed.add_field(name="ID du serveur", value=f"{guild.id}", inline=True)
embed.add_field(name="Nombre de channel", value=f"{channel_count}", inline=True)
embed.add_field(name="Nombre de vocal", value=f"{vocal_count}", inline=True)
embed.add_field(name="Nombre de boost", value=f"{boost_count}", inline=True)
embed.add_field(name="Level du serveur", value=f"{boost_level}", inline=True)
embed.set_thumbnail(url=guild.icon.url)
embed.set_footer(text=f"by Space")
await ctx.channel.send(embed=embed)
async def setup(bot: commands.Bot):
await bot.add_cog(serverinfo(bot))```
Can you correct it?
looks good to me
I have no error and nothing appears
ctx.guild_icon.url ?
hold on we're saving bro from future errors
ok
no
I don't know how to save bro then
i dont get an error with the on_command_error event
show me that
the code works without the embed.set_thumbnail(url=guild.icon.url) and launches
@bot.event
async def on_command_error(e):
print(e)
bro ?
I dunno
how do i edit the own bot message or webhook by the own bot code?
Note: The message contains Enbed
*Embed
you wanna edit the embed?
i see
change its value end then edit with the edited embed object
how edit command works?
!d discord.Message.edit this?
like, is there a command that edit messages
await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) instead of `InvalidArgument`.
refetch?
discord/message.py line 991
data = await self._state.http.edit_message(self.channel.id, self.id, params=params)```
@client.event
async def on_message(message:discord.Message):
if any(x in message.content for x in blockedWords):
await message.delete()
await client.process_commands(message)
@client.event
async def on_message(message:discord.Message):
if message.author == client.user:
return
pattern = re.compile(f"<@!?{client.user.id}>") # The exclamation mark is optional
if pattern.match(message.content.lower()) is not None: # Checking whether the message matches our pattern
await message.channel.send(f"**I am going to implode.** {message.author.mention}" , reference=message)
I have a problem with my code , i have this 2 client.event and only one is working
Both have same name
Of course. You are just overwriting first with second
x = 5
x = 3
don't you expect x to be 3 and 5 and the same time?
So 2nd one overrides the first function
!d discord.ext.commands.Bot.listen
use this with name arg
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready)
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Example...
so if i wrote on_message2 its gonna work ?
Use the method told by vitness above
no, because such event doesn't exist
yes that was what i was thinking
And use listen() instead of event
so like this ?
@client.listen(name="words")
async def on_message(message:discord.Message):
if message.author == client.user:
return
pattern = re.compile(f"<@!?{client.user.id}>") # The exclamation mark is optional
if pattern.match(message.content.lower()) is not None: # Checking whether the message matches our pattern
await message.channel.send(f"**I am going to implode.** {message.author.mention}" , reference=message)
name should be the name of the event

and function name anything you want
mention 
@client.listen(name="mention")
Nope
there is no such event
what
on_message
yes
Xd
it's the name of the event
i need to rename it with listen ?
I want to make a bot to mess with people on April fools. Right now I have 1/10 chance for a sent message to delete, and a 1/10 chance of the user getting a 1 minute timeout. Trying to get 8 more functions anybody got ideas?
@bot.listen('on_message')
async def f1():
so if i want to do another i will name it f2 ?
ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 86, in on_message
discord.Message.reference.resolved.edit(embed=embed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'member_descriptor' object has no attribute 'resolved'
Yes
okay thanks guys
Send the code for this event
You need to use it on Message instance, not the class 
elif message.content.startswith("##edit->"):
belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
if belongs_to:
edition_message = message.content.replace("##edit->", "")
embed = discord.Embed(
description=edition_message
)
discord.Message.reference.resolved.edit(embed=embed)
I made a bot that would auto move yourself and move the other person back if moved in channels since people were annoying with it.
@turbid condor this?
You can force users to a different channel?
That isn't the relevant part
that's crazy
If they are in a voice channel, yes.
it is
Vc isn't used much in my server, that's a good one though
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
discord.Message.reference.resolved.edit(embed=embed)
.
in our server sometimes people asked to be moved when they played 2v2 in brawlhalla and couldn't go to another voice channel in the moment
https://paste.pythondiscord.com/NDAA
ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 86, in on_message
discord.Message.reference.resolved.edit(embed=embed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'member_descriptor' object has no attribute 'resolved'
that would be impossible
what message do you want to edit
where would you get the message object from
@mighty pilot don't have good idea's with text channels..
this one:
do you want to edit it in the same command that that was sent in
like after a couple seconds
Could I force them to join a vc if they aren't in one to begin with?
No that's impossible.
Ah damn. I could play jeopardy music on repeat and randomly make people join lol
stalking on another level
imagine someone's having sex and you make them join a voice channel
Im making review system
Can someone explain my mistakes ? I need to send last Review author , in embed
But it sends only first review author
so when you do send you're gonna save the message and then use that message object you sent
message = await ctx.send(embed=discord.Embed(title="1"))
embed = message.embeds[0]
embed.title = "2"
await message.edit(embed=embed)
this would send an embed with title 1 then edit it to 2 directly
thought i'm grabbing the message to edit by reference
like this
this response should edit my message
it would edit this message
but that wouldn't be in the same command
it's only possible if you use an on_message
and check if the message that was responded to is sent by the bot
Well the database connector you're using isn't async and the command all in all is pretty unreadable.
take a look at this:
elif message.content.startswith("##edit->"):
belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
if belongs_to:
edition_message = message.content.replace("##edit->", "")
embed = discord.Embed(
description=edition_message
)
discord.Message.reference.resolved.edit(embed=embed)
I already answered what the problem is
You are doing it on class which doesn't have any data.
It should be done from Message instance
The message object, from which you want to take reference
oh so message instance
don't on_message message already the message instance
sorry i'm confuse
now i see where i mistook
a stupid misstake
do resolved includes in?
or just reference
Ye, you'd need it
(Though PartialMessage would be safer if you don't need to get some data from it, just edit, because resolved can fail sometimes)
i see
thought for webhook edition seems i need to change something here:
ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 87, in on_message
await message.reference.resolved.edit(embed=embed)
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\message.py", line 2283, in edit
data = await self._state.http.edit_message(self.channel.id, self.id, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 738, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50005): Cannot edit a message authored by another user
elif message.content.startswith("##edit->"):
belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
await message.channel.purge(limit=1)
if belongs_to:
edition_message = message.content.replace("##edit->", "")
embed = discord.Embed(
description=edition_message
)
await message.reference.resolved.edit(embed=embed)
since the message is a webhook
how was it sent?
the message that you try to edit
it was sent by webhook
it's sent like:
prompt: Message
then pops out a webhook with "Message" in an embed
Show the code.
It works fine for webhook from interaction followup for example
Though it's not integrations webhook, if you meant this
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
I guess you want this
there ya go
!d discord.Webhook.edit_message
await edit_message(message_id, *, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None, thread=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits a message owned by this webhook.
This is a lower level interface to [`WebhookMessage.edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.WebhookMessage.edit) in case you only have an ID.
New in version 1.6.
Changed in version 2.0: The edit is no longer in-place, instead the newly edited message is returned.
Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) instead of `InvalidArgument`.
Edits a message owned by this webhook.
ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 87, in on_message
await message.reference.resolved.webhook.edit(embed=embed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Message' object has no attribute 'webhook'
You need to get your webhook
As you did for example around lines 90
And then use it's edit_message with message id from the reference
how doo i grab webhook from reference?
You can get the name and find it in the webhooks list
(But the name is always the same by you as i can see so you can just look for it)
uhmm
🤔
can i see an example of webhook being edited from reference?
like, in code
?
hi. i have a bot that has a verification setup and checks for emails in a csv file and gives a role. i want the bot to delete the message as soon as it gets verified so i used message.delete().. but I also want to delete any message the user sends in that verification channel. I used on_message() event but seems like the command isn't getting called itself and the event gets called and deletes the message. Is there a way around?
You get the webhook with any way you want, like you did before, reference doesn't give you something. Except the name if you don't have it
okay so, i'm trying to find the attribute or instance that grabs the user name:
discord.Message.reference.resolved.user_name
.author.name
@buoyant quail how do i make the document reference command?
?
like, i'm trying to grab the webhook edit thing
and i'm planning to it edit my message ID
await webhook.edit_message(message.reference.message_id, embed=embed)
okay soo, i don't know if i will need the webhook name sinceit already has a name
elif message.content.startswith("##edit->"):
belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
await message.channel.purge(limit=1)
if belongs_to:
edition_message = message.content.replace("##edit->", "")
embed = discord.Embed(
description=edition_message
)
webhooks = await message.channel.webhooks()
webhook = discord.utils.find(lambda webhook: webhook.token is not None, webhooks)
await webhook.edit_message(message.reference.message_id, embed=embed)
.
thank you!
I'm unable to work with forums from my bot currently. I tried updating discord py also, but it seems to be not working. For example, if i run guild.forums -- bot returns no attribute called forums. How do i proceed?
Can you do pip show discord.py to see its version just to be sure?
!d discord.Guild.forums
property forums```
A list of forum channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
or just python -m discord -v
1.7.3 it says
its not up to date then
do pip install -U discord.py to update it
i did this before and now again. it says requirement already satisfied
means most likely you have more than one python version
yes
!dashm how about you use this
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
2.7 
it still says requirment already satisfied :/
what when you run this?
no i tried reinstalling the library. but for this now it is still 1.7.3
what os?
yeah, when i had it in school it was 2.7 that was being taught. so ig that might still be there
mac os
yeah, i used python3 only
mhm
yep
oh.. i'd mistaken when i read "discontinued for 3.7 and earlier" in the docs. i thought 3.7 is included. thanks
Hello! What's up?
I want to start my own discord bot but, I don't know the basic staff. If some one have a tutorial of the basic (preffered a video one. I can learn easier this way) I would love if you could send me.
Check out the #1051603408597024828 section theres a few in there
There's also https://github.com/Rapptz/discord.py/blob/master/examples/app_commands/basic.py for some basic examples
Can bots see the "about me" section on profiles?
no
wack
- Before even attempting to create a discord bot, please learn python (
?tag lp) - To install discord.py, please run
python3 -m pip install discord.py(linux), orpy -3 - m pip install discord.py(windows)
If you wish to use voice functionality, please usediscord.py[voice]instead ofdiscord.py - Take a look at https://github.com/Rapptz/discord.py/blob/master/examples/basic_bot.py Mess around.
- When you start making your bot, use the commands ext: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html
or if you wanna use slash commands: https://gist.github.com/AbstractUmbra/a9c188797ae194e592efe05fa129c57f - The library documentation is available at https://discordpy.readthedocs.org/en/latest/
If you need help please make a post in our #985299059441025044 Forum if its related to Python and/or Discord.py
If you are migrating from the old version of this library (1.7.x) to version 2.XX.XX please follow the migrating guide https://discordpy.readthedocs.io/en/latest/migrating.html
!resources ( there's no tag LP here )
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
This seems familiar 
Is the discord.py[voice] required to do things with voice channels? Haven't tried anything with vc yet
hai noelle :hmm
Ah yes bc it is lol
Hi
You can do things like join voice channels, leave voice channels, mute other members in voice channels, etc.. however you can't actually play sound through them without the [voice] dep group
Oh alright, thanks
Might have to check that out
I made a bot it's on verification it's need identiy card what to do now
wdym
Identity card?
Yes
Do you not have a valid identity card or are you under 16?
Like a government issued ID?
Yes I am under 16
Would a passport work?
https://support.discord.com/hc/en-us/articles/1500006788922-Bot-Verification-FAQ-for-Parents-Legal-Guardians-and-Other-Sponsors get help from a parent or friend who's over 16
Recently, we've had to make a policy change which restricts users under 16 from verifying their bots on Discord alone. We created this article to explain what verification is and how you can help a...
No worries
@meager rock can I also use friends ?
yep sure, you'll need to create a team and add them to it iirc
It's all given in the article above
Ohk
I need help with making seperate files for different commands, can anyone help
it's called cogs
is it hard to understand?
Cogs are a pretty nifty way to organize your bot's commands and stuff. cogs derive from the commands.Cog class found in the commands ext and are usually placed in separate files and loaded as extensions (see ?tag cogs vs ext)
Cog docs > https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
Cog example > https://gist.github.com/pinheaded/ac880263084a65b8d2f769c1fa46a3d7
see example
what cogs are essentially is a place to store your commands. A cog houses one category of commands (so if I had a cog which is Economy, this cog would house all of my economy related commands)
oh boy, I'm gonna lose more braincells
keep in mind dpy is an advanced framework. it takes time to learn and understand these concepts
I just put all my commands in 1 file mane 😭
It is highly recommended to be experienced in Python if you're using discord.py
this ^
Being highly determined and motivated is a sufficient substitution for experience/skill
Can you give more context?
Preferably the code of that function that's failing
I code on mobile too, so it's even more of a struggle
channel is probably None
Noted, however that does not really matter much
It looks to me, where it's failing is, it can't find the channel it's trying to send the message to
at least that's what I can say from that
if you want to basically send like logs of members joining, then you probably want to ensure that the channel is not none bc there is a chance that get_channel is None
I code on PyDroid, I made a simple calculator, because I was bored, but I'm gonna work on my bot
By any chance can you help me with command event errors
im going to get dinner so no
Dam
I suffer? Benefit? From this in like 90% of everything I do
question, what do you guys use for databases for your bots?
I use mariadb, most use some sort of sql or mongodb
use an ORM or?
I use something called PostgreSQL
no ORM. just asyncpg
SQLite and PostgreSQL are the two you probably want to look into
for SQLite, use asqlite since the creator of aiosqlite (Amethyst) thinks that adding connection pooling support requires benchmarking for "performance reasons". and for PostgreSQL, use asyncpg
nonetheless, i'll shift my priorities to proving why Amethyst is incorrect by writing a PR for connection pooling support
lol, I was using sql alchemy to help me visualize the tables cause im really bad at sql, but i had a lot of problems using the relationships
SQLAlchemy is a pain to work with
i found that out
honestly before you even attempt using ORMs, you should at the very least know SQL
ORMs pretty much take away your control on how you want your queries to function, and you end up losing productivity because of that. I essentially lost one whole year of productivity working on my main bot just because I was fighting with the ORMs i was using at that time
do you create your own classes and write helper functions or just directly execute statements in your bots commands?
directly execute statements
i write the raw sql queries myself
Postgres, ORM
There is still debate about whether an ORM is good or not 
sql injection is not a worry bc I pretty much use substitution values that asyncpg uses to clean up the code so sql injection doesn't happen
which orm?
SQLAlchemy
This is something I really need to work on myself. My largest bot is currently susceptible to injection attacks but it's such a daunting task to fix.
Honestly I need to rewrite the whole thing now that I know more than I did then but still.
My largest bot as of now (Kumiko) pretty much was rewritten over the summer with that in mind
I've completed 4 different full rewrites of my bot so far
I have yet to rewrite my bot. It was my first large scale project and I used it to learn python and discord.py and sql. Spent about a year to get it where it is now and I refuse to touch it again until I rewrite
Fair enough
Definitely need to fix the vulnerability and definitely need to seperate into cogs lol
oh ok
I need to merge some cogs together and then finish up an IPC health check system
I think when I rewrite mine I'm also going to expand on it. Right now it's a split tree leveling system with 3 paths. I want to branch it out into a full scale 3 tier tree with 40 different role options. All configurable from either in server or a web dashboard.
But, I procrastinate. Lol
Also my irl job exists
Makes sense
I still have classes and other stuff that I have to deal with so I don't often get the chance to work on my bot
There's so much shit I need to do for my bot
My job is killing me
They overwork me tbh
I feel that. I've been working 10 hour days at a job site 2 hours from home. I pretty much get home and pass out so the weekends are the only time I have. And even then I'm busy with life. But I enjoy the problem solving
Same
Nah u got it worse
Most days I just get home and pass out
Get home at 6 eat, pass out until like 11
Bro doesn't sleep

