#discord-bots
1 messages Β· Page 620 of 1
isn't it spoonfeeding without explanation
The more I look at y'all convo the more I lose my brain cells πΆββοΈ
bro he needs it for an event how can that spoonfeed him π
π°
Lmao
same
Have any of you guys ever tried making AI chatbot
@bot.event
async def on_message(message):
await bot.handler.propagate(message)
await bot.process_commands(message)
muted = message.guild.get_role(912976244499427339)
message_split = message.content.split(".")
for message_word in message_split:
for bad_word in Filter:
if(bad_word == message_word.lower()):
await message.delete()
await message.channel.send("I have deleted that message :angry:")
message.author.add_roles(muted)
``` @vale wing Not working, I am the owner
would've solved it a lot quicker if he knew more about class instances :')
oh wait
its a coroutine
!d discord.Member.add_roles do people even read these smh
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
Most of API interactions require awaiting just remember that 
bro
Np
i tried using add_roles and it worked but my bot didnt have perms so i suppose it work
i tried running my example and it worked π€―
What does atomic parameter do btw
Like if it is true it adds all at once
And if false one by one
Right?
that was an atomically unnecessary to explain π
User doesnt have guild stuff
user = discord user
huh
member = guild member
i think it worked for me
no idea
it just had a perm error
wait
let me inv the bot to a testing server
and see if it works
See
!d discord.Member.add_roles
Only works for member
So typehint must be discord.Member and not discord.User
What error
it cant be that slow to not even handle one bot
You're at the wrong place.
must be some crap code
how do i indicate this as i want title as a user input? ` def check(m): return m.content = title and m.channel == channel
what
wassup bro, we've told you how in the other server you asked this in... feel free to check it
so
1)i learnt python
2) i made a full bot too
3) i did PIL too
your commands mostly run by a few events that the web sockets send and receive
You were right, but it's still pretty tricky cause I'm having to do all my checks with tuples now instead of strings
Also, I have a question. Is there any way to send a message to the channel if a decorator error occurs? Like if a user can't use a command because @commands.has_role('baller') is preventing them from using it?
@discord.ext.commands.has_role(item)```
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 invoking the command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including caps and spelling.
If an integer is specified, you must give the exact snowflake ID of the role.
If the message is invoked in a private message context then the check will return `False`.
This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
you can use the id of the role.
catch the errors
I'm wondering if when an error is raised I can send something
yes!
What is the syntax for catching errors?
use on_command_error
use global error handlers
yeah
try/except or any events
using on_command_error event
would i just put in MissingRole(item)
im not sure abt that π
oh ok
Cause in the core.py file it says when it happens it raises that exact thing
please someone?
Let me do some testing
Oh also, are you saying I would put this in the main code as a message that send ANY time someone doesn't have permissions?
You want to save the user input in the title variable?
i am doing %search hi 3 and i am getting this error
Command raised an exception: TypeError: search() missing 1 required keyword-only argument: 'page'
@commands.command()
# This command allows the user to search through the top repos in an org
async def search(self, ctx, *, repo, page):
yes
Then just do
title = m.content
return m.channel == channel
basic python..
show code
edited
You can't put it like that
why ?
You can only have one keyword argument
yes
So replace the order of arguments
https://github.com/m-y-x-i/Kreklie-discord-bot/blob/main/cogs/global_events.py#L21-L28
this is an example of a global error handler
cogs/global_events.py lines 21 to 28
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, CommandNotFound):
await ctx.send(embed=discord.Embed(
color=easyembed.getcolor(ctx=ctx),
title='Not found',
description=
f'Command not found. Try this instead: `β{ctx.prefix}help`β'))```
old code, i hate that project
Something like self, ctx, page, *, repo would be good I guess
thanks @sullen shoal
hey
it worked thanks
@client.command()
@commands.has_permissions(manage_messages=True)
async def session(ctx, time, md, *, name):
if ctx.channel.id == 912962943484066367:
mes = await ctx.send(f'**{ctx.author.mention} is hosting:**\n*Info: {info}\Name: {name}\nDate: {datetime.today().weekday()}*\n*Please react to this message if you plan on joining today! See you all there!*')
await mes.add_reaction(":heavy_check_mark:")```
Does anyone know how to @ everyone?
just putting @everyone should work
@everyone π€·ββοΈ
@client.command()
@commands.has_permissions(manage_messages=True)
async def session(ctx, time, md, *, name):
if ctx.channel.id == 912962943484066367:
mes = await ctx.send(f'|| @everyone ||**{ctx.author.mention} is hosting:**\n*Info: {info}\Name: {name}\nDate: {datetime.today().weekday()}*\n*Please react to this message if you plan on joining today! See you all there!*')
await mes.add_reaction(":heavy_check_mark:")```
ok
@everyone works and @here works too!
yeah π
:)
I need to use SQL...
I hate you SQL
I'm gonna kill you SQL!
btw does anyone what is the error handler for the embed character limit 
use an error handler
HTTPException
how to check which required argument is missing 
free place to host discord bot?
i think the class has an attribute for it
docs link ?
idk which error youre getting
i am not getting any error, i want to send which required arg is missing
you will get an error, when its actually missing
Lol I'm running into an error. My bot is sending everything twice....
It has something to do with on_message(self, message)
i have made an error handler, i want to send the required args name along with the message
something like this :
Use all the required arguments | Missing argument : <the-missing-argument-name>
elif isinstance(error, commands.MissingRequiredArgument):
await ctx.send("Use all the required arguments")
Am I missing a parameter in there?
Kira you can manually put them in there at the end of the string if there aren't too many arguments
maybe you should add this to your on_message event
if message.author.bot:
return
@dusk pumice your nickname-
Hahaha I thought I had that somewhere in there
you can't I think you an only display one argument at a time thats missing
either you're running the bot twice or you're doing something like this
h = '1'
if h: ...
if h: ...```
in this example, you didnt return so it triggers bot conditionals,
what you could do is,
```py
if h: ...
elif h: ...```
i have too many commands 
π₯²
its in a cog. is this not good enough? ```py
if message.author == self.bot.user:
return
!d discord.ext.commands.MissingRequiredArgument.param
The argument that is missing.
thanks!
just use discord.Member.bot its True when the Member is a bot
does this return all the missing arguments?
If I was to delete all messages sent in a channel I would have to do on_message and if channel.id == <id> then delete right?
Is there a more efficient way of doing this?
use commands
oh
no, just the first one which is missing
wasnt what he wanted lmao nvm, misread
Because it only happens on commands I think
what?
read the message again
i did
you wanna purge all the messages sent in a channel right?
I figured it out
self.bot.process was running it twice since it's in a cog
only needed self.process
you dont need to process if its just a listener
No, I want it to happen in a listener. Delete messages as they are sent but I think an on_message and then a if statement wont be as efficient
the whole thing is self.process_commands(message)
Hmm sure I guess
afaik no other way is efficient
Sup guys. How do I get started making a discord bot
is there a start guide some where
yeah
learn python > watch a tutorial
wdym?
what
do you know to use python classes, OOP and decorators
https://vcokltfre.dev good tutorial
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
In this video, we go over how to setup a discord bot in python using discord.py v1.0.1 (rewrite).
If you have any suggestions for future videos, leave it in the comments below.
GITHUB: https://github.com/Rapptz/discord.py
DOCUMENTATION: https://discordpy.readthedocs.io/en/latest/
OFFICIAL DISCORD.PY SERVER: https://discord.gg/r3sSKJJ
JOIN MY ...
functions*
Really good tutorial
Don't recommend them bad tutorials especially old ones
?
Functions too smh
Before you get started with a discord bot, its recommended you have a basic understanding of python.
If you do then refer to this https://pythondiscord.com/pages/resources/guides/discordpy/
A learning guide for the discord.py bot framework written by members of our community.
I used that one and so far im CHILLIN
And also what asyncio does
No idea. I have typed 'print ("Hello World")'
!resources then learn python first
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
yeah learn some python first XD
learn python before using it's libraries
okay thanks
Lucas ππππ
im assuming you need it if it's not in a cog and its just under @bot.event
@commands.Cog.listener()
async def on_ready(self):
await self.client.change_presence(status=discord.Status.idle, activity=discord.Game('1'))
await asyncio.sleep(5)
await self.client.change_presence(status=discord.Status.idle, activity=discord.Game('2'))``` How can i make this loop endlessly? *under a cog btw*
it doesnt need to be processed if its a listener
Using tasks.loop
are listeners only in cogs
what are they used for?
you can also use it with Bot.listen
Can you show me how I could do that?
the first time I saw how to make the on_message function, they didn't use a listener
so what is the purpose of a listener with on_message?
is there any similarities between html and python?
Or is it 2 whole different languages
well it is lmao
How to get avatar url as png??
They are the worst, don't follow them.
How do you make the code blocks in this chat
!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.
'hello'
\‴οΈ
i don't wanna fight on this but it could be quite helpful if you're starting without any previous knowledge- it could help you take off and understand the basics
from discord.ext import tasks
status = '1'
@tasks.loop(seconds=5)
async def change_status():
if status == '1':
await bot.change_presence(..., discord.Game('2'))
status = '2'
else:
status = '1'
await bot.change_presence(..., discord.Game('2'))
change_status.start()
Completely the opposite, it shows bad ways to code and exactly how not to start.
Β΄print ("Hello World")Β΄
Nope
Yep
i see, thanks a ton
await member.display_avatar.save()
I mean when I get the url...sometimes its not .png sometimes its .webp
I want to get the png form
possible?
Just replace it
!d discord.Asset.save
await save(fp, *, seek_begin=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Saves this asset into a file-like object.
\π€ Never tried
can you explain
User avatars supports PNG, JPEG, WebP, GIF
So you can easily get any of these
!d discord.Asset.with_format
with_format(format, /)```
Returns a new asset with the specified format.
ctx.author.avatar.with_format('png')??
.display_avatar

.avatar can be None
o ok
is it possible to send people dm with user.id which are in a txt file?
@tasks.loop(seconds=5)
async def change_status():
status = '1'
if status == '1':
await client.change_presence(status=discord.Status.idle, activity=discord.Game('-help'))
status = '2'
else:
status == '2'
await client.change_presence(status=discord.Status.idle, activity=discord.Game('-help2'))
change_status.start()``` this doesn't seem to be working..
Error = `in change_presence
await self.ws.change_presence(activity=activity, status=status, afk=afk)
AttributeError: 'NoneType' object has no attribute 'change_presence'`
(its a giving payout)
@slate swan any clue?
You didn't define what bot is
Looking at it again it seems that self.ws is None
your bot isn't ready yet
No clue what self.ws is supposed to be tho :kek:
Websocket connection is None
Ah makes sense
how do i make it ready?...
!d discord.Client.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the clientβs internal cache is all ready.

π π
do you mean User.avatar_url_as?
so i just add this at the start of the code?
I mean as an attachment and not a link
start of your tasks.loop yes
uhh what do i need to import for it?
@tasks.loop(seconds=5)
async def change_status():
await wait_until_ready()``` also would be like this or uh
```py
await wait_until_ready()
@tasks.loop(seconds=5)
async def change_status():```
newbie 101
how can i make a paginator which shows certain amount of elements of a list in a separate page
something like this
test = ["hi","hello","lol","kek","testing"]
i want two elements should be showed in a single page
so the first page should have hi and hello and the second one lol and kek and third one testing
it would be great even if someone gives some kind of hint
yea
i think u need to do this
member = discord.Member
member.send("lol")
code would depend on what type of command you're trying to make ofc
yeah you do User.avatar_url_as().save() then send the file you just created


Like py a=User.avatar_url_as().save() await ctx.channel.send(file=a)??
i want to send the file as png and if user has nitro then gif
no
um do i need to import something for wait_until_ready?
you need help with the paginator or making sublists of the list as a pair of two?
thank you blank, kira and seatch
so?
\π
i knew something for once, i need to praise myself
a = User.avatar_url_as(format="jpg").save("filename.jpg")
await ctx.channel.send(file=discord.File("filename.jpg"))
umm icy, can help me again?..
await client.wait_until_ready()
back to smashing my head in the wall
thanks
i should learn how to read the library π
i am working on the github search repo thing command
and i want to show two search results in one page something like this
yo guys. import discord doesnt work
did you do pip install discord ?
in the command prompt
I will try now
it didnt work. It said that the script chardetect.exe is installed in something thats NOT a path
@tasks.loop(seconds=5)
async def change_status():
await client.wait_until_ready()
status = '1'
if status == '1':
await client.change_presence(status=discord.Status.idle, activity=discord.Game('-guide'))
status = '2'
else:
status == '1'
await client.change_presence(status=discord.Status.idle, activity=discord.Game('-guide2'))
change_status.start()```
Did I change something I shouldn't have?

so the problem is..?
idk how to make paginators
reaction based or button based?
reaction
thanks
also btw how can i make only 2 elements show in a single page ?
!d itertools.pairwise
itertools.pairwise(iterable)```
Return successive overlapping pairs taken from the input *iterable*.
The number of 2-tuples in the output iterator will be one fewer than the number of inputs. It will be empty if the input iterable has fewer than two values.
Roughly equivalent to:
```py
def pairwise(iterable):
# pairwise('ABCDEFG') --> AB BC CD DE EF FG
a, b = tee(iterable)
next(b, None)
return zip(a, b)
```...
AB BC
it will be like this tho
thanks
i think you have to make your own algorithm for AB CD

@bot.command()
async def msg(ctx, user):
userid = 793206762101669948
user = bot.get_user(userid)
await user.send("hehe")```
error: user argument is missing
if i iterate through discord.Message.mentions will it have an id attribute?
help pls
why do u have 2 things with the same name
!d discord.Message.mentions
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
hm
it returns a list of Member
yes
ah ok ty
keep in mind,
if the message is in a private message then the list will be of User instead.
though, both have id attribute
how about if the member leaves the guild? will it be User?
ye ig
before i was using id instead of userid
undocumented (unlike message.author) but alright
but it was giving user argument missing error
codes:
@bot.command()
async def msg(ctx, user):
user = bot.get_user(793206762101669948)
await user.send("hehe")```
if you dont need the user parameter why would you have it there?
if you mean on_member_remove event , it's a Member
no, on message.mentions i mean. "How if the member that's mentioned leaves the guild? Will it be user?"
!d discord.Member.roles
property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [β@everyone](mailto:'%40everyone)β role.
These roles are sorted by their position in the role hierarchy.
Yea it would be a user object
( the member Is kicked)
@commands.command()
async def reward(self, ctx):
item = 'sword'
if os.path.isfile(f'Discord Avatars/{ctx.author}.png'):
print("Image already exists in path.")
else:
await ctx.author.avatar_url_as(format="png").save(fp=f"Discord Avatars/{ctx.author}.png")
file = discord.File(f"{ctx.author}.png")
rewardembed = discord.Embed(title="Victory!", description=f'You won this item! {item}',color=discord.Colour.gold())
rewardembed.set_image(url=f"attachment://{ctx.author}.png")
print(f'{ctx.author}.png')
await ctx.send(file=file, embed=rewardembed)
print(ctx.author)
# await ctx.send(embed=rewardembed)
How come this code isn't getting past the if / else: statement..
If it passes the if check, it doesn't run the other code beneath the if / else
Am i being stupid rn?
afk command flex π
ur code is not in the else statement
Can you not have code after an if / else statement?
Yeah, so I wan't to run the code after the if / else statement happens
but none of it runs. It gets to the if statement and then stops
None of the print statements beneath the if / else are happening
ah alright
just do pass or ...
@Blank.command(aliases=["avatar", "pfp"])
async def av(ctx, user:discord.Member=None):
await ctx.message.delete()
if user is None:
user=ctx.author
if not user.avatar:
await ctx.channel.send("User does not has any avatar")
else:
avatar_content=requests.get(user.avatar.read())
image=io.BytesIO(avatar_content)
try:
await ctx.channel.send(file=discord.File(image))
except:
await ctx.channel.send(user.avatar_url.replace('.webp', '.png'))```
can you DM someone in a mutual server using a bot?
error says: Assets have no attribute replace
that's because replace doesn't exist
great!
why would you need to use BytesIO? avatar_url_as() is enough though
I used it because IDK if the avatar is .gif
but my program is not working
can you help....I wish that It send the avatar as an attachment
But sends file with .webp extension as .png
!d discord.Asset.with_format
with_format(format, /)```
Returns a new asset with the specified format.
Use that to change it from webp to png
Don't ping me
But what if avatar is gif??
I am doing this because I dont think discord previews webp images
!d discord.User.is_avatar_animated
No documentation found for the requested symbol.

yea it exists
!d discord.Asset.is_animated
is_animated()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.9)"): Returns whether the asset is animated.
What cmd
cmd prompt*
do you know why @visual island
- You're doing it wrongly
- The cmd prompt hadn't connected your project
how do I do that then?
What did you do before?
Can we use emotes that are from private servers in a bot embed or message
yes
How π€
I did python -m pip install discord
and then in my python file in VScode I said import discord
async def ForageCommand(ctx):
PossibleItems = ["Red berry", "Blue berry"]
item = random.choice(PossibleItems)
embed = nextcord.Embed(title="Searching",description="You are looking for items in the forest...",color=0x11ba2a)
embed.set_footer(text=f"Requested by {ctx.author.display_name}")
message = await ctx.reply(embed=embed, mention_author=False)
await asyncio.sleep(5)
embed = nextcord.Embed(title="You found something!", description=f"You found a {item}!")
embed.set_footer(text=f"Requested by {ctx.author.display_name}")
await message.edit(embed=None)
await message.edit(embed=embed)
the edited embed never appears, no errors in terminal whatsoever
i did await the function when i ran it, otherwise there would be errors in terminal
<:emoji_name:emoji_id>
Oh do I have have put the bot in that server first ?
:Bar1Full:
The bot must be in the server where the emoji is
I did python -m pip install discord
and then in my python file in VScode I said import discord
@visual island
Alright Thanks
You should try to install it in VS Code terminal
how
Just find the terminal in your IDE
and do
pip install discord
Just look near your console there will be a shell or terminal
in vscode?
who executes the command? You?
https://images.app.goo.gl/t8fM8d6eFoXPDoSDA See there is a terminal in the image
async def ForageCommand(ctx):
PossibleItems = ["Red berry", "Blue berry"]
item = random.choice(PossibleItems)
embed = nextcord.Embed(title="Searching",description="You are looking for items in the forest...",color=0x11ba2a)
embed.set_footer(text=f"Requested by {ctx.author.display_name}")
message = await ctx.reply(embed=embed, mention_author=False)
await asyncio.sleep(5)
embed = nextcord.Embed(title="You found something!", description=f"You found a {item}!")
embed.set_footer(text=f"Requested by {ctx.author.display_name}")
await message.edit(embed=None)
await message.edit(embed=embed)
the edited embed never appears, no errors in terminal whatsoever
i did await the function when i ran it, otherwise there would be errors in terminal
Then type pip install discord
Huh?
Oh yes no
It is called Console
Then it is working ?
no. there isnt any ModuleNotFound
There is no problem now
It's what your if statement does right? If the author id is your id, execute the aiohttp thing
what do you mean "but also says no thanks"? So it executes both the if block and the else block?
!d discord.ext.commands.has_role yeah
@discord.ext.commands.has_role(item)```
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 invoking the command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including caps and spelling.
If an integer is specified, you must give the exact snowflake ID of the role.
If the message is invoked in a private message context then the check will return `False`.
This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
@tropic briar I found out. I need to install an API, but I dont know how
where do I download a discord API
bru
requirement satisfied means you've downloaded everything
giant do be spreading misinfo ngl
i have a list and want to make an embed with field title as the elements in the list
are you saying you want the title to be a random choice from your list?
if so look at this example
no not random
for example
if i have a list test=["first","second","third"] then the embed field should be in the same order as the order of the list elements
hm

well
hmm
i am getting the confusion already lmfao
For item in list
Use a for loop
oh
these are fields
@sick talon make a for loop

for item in yourlist
@velvet tinsel is right, for item in list should def do
And embed add field
embed.add_field because the previous msg you just said had correct spelling π
i don't think i am going to get separate fields for each element
i want separate fields for each element
not all in the same field
if the list is ["first","second","third"] then the embed should look like this
the grey rectangle bg represent field
@shadow wraith does it make sense now ?
oh you want like an automated way to make fields and stuff
i could say manually doing it is an option but ehhh
i cant do it manually
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style chaining.
you could always use this
but lists and embeds connection is
eh, i dont think its really possible
i am working with the api and i have stored few stuff inside lists
i know how to make fields manually 
then make it manually 
my bot isnt able to make use of the custom emojis in my server, anyone know why?
i checked it with default discord emojis and they work
use emoji id
do \:emojiname
type that in chat
and then you'll send an emoji id
nice thanks
i am working with the github api
and i am making a command which shows the search results for a specific repo
and i am storing few stuff few i need like the repo name, star, fork count
so i cant predict what will the user search so that i can do it manually
!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.
damn
github repositories but like idk how to make fields present lists and stuff since adding like 3 fields for example would be 3 lines of code
wait a second
hmm let me try indexing
is the list empty like [] or has 3 contents
Any idea how I can make a reaction of that if u react on a message u get a role and then u can acces the rest of the channel?
strings*
bro check the github examples xD
this is my embed design this is how i want it to look
link?
the current look of the embed is really ugly and i want to change it
ok, so what i know
is that you have a list
seperate lists
i think indexing would work in my opinion
{list_obj[0]}
but i geniunely do not know Β―_(γ)_/Β―
i also dont know how much will be the search list size which the user will use
i have a feature in the command where the user can adjust the search list size
so indexing wont work as well 
damn for loops and indexing won't work?

i want to change it coz idk why but when i see the embed from mobile it looks like shit
this is how it looks from mobile
it looks fine
this is how it looks from PC
is it possible to make multiple lists for when the user searches another repository?
and if so, indexing should work like that then π
i will clear the list when user will use the command another time
how tho ?
i have 3 lists from 3 different thing
here is my code btw
https://paste.pythondiscord.com/nubudivewa.py
is it in a cog
yess
yes s
or get the list data like how much strings are there (strings in this case = repo's searched)
yeah
is indexing still possible even though it would be buggy?
wait
automating the index would be hard and not a good idea
how would you use indexing ?
How to send mentioned user's avatar as an attachment
store the amount of repo's the user has searched into an int, and then try indexing it using the var/class/instance/idk you just madw


server name
why attachment ? 
guild = server
okay ty
bro it's not code to copy π
you can use the avatar link 
the link would show the link and not the avatar
i think that's what he means
if the bot have embed links perm then it would show the avatar
how can I check if the user who reacted to such a message is allowed to kick members?
Β―_(γ)_/Β―

hmmmmmmm all i can think of is someone selects the member to be kicked when they react
they don't have a choice
wait that just means nothing π
what...?
use wait_for_reaction and has_permissions
@commands.has_permissions?
yes
it wouldn't work in my case
oh i thought everyone in your server was a member
Just because some Indian People make bots to delete any link sent by anything (bot/user) in the chat
why ?
coz it faster with the link than the attachment
coz you have to convert it and then save it into png
Yea thats what I thinking
but on the other hand, I am thinking if it is possible to do it without saving??
Whatβs happening
it is a command to report bugs... The bug report is sent to the moderation server where it is viewed. If this message has something illegal, the moderator has the option to kick this member reacting to π«
i dont think so
hmmmm
What is happening? Does anyone need help?
why doesnt has_permisssions work ?
because the member is reporting the bug involved in the command... And members do not have kick permission
yes @slate swanneeds help
ooooh i understand it now
btw i guess it wont work with old bug reports

don't have a "if" to help me?
Whatβs the problem
@velvet tinsel
wait_for()
you have asked for is allowed to kick members?
!d discord.Client.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
Yes that
anyone knows how to do this ?
i know what's wait_for... But I need an "if" checking if member has such permission to function
Has_permissions()
and how would that be putting it in "if"?
I am in the process of making a discord bot using discord.py and asyncio. The bot has commands like kick and ban which obviously should not be available to normal users.
I want to make a simple sy...
stackoverflow down 
ok
Ok
and...
i need the bot to see the author of the REACTION and not the message
Ok
because the member who is the author of the message
I donβt think stack is down
π₯² its down over here
Damn
yes I can
Thatβs your answer
and... thank you for the patience
No problem
@velvet tinsel
Ok

What do you mean by field title
these
how do I make an basic respond command for my bot
fx one of the guild members says hello, it will send a hello
Bot.listen()
use on_message event 
On_message()
Yes like this
np
is this issue with the api or my code ?
Itβs just how it looks on your mobile
like this on_message ("Hello Bozo")
No
huh
!d discord.on_message , it takes a message argument
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your botβs own messages and private messages are sent through this event. This can lead cases of βrecursionβ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
no 
which is not defined by you
Finally an experienced person
oohhh 
wdym?
Click on the blue text in the embed , it takes you to an example
Here's an example ```py
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
Quick Questions: Doespy with open('avatar.png', "wb+") as e:
wb+ method exist??
I donβt think so
Can wb create a file if not exist
b is for binary files iirc
Yea
Ik I want to copy a user avatar data to avatar.png file
but file does not exist
Okay. im guessing I need to add the members of my server in this command
await save(fp, *, seek_begin=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Saves this asset into a file-like object.
@slate swan in the client.user command I need to type in the members right?
or something like that
Depends on what you want to do
user.avatar_url.save("avatar.png")```??
Blank , you on 1.7.3?
yes
I want it to respond on Hello from anyone on the server
gimme a moment
@slate swan can you help me out 
please help
@client.event
async def on_message(msg):
if msg.content=="Hello":
#Do stuff
!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
it write?
hello
Yoir indentation is wrong
idk
member.avatar_url_as("png").save()
See the example how it should look like
yay let's go winrar
oook
then what for the respond command
Indentation is basic python though, might want to take a closer look at it
but thanks!
replace do stuff with your cmds
Still wrong
Iterate thru the listpy e = discord.Embed() for item in list: e.add_field(name= item.....
but what commands
why not user.avatar.save()??
what you want the bot to do??
The if statement needs to be at the same indentation level as the response =
ok
Right now the bot is registring that if a message says "hello" it will do something. And I want it to respond with "hello"
i guess that will put all the items in a single field but i want them in separate fields
the code I sent would do the same
how do I send dm to multiple users using id?(i have 10) is it possible to use json for this?? like adding 10 user id in the file and then making the bot send them dm?
blah = "something"
if ....:
if ....:
do_something()
else:
do_something_else()
Very basic python knowledge, you should take a closer look at how indentation works.
o so replace #Do stuff withpy await msg.reply("Hello")
And the entire code you showed probably doesn't match the indentation of the code above
ok i will try
Search on the internet how indentation in python works, you will find good wikis to read and get more information about it, and what you should change.
help
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Expected discord.Colour, int, or Embed.Empty but received method instead.
please heeelp
thats error
thanks a lot!
i was just being a dumbass π₯²
@wheat heart And also learn a little bit more about Python before doing a bot
help pls?
`@client.command()
async def helpers(ctx):
em = discord.Embed(title="The helpers",timestamp=ctx.message.created_at,description=f' Peopo and Sala',colour = discord.Colour.green)
em.add_field("Want to know the owners",value="Dm the owners")await ctx.send(embed=em)
`
Yw
I super confused
/discord/embeds.py", line 115, in init
self.colour = colour
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/embeds.py", line 230, in colour
raise TypeError('Expected discord.Colour, int, or Embed.Empty but received %s instead.' % value.class.name)
TypeError: Expected discord.Colour, int, or Embed.Empty but received method instead.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 63, in on_command_error
raise error
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Expected discord.Colour, int, or Embed.Empty but received method instead.
!code please
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.
@client.event async def on_message(message): if message.content==("Hello") await msg.reply==("Hello Bozo")
anyone can help with reaction to message to get roles?
@slate swan like that?
Without the second ==
help pls
@slate swan
please help
And not msg but message
!d discord.on_raw_reaction_add
discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
I'd also recommend to use #βο½how-to-get-help as indentation is something that doesn't really have anything to do with bot development, this is just basic Python
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
@client.command()
async def helpers(ctx):
em = discord.Embed(title="The helpers",timestamp=ctx.message.created_at,description=f' Peopo and Sala',colour = discord.Colour.green)
em.add_field("Want to know the owners",value="Dm the owners")
await ctx.send(embed=em)
And as I said, go on the internet and R E A D about python indentation
/discord/embeds.py", line 115, in init
self.colour = colour
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/embeds.py", line 230, in colour
raise TypeError('Expected discord.Colour, int, or Embed.Empty but received %s instead.' % value.class.name)
TypeError: Expected discord.Colour, int, or Embed.Empty but received method instead.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(args, **kwargs)
File "main.py", line 63, in on_command_error
raise error
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Expected discord.Colour, int, or Embed.Empty but received method instead.
do I need to press something for it to work?
please link
and what do u add in the payload?
I'm sure you can search on your own, it's not that hard to use Google and search for "Python indentation"
help plsssssssssssss
ok can you also help me with this
i have the desp of the field in a list as well how to do it ?
help ples
payload is something you get from the api , you dont need to define it , an alternative of raw reaction add is on_reaction_add it requires member intents tho
Add () after green and don't spam, you won't get more attention
you can use range() and index of list then
Do I need to press something in vs code for it to work?
!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
Already gave that
For Google to work??
@client.event async def on_message(message): if message.content=("Hello") await message.reply=("Hello")
Haven't seen it, my bad.
help omg help pls
no for the bot to work
how do you get user input in discord.py again? I forgor π
please indent
@lapis wyvern If you don't read the help we give, why should we bother helping you?
wdym?
yea
if (thing)
indent
could you please explain it a bit my brain not working
Totally not
why isn't it a property?
Missing column.
4 spaces before await and double equals after content and no equals after reply
Ask Danny about that, I'm not the discord.py developer
How do you want us to help you? Bot problem? Error? Specify please
now I get this error
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 63, in on_command_error
raise error
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: add_field() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
how do you prompt for user input in discord.py
okay and will it update automaticlly?
you only gave one argument instead of two
and show us the code
yea
em.add_field(name="Want to know the owners",value="Dm the owners")
Add name=
sorry, my bad lol
?
`@client.command()
async def helpers(ctx):
em = discord.Embed(title="The helpers",timestamp=ctx.message.created_at,description=f' Peopo and Sala',colour = discord.Colour.green())
em.add_field("Want to know the owners",value="Dm the owners")
await ctx.send(embed=em)`
wait_for
I searched far and wide and yet yielded no results
@client.event async def on_message(message): if message.content==("Hello") await message.reply("Hello")
@lapis wyvern
@slate swan still doesnt work
@bot.command()
async def msg(ctx):
user = await bot.fetch_user(793206762101669948)
wala = "congratulations you have won 100k DMC giveaway from dank pepe server"
await user.send(f"{wala}")
can anyone tell me how do I send this to multiple users?
Remove the () on "Hello"
thats what I did
I did do that
No it's not
???????????
like is it possible to add
bot.fetch_users(ID,ID)?
Learn python
ask someone sorry I am a bit busy
npnp
Is it the same for you?
names = []
desc = []
for i in range(#number of fields +1 here
embed.add_field(name = name[i] , value= desc [i])```
get some idea from this , I'm in a class brb
hmm wouldnt that dm the person who wrote the command?
ohhhhhh
how do you prompt for user input in discord.py to get any result? For example, asking for anything?
thankss!!!
no, it gets their id
thanks
As I said, wait_for
But I have said if message
And wait for a message
@client.event async def on_message(message): if message.content==("Hello") await message.reply("Hello")
sigh learn python idents
finally, thank you
haha
works lol
was that what you needed?
himm ima add footer text
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
msg = await client.wait_for('message', check=check)
await channel.send('Hello {.author}!'.format(msg))
Example from the docs: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html?highlight=wait_for#discord.ext.commands.Bot.wait_for
No, I want the m.content to be anything
Then remove the check 
yes. Also, use three backticks it works better
Change from
return m.content == 'hello' and m.channel == channel
to
return m.channel == channel
Β―_(γ)_/Β―
Oh, I was thinking about that. Thank you.
Β΄helloΒ΄
like dis?
@bot.command()
async def msg(ctx):
user = await ctx.author.id(793206762101669948,496569071106523148)
wala = "Test"
await user.send(f"{wala}")
no it's `
I already use those
Uhhh...no
hello
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.
This is just one
hello
You need three of them
Yes
three backticks in the front of the text and in the back?
yes
Read that maybe?
It literally shows an example on how it works..
is there a reason why it has the $ in front of greet
this is so wrong
It's an example from the docs
ah okay
i know
thats why need help
Use get_user(id) or fetch_user(id)
import it
import it first π€¦ββοΈ
And it's datetime
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'datatime' is not defined
We can see
Can you stop?
Why is this guy spamming
does it work for multiple ids?
<@&831776746206265384> Could you please explain to @lapis wyvern that spamming won't give him more help, it's not the first time either.
Thats your problem, you dont even read when they gave you the answer, stop rushing your code and you will make less errors
Just do datetime.utcnow(), you've already imported datetime which is a class from the datetime module
Sadly not, you need to get every user separately
even when I do that I Get a error
on other brackets
did that
You still haven't changed it to datetime as I already said before
It's not datatime it's datetime
Said it here
But since you spam your errors and images you don't see it 
lmao
msg = await client.wait_for("message", check=check2, timeout=30)
member = msg.content
await member.send("test")
how do you get a member from user input
dumb af
msg.author
oke
btw do you guys have some docs or something
for watching listening and playing a game status
that DMs me
Because you're the one who answered xD
!d discord.Status
class discord.Status```
Specifies a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") βs status.
@Blank.command(aliases=["avatar", "pfp"])
async def av(ctx, user:discord.Member=None):
await ctx.message.delete()
if user is None:
user=ctx.author
if not user.avatar:
await ctx.channel.send("User does not has any avatar")
else:
if user.is_avatar_animated():
user.avatar_url.save("avatar.gif")
try:
await ctx.channel.send(file=discord.File('avatar.gif'))
except Exception:
await ctx.channel.send(user.avatar_url)
os.remove('avatar.gif')
else:
user.avatar_url_as("png").save("avatar.png")
try:
await ctx.channel.send(file=discord.File('avatar.png'))
except Exception:
await ctx.channel.send()
os.remove('avatar.png')```
avatar_url_as() takes 1 arguement but 2 were given
!d discord.Activity
class discord.Activity(**kwargs)```
Represents an activity in Discord.
This could be an activity such as streaming, playing, listening or watching.
For memory optimisation purposes, some activities are offered in slimmed down versions:
β’ [`Game`](https://discordpy.readthedocs.io/en/master/api.html#discord.Game "discord.Game")
β’ [`Streaming`](https://discordpy.readthedocs.io/en/master/api.html#discord.Streaming "discord.Streaming")
Yes but if I send something like Bob I want it to DM Bob pls

format="png", it's a keyword argument needed
I would like this not msg.author
Then you need to mention the user, or give a user ID when sending your message
I did mention the user
How do you message the user mentioned
Then you can use msg.mentions to get a list of mentioned users in the message
Just get the element at index 0 if you only mention one user
ok nvm
I get a error
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/tasks/init.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "main.py", line 408, in change_status
await client.change_presence(activity=discord.Watching(next(status)))
AttributeError: module 'discord' has no attribute 'Watching'
how can I fix this
# Setting `Playing ` status
await bot.change_presence(activity=discord.Game(name="a game"))
# Setting `Streaming ` status
await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))
# Setting `Listening ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))
# Setting `Watching ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
Source: https://stackoverflow.com/questions/59126137/how-to-change-discord-py-bot-activity
so I have to change it
If your code doesn't work, what do you think you should do?
hover my cursor onto the error?
Do this
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('Hello'):
await message.channel.send('Hello')```
I ahve now tried this, and it still doesnt work
and the bot is online on the server
Please hide your token...
@slate swan can you help?
And you haven't updated the code
are you talking to me?
Nope
what do you mean
okay
Goodmorning
You haven't restarted your bot
@slate swan you seem like a guy that can help me
here true error
My name says otherwise lmao
File "main.py", line 409
(activity=discord.Activity(type=discord.ActivityType.Watching, name="a movie"))
^
SyntaxError: invalid syntax
ξΊ§
Whats the error?
@Blank.command(aliases=["avatar", "pfp"])
async def av(ctx, user:discord.Member=None):
await ctx.message.delete()
if user is None:
user=ctx.author
if not user.avatar:
await ctx.channel.send("User does not has any avatar")
else:
if user.is_avatar_animated():
await user.avatar_url.save("avatar.gif")
try:
await ctx.channel.send(file=discord.File('avatar.gif'))
except Exception:
await ctx.channel.send(user.avatar_url)
os.remove('avatar.gif')
else:
await user.avatar_url_as(format="png").save("avatar.png")
try:
await ctx.channel.send(file=discord.File('avatar.png'))
except Exception:
await ctx.channel.send(user.avatar_url_as(format="png"))
os.remove('avatar.png')```
Help, this is only sending url π’
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('Hello'):
await message.channel.send('Hello')```
No new line please, everything on one line
this doesnt work
As the example says
oh so remove



