#discord-bots
1 messages Β· Page 516 of 1
Like if you remove this code the error will reappear in another command?
@crystal cliff How many lines is your code btw?
yes
over 400
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
And also, what's the error you get?
where is the discord api
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
can i put gif in set thumbnail ?
yes
thx
Your best solution would probably be to put all the code into a pasting service and sending it
You could use hastebin
!paste
Pasting large amounts of code
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 floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
yes
you can't use emojis in embed title, author and footer iirc
you can
<:emoji_name:id>
and an a before first colon if itβs animated
it should work fine
There is another way
get the emoji using get_emoji()
!d discord.ext.commands.Bot.get_emoji
get_emoji(id, /)```
Returns an emoji with the given ID.
why are you casting a string to a string
Try this and use f string
!pypi
You donβt need to cast something to strings which is already a string
!f-string
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
I am using discord.py 2.0 and when getting Member.avatar_url I got None, did they change it in 2.0?
member.avatar.url iirc
I get member.avatar as None
class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.
Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.
To construct an object you can pass keyword arguments denoting the flags to enable or disable.
This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
New in version 1.5...
Yeah its already on
in code and developer portal too?
maybe its because the user avatar is the default discord one?
yeah
That should be the case
np
channel = bot.get_channel('894061275053707264')
role = discord.utils.get(member.server.roles, name="Superior")
while True:
reaction = await bot.wait_for_reaction(emoji=":person_running:", message=message)
await bot.add_roles(reaction.message.author, role)
error, Member has no attribute to server.roles
member.roles
im new to visual studios how i code python in vs cause i been working it from day and it would not work
You just make a python file
Then start writing
i alrdy downloaded youtube_dl in terminal but it keeps saying that
!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)
damn
Please refer to the docs; since there's no discord.Server object, and it's discord.Guild.
!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.
What error do you get?
how does the logging module work in cogs?
that code is so so old.
so outdated
imagine still using server after 1.0 tho π
im finally done my private music bot π
Indeed, it must respect roles hierarchy. And server owners are at the very top
How can add a bot to only one channel? It shouldn't listen to on_message() on any channels except one
that would be through discord permissions
Or u can add an if statement at the top
well actually, you can execute things only if a message is sent in the given channel you'd like with a simple if check at the top, but, technically the function will be called on every sent message no matter the channel, you can just return back to the function call if it isn't in the channel you give.
That doesn't sound very efficient?
Why would I want to listen to every message if it should only deal with 1 channel's?
Was able to achieve it with permissions as per your suggestion
it is. lets say you want the bot to say something back to a user, but only if its in a specific channel
@bot.event
async def on_message(message):
await bot.process_commands(message)
if message.channel.id != YOUR CHANNEL ID:
return
else:
await message.channel.send("Hello")```
this would be fine, and is only responding to one channel
no issues here.
But it still has to process every single message even if only 1 of a million messages is in that one channel, if that sounds efficient to you then your standards are probably rather low
Well the event is triggered whenever a message is sent be it in any channel in any guild, and your question was "How to listen to messages in only one channel". So, if u have a better way than what snow told you, then tell us, go on.
thank you, hunter.
^
Yea, so u want the owner to set the permissions manually even if, instead u can do that through code, right?
I did it with permissions and on_message only triggers for messages in channels, exactly what I needed
sounds kind of ridiculous to me lol.
I mean, isn't that what the work of a bot is? To make the work of server owners easy
Yeah it is indeed a lot of work to add a bot to a single channel
i would much rather get my needs of having one channel being responded to with one line of code, rather than manually setting permissions to encounter it. it seems so unnecessary.
Well, we just gave you suggestions, it's upto if u want to use them or not. Well, I know a more complex way, but then, u will have to mess with the internals and use bot.dispatch, which, I don't think u know of.
He just gave you another way, and if u don't like it, then just ignore him. Why be rude to him?
How would you mess with the internals to even achieve this
bot.dispatch lol
You somehow pop a message out of thin air if it's only in one channel???
Using internals*
You need to listen to every message lol that's just not how it works
If you are that worried about performance maybe python isn't the language you want
@unkempt hawk ^
I'm creating something rather high throughput and it does make quite a bit of a difference there, saying that this is efficient is more rude than my reply was
Well, then as Andy said, if u r worried about performance, then use another language
Permissions solved it as per the suggestion above
I was not responding to your problem
can anyone help me with this
whenever i use role.color i get the hex value of color but i dont want that instead of that i want color name so can anyone tell me how to get that
also when i use role.permissions i get the output
<Permissions value=1945627743>
instead of this i want to get output like this
Administrator, Manage Server, Manage Roles, Manage Channels, Manage Messages, Manage Webhooks, Manage Nicknames, Manage Emojis, Kick Members, Ban Members, Mention Everyone
so how should i get this
I was responding to hunters thought of messing with internals to achieve this
Which just won't work lol you can't pop a message out of thin air if it's inside of a specific channel
Use dict() on that
Well, by using my way, he would still have to use an if statement to check for the channel and then dispatching our own event Β―_(γ)_/Β―
No he wouldn't need an if statement if he limited the bots permissions
Yea
They are two different suggestions
I was just continuing my suggestion of if statement
I'm not doing computation, just handling requests (on a 64 core server), Python is just fine
Im confused as to why you need to dispatch your own event
.
but as far as i know dict() creates a dictionary
Yes. It returns a dict only
Cz he thought using a simple if statement to return in case of a different channel tells that our standards are "too low"
No your just adding a useless call which makes for less performance
Making an empty return for 99.9% of the requests doesn't sound efficient to me
π€·
when i use role.permissions i get the output
<Permissions value=1945627743>
instead of this i want to get output like this
Administrator, Manage Server, Manage Roles, Manage Channels, Manage Messages, Manage Webhooks, Manage Nicknames, Manage Emojis, Kick Members, Ban Members, Mention Everyone
I told u lol
you told about role colour
thats my bad sorry for inconvienence
It's fine
but what i do about role color
What?
cause im getting output in hex code
Is that a problem?
im using role.color
its giving me output in hex code
but i want output by name of role colour
You can't
like it should give output like black blue
Reason- There are a thousands shades of a single color, so the code doesn't know which shade u call as red lol
For u its different, for me it's different
but mee6 give output like this
I am making a script where when detected for a keyword in discord messages it will print keyword found
So i made it to be
user_messages = (message.content)
if "ABC" in user_message:
print("abc")
so when i type in chat ABC it will print abc
but when i send a webhook in embed with the word ABC it does nothing any chance i gotta change anything?
?
nothing
U gotta check message.embeds
!d discord.Message.embeds it returns a list of discord.Embed objects
A list of embeds the message has.
U gotta check the description, field values and stuff haha
It's fine
!d discord.Member.remove_roles
await remove_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
how can i define a user?
or fetch a user
!d discord.User.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
Also User != Member
naruto has too many episodes breh
Watched both one piece and Naruto
Finished op in 2 months
Took me too long because I had school π€§
guys
i needed a little help
@commands.has_permissions(administrator=True)
async def configure_ticket(ctx, msg: discord.Message=None, category: discord.CategoryChannel=None):```
this my cmd
and this is what it is gonna output
i just wanna make an ugrade that in my cmd there would also be a scope of giving a channel type name
@commands.has_permissions(administrator=True)
async def configure_ticket(ctx, x, msg: discord.Message=None, category: discord.CategoryChannel=None):```
ticket_channel = await category.create_text_channel(f"{x}-help-discusion-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
but here it shows x is not defined help please
What is x?
it is just a channel type
i wanna add this into the channel name
!d discord.TextChannel
class discord.TextChannel```
Represents a Discord guild text channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channelβs hash.
str(x) Returns the channelβs name.
like if x is technical problems channel name will also start with technical problems
Yea but you dont have define x for do that
thn?
how
pls tell me
or fix my code
it is a small one
Give me an example when someone executes this command
Like
!configure_ticket etc etc etc
will come to my server to see the bot?
I asked for something so difficult;
nope
=configure_ticket technical-problems 894185593674821653 760497345644986380
this a cmd
You have a variable and you have not set it. You probably do not know what you want to do.
Can I have emojis on embed title?
ΞΞΏ
F
Same infield names
it will open a channel named technical-problems-help-discussion-(reactor)
@bot.command()
@commands.has_permissions(administrator=True)
async def configure_ticket(ctx, *x, msg: discord.Message=None, category: discord.CategoryChannel=None):
ticket_channel = await category.create_text_channel(f"{x}-help-discusion-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
Try this
what is *
not working
and just saying my ticket_channel variable is above the cmd
!pastebin
Pasting large amounts of code
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 floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
mmm
Let me see your code
Hey @dim cedar!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
β’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
β’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
@bot.event
async def on_ready():
async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
pass
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
lines = await file.readlines()
for line in lines:
data = line.split(" ")
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]
print(f"{bot.user.name} is in the game.")
@bot.event
async def on_raw_reaction_add(payload):
if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]
if payload.message_id == msg_id:
guild = bot.get_guild(payload.guild_id)
for category in guild.categories:
if category.id == category_id:
break
channel = guild.get_channel(channel_id)
ticket_channel = await category.create_text_channel(f"{x}-help-discusion-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)
message = await channel.fetch_message(msg_id)
await message.remove_reaction(payload.emoji, payload.member)
await ticket_channel.send(f"{payload.member.mention} Thank you for creating a ticket! Use **'-close'** to close your ticket.")
try:
await bot.wait_for("message", check=lambda m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close", timeout=3600)
except asyncio.TimeoutError:
await ticket_channel.delete()
else:
await ticket_channel.delete()```
my god
@bot.command()
@commands.has_permissions(administrator=True)
async def configure_ticket(ctx, *x, msg: discord.Message=None, category: discord.CategoryChannel=None):
if msg is None or category is None:
await ctx.channel.send("Failed to configure the ticket as an argument was not given or was invalid.")
return
bot.ticket_configs[ctx.guild.id] = [msg.id, msg.channel.id, category.id] # this resets the configuration
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
data = await file.readlines()
async with aiofiles.open("ticket_configs.txt", mode="w") as file:
await file.write(f"{ctx.guild.id} {msg.id} {msg.channel.id} {category.id}\n")
for line in data:
if int(line.split(" ")[0]) != ctx.guild.id:
await file.write(line)
await msg.add_reaction(u"\U0001F3AB")
await ctx.channel.send("Succesfully configured the ticket system.")```
ticket code ?
this a full tickt system
hmmm
ah
@bot.command()
@commands.has_permissions(administrator=True)
async def configure_ticket(ctx, *x, msg: discord.Message=None, category: discord.CategoryChannel=None):
ticket_channel = await category.create_text_channel(f"{x}-help-discusion-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)β
This part?
ticket_channel = await category.create_text_channel(f"{x}-help-discusion-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)
message = await channel.fetch_message(msg_id)
await message.remove_reaction(payload.emoji, payload.member)
await ticket_channel.send(f"{payload.member.mention} Thank you for creating a ticket! Use **'-close'** to close your ticket.")
try:
await bot.wait_for("message", check=lambda m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close", timeout=3600)
except asyncio.TimeoutError:
await ticket_channel.delete()
else:
await ticket_channel.delete()
@bot.command()
@commands.has_permissions(administrator=True)
async def configure_ticket(ctx, *x, msg: discord.Message=None, category: discord.CategoryChannel=None):
```
...
i made this like this
Good effort, big mistake
.
u know what is problem?
Hi I need help
@client.command()
async def test(ctx):
embed2 = Embed("DON'T KNOW THE RULES?", "NO PROBLEM USE ``--rules`` TO VIEW THE RULES")
await ctx.send(embed2)
Code
out put
<discord.embeds.Embed object at 0x00000228622C65E0>
embed=embed2
Embed(title="", description="")
You can add color=0xff0000
If you want yes
But cant add text like that, must define it, in title or description.
Cant help right now, but you must rewrite your code. Make it more simple.
no
how do i make it so that when my bot joins a server, its role is at the top of the heirarchy?
Embed is a function
embed = discord.Embed(title = Title, description = Description, colour = discord.Color.orange())
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text = "Bot by 09π€π₯π¬π°π±π―π¦π‘π’π―#9678")
return embed```
O.o
someone help
with?
Why all this for a simple embed lol
not for one. i have 13 more
so makes it easy
this is just a part of it
You know!
your indents are messed up
how can i make threads using discord.py?
o h
i dont think thats possible
WHERE
async def prefix(ctx, prefix):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(ctx.guild.id)] = prefix
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
await ctx.send(f"Prefix changed to {prefix}.")```
so what should it be like
i'm not going to spoonfeed you
it is possible. i have heard t
!d discord.Message.create_thread
await create_thread(*, name, auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a public thread from this message.
You must have [`create_public_threads`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_public_threads "discord.Permissions.create_public_threads") in order to create a public thread from a message.
The channel this message belongs in must be a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel").
New in version 2.0.
unindent so it matches
ok
or indent depending on your purpose
ok
so dpy officially allows to create threads
hmm i thought i have to use forked versions
async def prefix(ctx, prefix):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(ctx.guild.id)] = prefix
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
await ctx.send(f"Prefix changed to {prefix}.")```??
this?
@gloomy quest indian?
don't nest context managers, harder to read
i'm making a help command in which anyone can ask for help regarding any langs.
why do you mind
also not sure how well it works considering you open it with read only mode, and open it for writing within
when the user will click on ask help button, it will open a thread for him/her and code helpers will be pinged
how is my idea?
it worked
but it didnt change the prefix
you probably shouldn't be using json for prefixes anyway
o h
then which
oh
If you like use json i urge you to read this #discord-bots message
hi how can i check that a user has permission or not?
does anyone know how to fix this?
python can't join together an int and a str
you'll have to do str() on the int
okk
pls
so i cant do this?
has_permission decorator
you just have to call str() on the integer
@bot.command()
@commands.has_permissions(manage_messages=True)
async def test(ctx):
await ctx.send('You can manage messages.')
It's expecting an int and not a str. Though, you gave it a str which is "job".
but the json requires a string...
Try user[str(user.id)]["job"].
still getting the same error
!e
data = {"name": "Seif Wessam"}
print(data[0])
@dapper cobalt :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | KeyError: 0
Ah, didn't do it correctly.
but it works with the other components
I believe that you've overwritten your variable user after defining it again.
Could you please show me the whole code?
No, I meant this particular command.
How can I move my commands to a separate commands.py file, and import them all to main.py? For example, main.py:
client = commands.Bot(command_prefix="!", case_insensitive=True)
@client.command()
async def hello(ctx):
await ctx.reply("Hello!")
@client.command()
async def bye(ctx):
await ctx.reply("Bye!")
if __name__ == "__main__":
client.run(var.DISCORD_MARTINBOT_TOKEN)
I'd like to move those commands to commands.py and then use them in the bot in main.py
!d discord.ext.commands.Cogs
No documentation found for the requested symbol.
Cogs respresent a drastic change to how you write bots in discord.py. As such it's important to know how to use them, and the differences between using cogs and not using them that may catch you out.
hmm
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
!d discord.ext.commands.Cog

class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.
A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.
When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
I'm failing to understand why chat has just been filled with either pointless or not very useful content
!e
shit = print
shit("just shit")
@undone lodge :white_check_mark: Your eval job has completed with return code 0.
just shit

Could you help transitioning to that with the example above?
I don't really understand that
what about doing loop 
(I hate classes)
hm i might have a better thing for you to read 1 sec
!e
loop = True
if True:
print("looooop")
@undone lodge :white_check_mark: Your eval job has completed with return code 0.
looooop
Please can you stop
while*
me
yes
kk
https://vcokltfre.dev/tutorial/05-cogs/ has a more in depth explanation of it
Cogs are a very important part of discord.py which allow you to organise your commands into groups - not to be confused with actual command groups, which will be explained later in the tutorial.
Do I create the class in commands.py?
yes
And then import that class in main.py?
But classes giving me headaches lol
why the bot is doing dm to itself
you just load the extension using load_extension , you cog would have setup function which will do it
welcomeEmbed.add_field(name=f"Member Number", value=f"#{member.guild.member_count}", inline=True)
user = member
await channel.send(embed=welcomeEmbed)
await user.send(f"We Are So Excited to have you on {member.guild.name}")
it is doing dm to itself :/
what's the member variable?
what is member
it is in on_member_join(member)
guys how can i add a button?
You can use cogs. You may have a look at this repository, it has examples and explanation. https://github.com/ScopesCodez/discordpy-cogs
Example for using cogs in discord.py. Contribute to ScopesCodez/discordpy-cogs development by creating an account on GitHub.
Not supported in discord.py, so you will need to use a 3rd party extension.
About api like for roles we use https://discord.com/api/v9/guilds/{guild}/roles whats for categories and voice channels
!pypi dislash.py is a great one.
discord-components?

@dapper cobalt
dpy v2.0 has
!d discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
and It's pretty good
ive been thinking the same thing
@reef shell can u tell?
I never checked v2.0, I'm really afraid, I don't know why.
no reason to be afraid of a module?
Not the module.
I'm trying so far I have
from discord.ext import commands
bot = commands.Bot(command_prefix="!", case_insensitive=True)
class Commands(commands.Cog):
@commands.command()
async def hello(self, ctx: commands.Context):
await ctx.reply("Hello!")
@commands.command()
async def bye(self, ctx: commands.Context):
await ctx.reply("Bye!")
def __init__(self, bot: commands.Bot):
self.bot = bot
But then how do I import that in the main script?
oh
But I'm afraid of the version not being stable.
No ones helping ππ
Initialize the class before making the commands.
with?
Discord's documentation has a search function.
Otherwise it won't register
@dapper cobalt can u give link of documentation ur talking about
It's stable
@unkempt hawk are you making classes in the main file? If so, you're defeating the purpose of cogs.
@unkempt hawk hey listen shard up yr bot it's easy and it will also make fast
It isn't most of the forks are still in development?
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
@reef shell thanks πππ
Ok what did you find unstable?
is there an event where a user joins a voice channel?
sharding is for big bots?
!d discord.on_voice_state_update
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
I'm not talking about forks
thanks
No I don't have any class in the main file
fyi
Y ask me
list(dict(role.permissions).items())
by using above code im getting the permission a role in list but they are not in order i mean that i want permissions in the decreasing order of priviledges like
Administrator, Manage Server, Manage Roles, Manage Channels, Manage Messages, Manage Webhooks, Manage Nicknames, Manage Emojis, Kick Members, Ban Members, Mention Everyon
how should i get this output
Then why did you define bot again?
Removed it, now what?
@boreal ravine hm
[perm for perm in dict(role.permissions).items() if perm is True]
Well, as I said, you can have a look at https://github.com/ScopesCodez/discordpy-cogs and you will know what to do!
Example for using cogs in discord.py. Contribute to ScopesCodez/discordpy-cogs development by creating an account on GitHub.
how can i make buttons on the same row?
what does the row arguement take?
Well, that's how cogs work.
I have client in mine yours is missing that it only has bot
You can have maximum 5 rows
Huh?
it takes the row number
It should be named bot and not client, though.
It does work, but it's preferable to make your bot instance named bot.
Aren't you supposed to use @client.event etc.?
The tutorial I was following used client
Bad naming Convention
It depends on what you defined your bot's instance as.
My client is client = Client() I don't have a bot yet
so row=1?
It should be bot = commands.Bot(). Using discord.Client() is very bad.
You donβt need to specify it if you are gonna have only one row
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
but i have 2 buttons and i want to put them in one row
And a row can have max. 5 buttons
I was following 3 tutorials they all used Client()
So you don't need to use that keyword
Neither was a YT one lol
@unkempt hawk https://vcokltfre.dev/tutorial/01-setup/
This section of the tutorial will show you how to create a new bot and add it to your server.
crap i meant one line
What kind of tutorial?
Follow this one
Whatever google threw up for python discord tutorial
Even worse.
i want them to go in one line
Tutorials in general are mostly bad.
show code
oh wait
is it dpy?
await ctx.reply(
embed=em,
components=[
Button(label="Back", ),
Button(label= "Next", )
]
)
``` yes
I donβt think so
Try appending that list in another one. It should work iirc.
why would i be here then?
components=[[Button(..), Button(..)]]
isnt it the same thing but in an another array?
i'm not familiar with this type of defining buttons,
You should subclass discord.ui.View and use button decorator so you can use that button's callback easily
Because it loops through each item in the main array and add a button for it in a new row.
If you give it a list in a list, it will loop through the outer list, and join the inside list.
There's a Discord limitation; hence why you can't have more than 5 buttons in one row iirc.
are you sure you are using dpy v2.0 and not a fork?@warm flame
yes im sure im using dpy 2.0
Why does on_message print the message but the cog command doesn't fire? If I comment out the on_message it works
@bot.event
async def on_message(message):
print(f"{message.channel} - {message.author}: {message.content}")
# Load Commands
bot.load_extension("commands")
if __name__ == "__main__":
bot.run(var.DISCORD_MARTINBOT_TOKEN)
Can I not have both for a message?
Oh ty
!d discord.ext.commands.Bot.process_commands
await process_commands(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the messageβs author is a bot and doesnβt call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
guys how can i edit alrdy sent embeds?
But what if I don't have a client?
can i just store ctx.send in a variable then edit it or smth
Do I need to just do await process_commands(message) or what's your point?
Yes.
really?
yes
Read the docs first please
msg = await ctx.send(..)
await msg.edit(content="edited")
so python has something common with other languages, epic
use ur commands.Bot variable then?
it should be await bot.proc.....
U can do await bot.process_commands(message) at the last of the event
at the beggining of the code, you define "discord.ext.commands.Bot()". What did you name the variable?
ah bot
I'm confused as hell on whether to use client or bot, half the people are saying client is bad but the other half tells me to use client instead of bot
so it would be
await bot.process_commands(message)```#
Ye I got it
If u wanna make commands, use Bot. That's it
yea im too tired to think of just looking at it lol
Haha it's fine
What if it does both?
The latter half is wrong
Client is for the beginners or those people who just want to use events
Commands and normal events like on_message
Bot has both
eh?
Clients bad, The guide i watched for dpy defined Bot as "client" and its stuck. But you wanna use Bot
I meant discord.Client class
Got it
U can't tell a person who just started with dpy to make commands with @bot.command() lol
bruh
Most of the ppl (if I am correct), start with Client
Well, I can be wrong also π€·
Imo, it's easier than on_message, unless it's a DJS person.
Ikrrrr
djs devs didn't add an extension cz they wanted to keep things simple for themselves lmao
how is client bad
heyo, what ways do you guys know i can make the bot prefix case unsensitive? for example dank memer i can do PLS, pLs, pLS. and pls
if you say Client is bad, that means Bot is also bad
oh
If I understand him correctly, that's what he means lol
U need to define multiple prefixes
No.
use regex like a chad
no
!d discord.ext.commands.Bot.case_insensitive
Whether the commands should be case insensitive. Defaults to False. This attribute does not carry over to groups. You must set it to every group if you require group commands to be case insensitive as well.
thats for commands, not prefixes
Bruh
@dapper cobalt
Isnt that only for the commands. Eg $apple. $AppLe
but thanks for trying to help :)
isn't that what I said
Yea but...
U can always define multiple prefixes haha
Oh, right.
easy way
Same here, been up for almost 48h, I blame discord.py
he have a list
command_prefix=[...]
guys how can i check if a button is pressed or not?
U r subclassing Button or what?
code for mentioning a user
no
like pinging him
user.mention
Subclassing View?
OOK ty
idk im just gonna paste the code where i use the buttons https://hatebin.com/tuycwldaov
ive been following a decumentary but it doesnt seem to be working
tried a yt vid, still aint working
Sorry bro. Never used that lib. Please use dpy 2.0
i am using dpy 2.0 tho
!d discord.User.mention
DiscordComponents...
property mention: str```
Returns a string that allows you to mention the given user.
I have answered before...
ive searched everywhere they told me to use this so idk
not a problem though
Don't use anything else lol. Just subclass View. Checkout the examples directory in the dpy repo, there are a few examples to do the same
Ah ya, it's fine
you're using discord components lib
this thing?
oh
is that the one u talking abt?
no no
do i have to use that?
oh wait
that's wrong maybe
you've imported it and didn't use it
you use a 3rd lib instead
what am i suppose to use?
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
what is the timeout arguement?
liek this?
You were telling me you are using dpy 2.0
Not the correct case, but yes
every tutorial i see on the internet uses discord-components
i don't follow tutuorials
ive been trying to figure it out myself
i follow docs
but then i gave up
discord..py has a documentary?
wait, you never knew that? 
yeah
!d discord
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.
oh this one
gtg for shower, bye
how do i make it so that it sends a message every 90 seconds or so
!d discord.ext.tasks.loop
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
Your task
lmao
File "C:/Users/Admin/PycharmProjects/Code/Python/MY_bot/main.py", line 27
discord.ext.tasks.loop(*, seconds=0, minutes=1, hours=0, time=0, count=None, reconnect=True, loop='F.C.P.D reporting partrol 5 check on general' )
^
SyntaxError: invalid syntax
?
so you literally copied the code from docs?
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
yes
You donβt do it like this
discord.ext.tasks.loop(*, seconds=0, minutes=1, hours=0, time=0, count=None, reconnect=True, loop='F.C.P.D reporting partrol 5 check on general' )
^
SyntaxError: invalid syntax
This is a decorator to be used for async fuctions
the error is you are not doing it in the way it meant to be
yea but how is meant to be xD
@tasks.loop(seconds=60)
async def activity_change_():
users = sum(g.member_count for g in bot.guilds)
await bot.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.listening, name=f"ethelp | {users} users"))
There you go, a quick example i copied from my code
the number of tumes the loop should run
what is for infinite?
discord.ext.tasks.loop( seconds=60 , reconnect=True, loop='F.C.P.D reporting partrol 5 check on general' )
AttributeError: module 'discord' has no attribute 'ext'
Could u help me mr. sherlock?
Did you check the example i gave you?
yea
so why are you using it like before lol
i've run into an issue with reaction roles
Maybe, if i can
thanku
this is the command line
@bot.command(name="selfrole")
async def self_role(ctx):
await ctx.send("ANSWER")
questions = ["Enter Message: ", "Enter Emojis: ", "Enter Roles: ", "Enter Channel: "]
answers = []
def check(user):
return user.author == ctx.author and user.channel == ctx.channel
for question in questions:
await ctx.send(question)
try:
msg = await bot.wait_for('message', timeout=120.0, check=check)
except asyncio.TimeoutError:
await ctx.send("Type Faster Nerd")
return
else:
answers.append(msg.content)
emojis = answers[1].split(" ")
roles = answers[2].split(" ")
c_id = int(answers[3][2:-1])
channel = bot.get_channel(c_id)
bot_msg = await channel.send(answers[0])
with open("selfrole.json", "r") as f:
self_roles = json.load(f)
self_roles[str(bot_msg.id)] = {}
self_roles[str(bot_msg.id)]["emojis"] = emojis
self_roles[str(bot_msg.id)]["roles"] = roles
with open("selfrole.json", "w") as f:
json.dump(self_roles, f)
for emoji in emojis:
await bot_msg.add_reaction(emoji)
then this is the error: Ignoring exception in command selfrole:
Traceback (most recent call last):
File "C:\Users\glent\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
well, part of it
Hey guys, im trying to get all the people that have reacted on a message. I tried using await getmsg.reactions[0].users().flatten() but it seems it only gets the latest one
how do i add embed in this code
umm it saying something wrong in my client.run
nvm got it
ok thanks
LMAO im sorry i dont understand without indents
i tried to follow but i didnt understand
i'm on mobile so indentations got f up nvm
@tasks.loop(seconds=5.0, count=5)
async def slow_count():
await message.channel.send('This is F.C.P.D partrolling general partrols 5 and 6 are killing beluga')
someone tell me why is this happening discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: edit() takes 1 positional argument but 2 were given
This is the correct way
but you need something else to start the loop
info = await ctx.send("Please send the embed message title in 1 minute")
await info.edit("Timeout")
example?
Wait a sec
from discord.ext import tasks
@tasks.loop(seconds=5)
async def my_loop():
print('Hello World')
my_loop.start()β
do i have to install tasks?
@reef shell can u help me a bit
Yea, how can i help you
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: edit() takes 1 positional argument but 2 were given
^
edit takes only kwargs
why th is this happening
Only 1 pos. arg
await message.channel.send('This is F.C.P.D partrolling general partrols 5 and 6 are killing beluga')
its saying message is unresolved
define it
but it is defined it other ones
!scope
Scoping Rules
A scope defines the visibility of a name within a block, where a block is a piece of python code executed as a unit. For simplicity, this would be a module, a function body, and a class definition. A name refers to text bound to an object.
For more information about names, see !tags names
A module is the source code file itself, and encompasses all blocks defined within it. Therefore if a variable is defined at the module level (top-level code block), it is a global variable and can be accessed anywhere in the module as long as the block in which it's referenced is executed after it was defined.
Alternatively if a variable is defined within a function block for example, it is a local variable. It is not accessible at the module level, as that would be outside its scope. This is the purpose of the return statement, as it hands an object back to the scope of its caller. Conversely if a function was defined inside the previously mentioned block, it would have access to that variable, because it is within the first function's scope.
>>> def outer():
... foo = 'bar' # local variable to outer
... def inner():
... print(foo) # has access to foo from scope of outer
... return inner # brings inner to scope of caller
...
>>> inner = outer() # get inner function
>>> inner() # prints variable foo without issue
bar
Official Documentation
1. Program structure, name binding and resolution
2. global statement
3. nonlocal statement
if you define a variable inside a function, you cant access it somewhere else
but i didnt have to do that before?
?
@bot.event
async def on_member_unban(member):
if member == "SIN#2981":
await member.ban(reason="Alt")
else:
pass
i got this errror
2021-10-04T08:21:54.846539+00:00 app[worker.1]: await coro(*args, **kwargs)
2021-10-04T08:21:54.846567+00:00 app[worker.1]: TypeError: on_member_unban() takes 1 positional argument but 2 were given
Am i doing anything wrong?
The argument is not a Member, its 2 arguments, a Guild and User
Hmm alright
guild, user?
Yes
Yes
Another question is it <username>#<tag> or <id>
and can i use it with await ban
@bot.event
async def on_member_unban(guild, user):
if user == "739767836850913302":
await user.ban(reason="Alt")
else:
pass
weird...
if member == "SIN#2981"
I'm not sure if this would work
I assume it would be if f'{user.name}#{user.discriminator} == "SIN#2981"'
hmmm
str(user) works
If you want to check the id
if user.id == 1234
Alright
There is a simple way using the member converter
Use Guild.ban, because User doesnt have ban()
from discord.ext.commands import command
from discord import Member
@command
async def ban(ctx, member: Member):
Bruh not command...
It's an event
It s the same lol
Just use that member: Member
The code will try to convert the string member into a Member object
uhh
You don't understand the question at all
If it cannot then will simply raise an error
Again, they're trying to ban a user through an event and not with any type of command
So what you're giving is pretty much useless and helpless
The member converter work anyway :_:
Let s say
async def on_member_unabn(guild, user: Member):
If user.name == wathever_the_name_is:
await guild.ban(user)
guild.ban is really outdated ;-;
The on_member_unban event gives a guild and a user as parameter, that user can be converted into a member and be used as a member object
So it no metter what user is, if is an id, the nickname or the discriminator. Is a member object and can be used as a regular member
Hi, I use ctx.reply in my commands instead of ctx.send and it works.
But something can happen that for whatever reason the message is deleted and an error
HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In message_reference: Unknown message
Sending, I want the ctx.send process to be done if something like this happens.
And this is possible with try and excpet, but to use this in any of my commands is really useless and a waste of time.
please help
hello
I am trying to make a discord music bot play any1 sound file when a single command is use
there are the codes
@bot.command()
async def fast(ctx: commands.Context):
voice_channel: discord.VoiceChannel = ctx.author.voice.channel
print(voice_channel.name)
vc = await voice_channel.connect()
vc.play(discord.FFmpegPCMAudio("file 1" or "ffile2"))
while vc.is_playing():
await asyncio.sleep(.1)
await vc.disconnect()
there aren't working
anyway to fix?
outdated? how?
Member.ban is an alias to it
Can you paste the code that gives you this error?
Make a custom function that you will always use afterwards
its not, conversion via typehints only works with commands
Mh strange i have a couple of events in my bot where i convert things and they works fine
you arenβt converting anything
youβre just doing a regular typehint
nothing more, nothing less
Make an argument like this user: discord.Member and then await user.ban()
Wrong. It's not an alias, it's an equivalent. And using Member.ban is much more intuitive
Why replying to me?
!d discord.Member.ban
await ban(*, delete_message_days=1, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
Equivalent to Guild.ban().
how is Guild.ban outdated
Just like normal
Member object that you already have but whatever
User asking for help is not even here anymore
why does that matter
βΏ
im just saying that you dont need a Member object with Guild.ban, you can pass in any snowflake
which makes it better
error handler? Or command Ψ
Isn't it an easier way?
async def ban(
self,
*,
delete_message_days: Literal[0, 1, 2, 3, 4, 5, 6, 7] = 1,
reason: Optional[str] = None,
) -> None:
"""|coro|
Bans this member. Equivalent to :meth:`Guild.ban`.
"""
await self.guild.ban(self, reason=reason, delete_message_days=delete_message_days)
``` basically an alias
It's not hard and if you don't want to always make a try/except for every .reply() you should consider it.
@bot.event
async def on_member_unban(guild, user):
if user.id == 739767836850913302:
await guild.ban(user, reason="Alt")
else:
pass
^ solved
bruh
do it urself?
lmfao eol error
Literally 4 characters
Dont u just need the ctx then embed.add_image(url=ctx.author.avatar_url)?
i am a beginner
its set now lol
not add
im pretty sure a beginner can write 4 characters
Here's the real issue then, learn Python before
They updated it?
or do you not know how to use a keyboard
And adding 4-6 characters after a ( is not that hard
Ye fr learn basic python
huh
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I am trying to make a discord music bot play any1 sound file when a single command is use
there are the codes
@bot.command()
async def fast(ctx: commands.Context):
voice_channel: discord.VoiceChannel = ctx.author.voice.channel
print(voice_channel.name)
vc = await voice_channel.connect()
vc.play(discord.FFmpegPCMAudio("file 1" or "ffile2"))
while vc.is_playing():
await asyncio.sleep(.1)
await vc.disconnect()
I meant you?
Embed.add does not work? U just said they changed it to set or u talking about djs
I am pretty sure that i didn't even learned python just learn it from open source bot and idk 
You said
Dont u just need the ctx then embed.add_image(url=ctx.author.avatar_url)?
I correct you by saying it'sembed.set_imagenow
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
So its set
Ohhh kk i forgor
he
if __name__ == '__main__':
for ext in extensions:
client.load_extension(ext)
this is my code to import cogs and the cog 'codes' is running fine while the cog 'random' isnt
the other basic code we put in a cog is same in both but icant use commands of random cog but the codes cog commands run fine
from lists import *
class random(commands.Cog):
def __init__(self, bot):
self.bot = bot```
bot.add_cog(random(bot))```
this is my code and in between those are my commads which i have tried putting same commands in both
discord.ext.commands.errors.CommandNotFound: Command "tt" is not found```
this is the error
@umbral carbon could you show your full cog code?
so with the commands and everything?
The error might come from how you've written your commands in the cog file, share the entire code
!paste
Pasting large amounts of code
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 floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
if it's too long to paste use this
And why do you use bot in cogs but client in the main file 
oh also that class random is going to be VERY annoying when you want to use the random module
yes
i changed to randomcom
doesnt work still
wait a sec
i pasted the main.py code there
share the cog code with us
Since your other cog is loading, the issue is in the random cog. Share this file
paste the code in that pasting service linked above and give us the link
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
have you tried pressing save first so it actually saves your paste and gives a link so that others can view it?
which is exactly explained in the instructions
Indentation is not correct
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)
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
mostly it shows it isnt corect
my bad i'll check it, im kind of new 
Commands should be indented at the same level as the __init__ function
ohhh
here is a straight line
alright ty
And don't forget that
Hello why am I getting || on timestamp?
I want only 1 |
emb.set_footer(text = f"Bumped by {ctx.author}", icon_url = ctx.author.avatar_url)
emb.timestamp = datetime.utcnow()
Hello!
I had a question about Discord.py.
I want my bot to respond only when I write a number and a dot next to it.
Example: 20. hello (the number here is 20 and the text here is hello)
It should get both the inputs (the number and text).
Should I do this with the on_message function (if so, how?) or with any other method?
Thanks!
depends on what you want to do
you have on_message and you have wait_for
please send your code
Because this is default
When you add a footer and timestamp, there's an automatic | on phone to separate them
And on computer I believe it's β’ that separates them
Is it possible to get the member who created a channel?
Yes, by checking the audit logs
Any other way?
Nope
Hey guys, i want to create a bot that within its features creates a "profile" for everyone who sends a message in the server. These "Profiles" would work like variables, holding infomation that can change about each person. How would i go about doing this?
Use a database to store the required information
just databases, like store all the info you have in a database
Ah, thank you very much 
@valid niche @slate swan
emb.timestamp = datetime.datetime.utcnow()
emb.set_thumbnail(url=ctx.guild.icon_url)
emb.set_footer(text = f"Bumped by {ctx.author}", icon_url = ctx.author.avatar_url)
await ctx.send(embed = emb)
We help you fix issues you face, not code one for you
Halp pls
How to make the default || to |
@cedar smelt
This one
You don't
This is how Discord works
You can't change anything about it
If it shows as || and you haven't added an extra | by yourself, then it's Discord that decided it
See..
See, there's only one...
But how?
I don't see ||
Its code
As I said........
What should I add here?
It's DISCORD that chose it to be like that
You CAN'T change what Discord made default
If you add a footer text AND timestamp, it will be separated using |
And this is how it is and you CAN'T do ANYTHING about it
I just did...
Can you read please?
Read what
Whatever
Maybe read what users send
Thank you!
:)
...
It now shows |
And that's literally what I've said here
Anyways, thanks again
And there are no || here either
whats a permissions argument
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
You can use this 
command args?
class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.
These are not created manually, instead they are created via the decorator or functional interface.
Check in the link 
u dont need perms
to add args to a command
blank image?
wait nvm
just add it manually?
there isnt something like that in dpy lol
How to ise token bucket
Wdym
Can I use multiple images in the same embed??
how i can know if someone voted my bot ?
topgg api
Or whatever site you are using
on_dbl_vote?
No no just join their server and ask for their api docs
@bot.event
async def on_dbl_vote(data):
print(data)
user = data["user"]
voteEmbed = discord.Embed(title="Voted!", description=f"{user} Just Voted for {bot.user.mention}",color=embedTheme)
voteEmbed.add_field(name=f"Voter ID", value=f"{user.id}", inline=False)
voteAnnounce = bot.get_channel(892260693846401054)
await user.send(f"Thanks For Voting {bot.user.mention} !! You Can get Rewards in Our Official Server")
await voteAnnounce.send(embed=voteEmbed)
this is my code but not working :/
Why do you think that discord.py will contain details about dbl
thats a thing?
Yes
Can I? If yes, how can I convert my discord bot to apk so that I can run it on my other phone (without using termux/pydroid3)
but also if someone vote dank memer than it gives coins to the user

