#discord-bots

1 messages · Page 438 of 1

long cove
#

yo is there a way someone can confirm my saddening suspicions

slate swan
#

Go on

long cove
#

that you can't save pictures locally when they are sent to a channel

slate swan
#

Attachments? I believe you can get them

#

forgive me guys

patent lark
#

what did you do

#

wrong server lmao?

vale pendant
#

ig u learn sum every day

long cove
slate swan
#

i forgot to add @ in client.event that we never noticed

slate swan
patent lark
#

BOI

vale pendant
#

no?

long cove
vale pendant
#

in the code block it was in there

velvet yarrow
#

hey i need help with parsing of discord bot

patent lark
#

well that’s why the event wasn’t gettint called lmao.

velvet yarrow
#

code block

vale pendant
#

ig tho

slate swan
velvet yarrow
#

rep codeblock

long cove
#

given attachment is a single attachment and not a list of them

slate swan
unkempt canyonBOT
#
Did you mean ...

repl
return
relative-path

slate swan
#

Go in #bot-commands or something please @velvet yarrow

velvet yarrow
#

how to parse codeblock

#
print("hello")
#

i want lang, code from this how can i do that

celest marlin
#

what

long cove
#

is

patent lark
#

syntax highlighting?

#

!code

unkempt canyonBOT
#

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.

slate swan
patent lark
#

ah i didn’t see that message

#

yes

vale pendant
#

capital M for member

patent lark
#

no

#

yes

slate swan
#

In the type hint

vale pendant
#

discord.Member

patent lark
#

i was about to say i was wrong lol

vale pendant
#

lol

patent lark
#

discord.member -> discord.Member, to actually access the member object @slate swan

celest marlin
velvet yarrow
#

getting data from it

sweet oxide
#
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\sharp\PycharmProjects\imamBot\quran_audio.py", line 378, in quran
    await ctx.send(embed=embed, components=[action_row])
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_components\dpy_overrides.py", line 354, in send_override
    return await send(channel, *args, **kwargs)
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_components\dpy_overrides.py", line 279, in send
    components = _get_components_json(components)
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_components\utils.py", line 27, in _get_components_json
    return [row.to_dict() for row in lines] if lines else []
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_components\utils.py", line 27, in <listcomp>
    return [row.to_dict() for row in lines] if lines else []
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_components\component.py", line 476, in to_dict
    "components": [component.to_dict() for component in self.components],
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_components\component.py", line 476, in <listcomp>
    "components": [component.to_dict() for component in self.components],
AttributeError: 'dict' object has no attribute 'to_dict'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\sharp\AppData\Local\Programs\Python\Python39\lib\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: AttributeError: 'dict' object has no attribute 'to_dict'
buttons = [
                create_button(style=ButtonStyle.grey, label="Previous Page",
                                                custom_id="user_previous_page"),
                create_button(style=ButtonStyle.green, label="Next Page",
                                                custom_id="user_next_page")
            ]
            action_row = create_actionrow(*buttons)

            await ctx.send(embed=embed, components=[action_row])```
Error occurs in the last line. Why can't I send the action_row as a component?
jade jolt
#

you're trying to convert dict to a dict from what i can see

#

components=action_row might work

#

worth a try

sweet oxide
#

When I do that it gives Command raised an exception: KeyError: 0

jade jolt
#

hm

#

idk then

sweet oxide
#

So let me give more context

#

I have two bots with that chunk of code but it only works in one of them

#

I have application.commands selected in the developer portal

#

but it only works in one of them

#

Is there anything else I would need to send buttons?

jade jolt
#

i noticed you're using 2.0

#

i think

sweet oxide
#

did they change how it works?

jade jolt
#

2.0 is more stable for buttons

#

dm me

sweet oxide
#

So I uninstalled discord-components and installed 1.14 instead and it worked, it was because of 2.0 afterall. thank you

slate swan
jade jolt
#

yeah

velvet yarrow
keen talon
#

how do I filter options by adding -- like name --role etc.

#

what just happened lol

visual island
unkempt canyonBOT
#
class argparse.ArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=argparse.HelpFormatter, prefix_chars='-', ...)```
Create a new [`ArgumentParser`](https://docs.python.org/3.10/library/argparse.html#argparse.ArgumentParser "argparse.ArgumentParser") object. All parameters should be passed as keyword arguments. Each parameter has its own more detailed description below, but in short they are:
keen talon
#

thanks

visual island
#

I'm sure R. Danny uses argparse often too

keen talon
visual island
#

it will be in v2, but cause the development is stopped, i dont think it will be available

keen talon
maiden fable
#

@visual island it's past 11 Thonk

maiden fable
#

Weren't u in the US?

visual island
#

no...

maiden fable
#

Oh, my bad

visual island
#

lol

#

my english sucks

maiden fable
#

7408_shrekstare good joke

visual island
keen talon
visual island
#

bruh spotify ads

lament mesa
#

they have to pay the creators

#

they have to pay the creators

maiden fable
# visual island bruh spotify ads

I know lmao. I use the modified version (not allowed to talk about it but I only use the ad free feature, else I don't download music or something haha)

visual island
lament mesa
#

just use yt for music

maiden fable
maiden fable
maiden fable
#

stares at u

visual island
#

it's breaking their tos?

maiden fable
visual island
#

||imagine||

maiden fable
#

Lmao

visual island
#

wait wrong markup

maiden fable
#

😂🤣

visual island
#

how

maiden fable
#

Well, for me... I don't really use Spotify much nowadays cz exams

visual island
stone beacon
#

!projects

unkempt canyonBOT
#

Kindling Projects

The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.

crude crow
#

!commands

#

!discord

spring flax
distant pagoda
#

what do i have to put in my code to make it join a channel and rick roll someone

crude crow
distant pagoda
#

if you want you can just take my code and change it to your liking

distant pagoda
#

yes

spring flax
distant pagoda
spring flax
#

yeah but still

#

Generally if you spoonfeed, the user won't understand the code
Which is not good

distant pagoda
#

well im learning and still dont have it down

#

guess we all learn at different paces

#

but do you know what to put into the code to make it join and rick roll

worthy wagon
#

Everyone's different, although now I understand that getting spoonfed is pointless, even though people that need it may consider it beneficial and helpful in some sense.

valid patio
#

how do i add /repissu:(example) and the example shld print in run?

valid patio
keen oasis
#

heya, can someone help, I found this in the docs

async for entry in guild.audit_logs(action=discord.AuditLogAction.ban):

if I were to limit the number of entries, how would I unban all of the users from the entries found hmidk

marsh depot
#

Hi, I was wondering if there is any way to make when my bot joins a server to send the following on a specific channel

I have joined [Server name] (Invitation link to server)

I have this code but I can't get it to work properly, could someone help me?

@bot.listen()
async def on_guild_join(guild):
    channel = bot.get_channel(882529879445352498)
    link = guild.link
    embed2 = discord.Embed(title='\n', description='\n', color=0xcd5c5c)
    embed2.add_field(name=f'Bot Agregado Al Servidor {guild}', value=f'[Link Del Servidor]({link})')
    await channel.send(embed=embed2)```
marsh depot
hoary gust
# worthy wagon Nah, I got spoonfed a few times, I just used the code that was given and learned...

Same but for me when I first joined discord and saw bots that was the first time I thought of making one and after that I got confused that there are so many Libs what should I use and then after 4 days I choose python and then tried to understand but wasn't able to, that's why I took help of GitHub and tried to understand the code but one day when I was asking for help about that code to someone in the other server they rejected to help me and that's what raged me towards programming and made me learn dpy and others libs in python 🤣🤣🤣

marsh depot
#

dont know if i can make this

dapper cobalt
# marsh depot I need that when my bot joins another server it sends me a message to a specific...

Iterate through the guild's text channels with a for loop and try to create an invite link for each channel. Use try...except to try to create an invitation link, and if it doesn't then continue.
Should be something like this:

@bot.event
async def on_guild_join(guild):
  invite = None
  for channel in guild.text_channels:
    try:
      invite = await channel.create_invite()
      break
    except:
      continue

  if invite == None:
    msg = f"Joined **{guild.name}** with `{guild.member_count}` members and couldn't create an invite link."
  else:
    msg = f"Joined **{guild.name}** with `{guild.member_count}`. Invite: {invite}"

  channel = bot.get_channel(882529879445352498)
  await channel.send(msg)
dapper cobalt
#

No problem.

marsh depot
dapper cobalt
maiden fable
#

Also, be ready to get rate limited

dapper cobalt
maiden fable
dapper cobalt
#

So the for loop would stop.

maiden fable
#

!e
a = None
print(a is None)
print(a == None)

unkempt canyonBOT
#

@maiden fable :white_check_mark: Your eval job has completed with return code 0.

001 | True
002 | True
maiden fable
#

Hmm

blazing beacon
#

Hello there.

blazing beacon
maiden fable
blazing beacon
#

Mhm.

dapper cobalt
keen oasis
#

anyone know the ban limit for users who arent in the server? concerndoggo

maiden fable
#

I don't really think there is any ngl

keen oasis
maiden fable
#

Hmm

#

!d discord.Guild.bans

unkempt canyonBOT
#

await bans()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves all the users that are banned from the guild as a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`BanEntry`](https://discordpy.readthedocs.io/en/stable/api.html#discord.BanEntry "discord.BanEntry").

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
maiden fable
#

Try checking the len

dapper cobalt
#

len(ctx.guild.bans())

keen oasis
#

yeah I know, around 8.5k bans walk

maiden fable
#

It is a coro...

dapper cobalt
#

Oh right.

keen oasis
#

anyone know the exact limit? I wanna unban some so I can still ban users who arent in the server ohmy

slate swan
slate swan
maiden fable
slate swan
#

Well it's very normal that I don't have availability of internet a lot of times, so blobpain

slate swan
slate swan
#

Yes I was seeing that

keen oasis
#

there's a limit on users you can ban who arent in the guild

slate swan
#

notlikeblob I never knew there's something like this

maiden fable
#

A banned user will somehow leave the guild 7408_shrekstare

#

Even if he was in the guild

slate swan
#

How a "banned user" will leave the guild?

#

He's "banned"

maiden fable
keen oasis
#

if a user is banned, and they were in the guild while they were banned, it adds up to the limit

maiden fable
#

Wrong words

hoary gust
#

Banned user is thrown out of thee guild

slate swan
#

^

keen oasis
#

still adds on to limit afaik

hoary gust
#

Wdy want to do

slate swan
#

So you need to wait for some time to let the bucket reset..

hoary gust
#

He wants a cooldown?

#

Or what?

slate swan
#

I think they need to know how much time is left for this cooldown to reset

hoary gust
#

Is he trying to make a cooldown for a cmd or what

dapper cobalt
#

They would never give an exact number, so people won't abuse it.

valid patio
#

how can i make a bot do this /say example

#

?/

hoary gust
#

@valid patio slash cmds?

valid patio
#

no like any even !say is ok

hoary gust
#

Can u plz explain cause me nub at english sry

#

🤣🤣

valid patio
#

if i type

#

!say hello

hoary gust
#

Ok

valid patio
#

bot shld say hello

dapper cobalt
#

Then make the bot send the text.

hoary gust
#

U need a param and compare it with hello

#

Like

valid patio
#

i am new to discord bots so help

dapper cobalt
#
@bot.command()
async def say(ctx, *, text):
  await ctx.send(text)
valid patio
#

ok

hoary gust
#

Well yea that is better @dapper cobalt

dapper cobalt
valid patio
#

what is ctx?

hoary gust
#

Context

dapper cobalt
#

!d discord.ext.commands.Context

unkempt canyonBOT
#

class discord.ext.commands.Context(**attrs)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
valid patio
#

k

hoary gust
#

Oops

dapper cobalt
#

@valid patio don't just copy & paste tho. Try to understand the code. There's still some ways to make a simple say command better.

hoary gust
#

@dapper cobalt well there are more ways but ur that way was the best lol

#

That directly says what u sent

dapper cobalt
hoary gust
#

Yep

dapper cobalt
#

I don't spoonfeed unless it's not the best code, so they would learn.

hoary gust
#

It's something like a chat bot like if we say a chat bot to say @ everyone it mentions the whole server lol

soft river
#

how to check if the channel has certain permissions on discordpy?

hoary gust
#

That's what happened with my bot too

dapper cobalt
soft river
dapper cobalt
#

!d discord.TextChannel.permissions_for if you want to check permissions of a certain member in the channel.

unkempt canyonBOT
#

permissions_for(member)```
Handles permission resolution for the current [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member").

This function takes into consideration the following cases...
soft river
dapper cobalt
hoary gust
#

@dapper cobalt what's the event you hate the most?

dapper cobalt
hoary gust
#

All are useful but I hate 1 of them

dapper cobalt
#

It returns a discord.Permissions object @soft river

#

!d discord.Permissions

unkempt canyonBOT
#

class discord.Permissions(permissions=0, **kwargs)```
Wraps up the Discord permission value.

The properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools. This allows you to edit permissions.

Changed in version 1.3: You can now use keyword arguments to initialize [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions") similar to [`update()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.update "discord.Permissions.update").
lament mesa
valid patio
#

how can i make a bot which can mute people

#

?

valid patio
lament mesa
#

sheet?

#

or docs?

calm vortex
# sage mural What is that * for?
@bot.command()
async def foo(ctx, arg1, arg2, *args):
    ...

# Invoking "?foo one two three four" will have
# arg1 = 'one'
# arg2 = 'two'
# args = ('three', 'four')

@bot.command()
async def bar(ctx, arg1, arg2, *, args):
    ...

# Invoking "?bar one two three four" will have
# arg1 = 'one'
# arg2 = 'two'
# args = 'three four'```
valid patio
#

how can i make a bot which can mute people
?

#

if so can u tell the syntax

dapper cobalt
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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/stable/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
wary ravine
#
        embed.add_field(name = "Arguments", value = f"``{''.join(',') for i in ctx.args}``", inline = False)

returns

#

how do i fix this

rough ledge
wary ravine
#

am i meant to close it after ctx.args?

rough ledge
#

Yeah

wary ravine
#

the command was .type 3

frigid apex
#

i am confused that worked always

#

`Traceback (most recent call last):
File "C:/Users/jakob/Desktop/QEmotes_Beta/bot.py", line 872, in <module>
bot.run(bottoken.read())
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

Process finished with exit code 1
`

sage mural
#

you need to enable intents in the developer page of discord

wary ravine
#

it actually tells you what you should do

#

amazing isnt it

slate swan
wary ravine
slate swan
#

oh nvm

slate swan
frigid apex
#

ty

maiden fable
#

Yea

sage mural
rough ledge
wary ravine
#

not sure that'll work

marsh depot
#

Hello I had a question,
Is there a way that my bot can get the emoji.url of any emoji without having to be inside the server where said emoji is located?
Or is impossible?

My Code

@bot.command() # Ver Emoji
async def emoji(ctx, emoji: discord.Emoji = None):
    if emoji is None:
        await ctx.reply("> ⛔️ No se pudo encontrar el emoji proporcionado o se le olvidó de proporcionar uno.")
    else:
        await ctx.reply(emoji.url, mention_author=False)
wary ravine
#

, is the character used to separate each argumenht

#

no my bad

rough ledge
#

Syntax is separator.join(i for i in iterable)
Or just separator.join(iterable)

#

ctx.args is your iterable
@wary ravine

wary ravine
#
        embed.add_field(name = "Arguments", value = f"``{','.join(i for i in ctx.args)}``", inline = False)

    embed.add_field(name = "Arguments", value = f"``{','.join(i for i in ctx.args)}``", inline = False)
TypeError: sequence item 0: expected str instance, roblox found
#

roblox is the name of my cog

rough ledge
#

Aah
Try str(i) for i .....

wary ravine
#

<cogs.FOWcogs.roblox object at 0x7581ac30>,<discord.ext.commands.context.Context object at 0x736a8210>,1

rough ledge
wary ravine
#

surely that's overcomplicating it

rough ledge
#

I dont see another option

lament mesa
#

ctx.args[:2] will work

rough ledge
lament mesa
#

yes my bad

wary ravine
#

its still possible yes

#

we gave you an answer earlier on

#

bot hasnt got perms

#

ok but does it have perms

#

clearly not since its returned a missing permissions error

#

do you have permissions

#

what is the bot trying to do

#

yeah

#

cant

#

thats like if my highest role was admin and i tried to remove it

novel rampart
#

what is the error

wary ravine
#

send_message isn't a thing

#

use ctx.send or channel.send depending on what you're trying to send to

novel rampart
#

i want to dm that user

wary ravine
#

define channel as the user's dm_channel

#

then do channel.send

maiden fable
#

no

#

member.send() also works

wary ravine
#

o h

#

do that then

novel rampart
#

mm

slate swan
#

hey

#

is there anyways to get a specific member's pfp

novel rampart
maiden fable
unkempt canyonBOT
#

avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/stable/api.html#discord.User.avatar "discord.User.avatar")
slate swan
#

ah ty

#

ill look into it

slate swan
#

like 531507203811573762

maiden fable
unkempt canyonBOT
#

id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/stable/api.html#discord.User.id "discord.User.id")
slate swan
#

(mine)

#

ah

wary ravine
#

get member then do member.acvatar

slate swan
#

ight

wary ravine
marsh depot
#

Sorry to bother but I have a question.

Right now I have in my bot music commands that I have downloaded and inserted in the source code of the bot, so that it plays those specific songs, but when one of those songs is finished it does not go to the next inserted song. I'm testing but I can get it to work properly, can someone help me?

lament mesa
#

guild.me.roles will return the bots roles

slate swan
#

i dont get it

#

why do i get an error

spring flax
#

because

slate swan
#

but i have installed

river kindle
#

I'm doing an invite system in discord py but I don't understand why it doesn't work even though I gave the command

here the code:

@ commands.command (pass_context = True) async def invites (ctx, time_in_seconds, uses): invitelink = await discord.abc.GuildChannel.create_invite (ctx.message.channel, max_uses = uses, max_age = time_in_seconds) await ctx.send (invitelink)

spring flax
slate swan
spring flax
slate swan
#

@spring flax

slate swan
river kindle
#

no

#

the command doesn't exist

#

but i have created the command

slate swan
#

uh remove the space between @ and commands.command

#

maybe?

spring flax
#

@slate swan what did you import

river kindle
#

moment*

slate swan
lament mesa
slate swan
#

OOOOH

#

i forgor

#

thanks

river kindle
slate swan
#

hmm

#

im trying to get my pfp's link to print it out in the terminal

spring flax
unkempt canyonBOT
#

avatar_url```
Equivalent to [`User.avatar_url`](https://discordpy.readthedocs.io/en/stable/api.html#discord.User.avatar_url "discord.User.avatar_url")
slate swan
#

hmm

sage mural
slate swan
#

AttributeError: 'str' object has no attribute 'avatar_url'

spring flax
sage mural
#

still works

slate swan
#

lol

spring flax
dapper cobalt
# sage mural still works

It will still work if you do:

class console():
  
  def log(value):
    print(value)

console.log("Hello world!")
slate swan
#

how to check whether the message.author have a specific role

sage mural
#

ignore me

slate swan
#

ok

dapper cobalt
unkempt canyonBOT
#

roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/stable/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.
plucky shoal
slate swan
sage mural
#

what is wrong with it?

slate swan
#
  File "C:\Users\GLzbc1qcqwjujg2h3dp3n9k0fa6ysset8u87xr95x547uam.py", line 6, in <module>
    losyimg = id.avatar_url_as(format=png, static_format='png', size=512)
AttributeError: 'builtin_function_or_method' object has no attribute 'avatar_url_as'```
#

😦

#

i want it to return if the member has that specific role but doesn't seem to work

#

Why it isn't set the thumbnail

@bot.command()
@commands.has_permissions(administrator = True)
async def clear(ctx, amount : int):
  await ctx.channel.purge(limit=amount)
  emb=discord.Embed(title="Messages deleted successfully", description="🗑")
  emb.add_field(name=f"Responsible moderator : {ctx.author.name}", value=f"Responsible channel {ctx.channel.mention}")
  emb.set_thumbnail(url=member.avatar_url)
  msg=await ctx.send(embed=emb, delete_after=3)
#

?

sage mural
#

do

#

userAvatar = member.avatar_url
print(userAvatar)

slate swan
#

print

#

ok

dapper cobalt
dapper cobalt
#

!d discord.Embed.set_thumbnail

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
dapper cobalt
#

Wait, it does?

slate swan
sage mural
#

async def dp(ctx, *, member: discord.Member = None):
    if not member:
        member = ctx.message.author
    userAvatar = member.avatar_url
    await ctx.send(userAvatar)
slate swan
#

no i mean im trying to get my pfp's link print to terminal

slate swan
#

not in like a bot

sage mural
#

ok so do

#

async def dp(ctx, *, member: discord.Member = None):
    if not member:
        member = ctx.message.author
    userAvatar = member.avatar_url
    print(userAvatar)

slate swan
#

doesnt do anything

#

aint shoving the link

stark bobcat
#

Hoi

dapper cobalt
sage mural
#

author = message.author
print(author.avatar_url)

#

try that

wary ravine
#

does anyone know how the Python bot's !e command works?

stark bobcat
#

!source eval

unkempt canyonBOT
#
Command: eval

Run Python code and get the results.

Source Code
dapper cobalt
wary ravine
dapper cobalt
slate swan
#

but what if i dont want to use a bot for that

#

like

stark bobcat
slate swan
#

like mine

#

531507203811573762

#

see

dapper cobalt
#

You want it to print only your avatar url?

slate swan
#

yeaa

stark bobcat
#

oh

west palm
#

Hi

#

Can anyone Support in german?

sage mural
#

nein

dapper cobalt
slate swan
#

hmmm

maiden fable
dapper cobalt
maiden fable
sage mural
slate swan
#

uummm

sage mural
#

bot = commands.Bot(command_prefix=prefix)

slate swan
#

oh yea

#

about that

#

forgot to put there

sage mural
#

then do


@bot.commands()
async def test(ctx):
code```
#

@slate swan rookie mistake KEKW

maiden fable
#

indent @sage mural

sage mural
#

ik

#

its hard on here

maiden fable
#

👍

slate swan
#

TypeError: 'set' object is not callable bruh

maiden fable
#

u have an object named set somewhere

sage mural
#
@bot.commands()
async def test(ctx):
  print(bot.get_user(531507203811573762).avatar_url)

maiden fable
#

a command or something

slate swan
# maiden fable a command or something
import shutil, discord
from pyfiglet import figlet_format
from discord.ext import commands

bot = commands.Bot(command_prefix="!")

def print_c(s):
    print(s.center(shutil.get_terminal_size().columns))

def print_big(x):
    x = figlet_format(x, font = "standard")
    print(x)

@bot.commands()
async def dp(ctx):
  print(bot.get_user(531507203811573762).avatar_url)
maiden fable
#

I need help

stark bobcat
lament mesa
#

i used to read the source code for fun

lament mesa
#

used to

sage mural
#

@slate swan you need a bot to test it on

slate swan
#

do i need a token for that

stark bobcat
#

Ye

dapper cobalt
stark bobcat
sage mural
dapper cobalt
#

How are you going to make a bot without specifying which bot? stick_wtf

sage mural
#

you can use a public api to parse your id and return the url that way

slate swan
#

i dont need a bot tho

sage mural
#

wa?

#

a api that is public?

slate swan
#

where can i get that

stark bobcat
#

Uh

slate swan
#

that would be ig better

dapper cobalt
slate swan
#

i just want my link to be printed

dapper cobalt
#

You need a bot.

#

You won't get the link from thin air buddy.

#

You need something to get the link.

sage mural
dapper cobalt
#

How can you see without eyes?

sage mural
#

but you need to post

slate swan
#

what

#

do i have to post

sage mural
#

inputid: "idhere"

slate swan
#

ok

#

but

#

how

sage mural
slate swan
stark bobcat
sage mural
#

what is this for?

#

to get url

slate swan
#

fnjljnegjedgkjkdfkdf

#

oh god

#

this is much harder then i thought lmao

sage mural
#

why you do you

#

need to find someones avatar url?

slate swan
#

its mine

#

my id

upbeat otter
#

Guys, i want to add reactions, 👍 and 👎 to an embed, can anybody help me?

eager bolt
#

is it author.user.tag or something else?

eager bolt
upbeat otter
eager bolt
#

!Check something like that

upbeat otter
slate swan
#

Not .tag

dapper cobalt
#
        @tasks.loop(seconds=5)
        async def remind():
            channel = self.bot.get_channel(881283121532788746)
            await channel.send("test")

        remind.start()

Should I start the loop in the setup() function?

eager bolt
#

probably

dapper cobalt
#

I just tried, and as I expected, remind is not defined.

#

Probably it should be ClassName.remind.start().

#

Nope. 'VoteReminder' has no attribute 'remind'.

stark bobcat
#

!charinfo 👍

unkempt canyonBOT
upbeat otter
lament mesa
upbeat otter
#

But thanku

dapper cobalt
#

I had an indentation problem. The loop was inside a function lol.

dim wing
#

is it possible to send data from django to my discordbot ? for instance, I send a message on my website then django sends this message to my discord bot and the bot post this message on a channel

hoary gust
#

guys how to make a category

visual island
hoary gust
#

someone tell me how to make a category and add some restrtiction to it

dapper cobalt
#

bot.remove_command('help')

hoary gust
dapper cobalt
unkempt canyonBOT
#

await create_category(name, *, overwrites=None, reason=None, position=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Same as [`create_text_channel()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`CategoryChannel`](https://discordpy.readthedocs.io/en/stable/api.html#discord.CategoryChannel "discord.CategoryChannel") instead.

Note

The `category` parameter is not supported in this function since categories cannot have categories.
hoary gust
#

how can i use it

#

i wanna use that position

dapper cobalt
hoary gust
dapper cobalt
hoary gust
dapper cobalt
hoary gust
#

guys is it even possible to get the everyone role

dapper cobalt
hoary gust
dapper cobalt
#

The everyone role's ID is as same as the guild's ID.

hoary gust
dapper cobalt
#

Yeah.

hoary gust
#

ok

#

why everytime with me

dapper cobalt
#

!d discord.Guild.get_role

unkempt canyonBOT
hoary gust
#

thanks

dapper cobalt
compact field
#

guys how can i get image url in message ?

#

message is a lot i just want a image link

#

how can i get this from message ?

#

please help me

slate swan
#

how do u mention a rank in the code

wispy sequoia
#

rank?

#

u mean the roles u get when messaging?

wispy sequoia
#

I have a question

#

I want my bot to send a message when the user sends

#

hello [bot mention]

#

how?

ocean trail
#

I would like to learn how to code a Discord BOT in Python pls I want it

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

ocean trail
dapper cobalt
unkempt canyonBOT
dapper cobalt
#

Will return a list of attachments (discord.Attachment) which has a url attribute.

#

!d discord.Attachment

unkempt canyonBOT
#

class discord.Attachment```
Represents an attachment from Discord.

`str(x)` Returns the URL of the attachment.

`x == y` Checks if the attachment is equal to another attachment.

`x != y` Checks if the attachment is not equal to another attachment.

`hash(x)` Returns the hash of the attachment.

Changed in version 1.7: Attachment can now be casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") and is hashable.
ocean trail
#

I would like to be friending you.

dapper cobalt
ocean trail
#

pls

#

I want it

#

friend me

sage mural
dapper cobalt
#

But I told you I won't help you in DMs.

#

If you need help just ask here.

sage mural
#

@ocean trail I can help, what is the issue

dapper cobalt
#

And I will help you if I can.

ocean trail
#

thx I want it

daring valley
#

how would i make json list for guilds + list of members inside of them

sage mural
dapper cobalt
dapper cobalt
unkempt canyonBOT
#

discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message "discord.Message") is created and sent.

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/stable/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/stable/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
wispy sequoia
#

read the other messages

dapper cobalt
#

You want it to reply when someone sends "hello @bot" right?

wispy sequoia
#

yes

dapper cobalt
#

Then you need an on_message event.

wispy sequoia
#

whut

dapper cobalt
#

And check if the message.content is equal to "hello <@bot_id>"

daring valley
slate swan
dapper cobalt
#

Example:

@bot.event
async def on_message(message):
  if message.content == "hello":
    await message.channel.send("Hi")
wispy sequoia
#

I want another or

slate swan
#
 embed = discord.Embed(title=title,description=f":one: {a}\n\n:two: {b}",color = discord.Color(0x5d018f))
    msg = await ctx.send(embed=embed)
    await msg.add_reaction(":one:")```
#

it says that the emoji is unknown

dapper cobalt
wispy sequoia
slate swan
#

im using da :l

wispy sequoia
#

hmmmm

dapper cobalt
#

!charinfo 1️⃣

unkempt canyonBOT
daring valley
dapper cobalt
hoary gust
#

what is the attribute used for get_role

dapper cobalt
hasty iron
dapper cobalt
unkempt canyonBOT
slate swan
#

!chardinfo 2️⃣

daring valley
hoary gust
#

ctx.get_role
or
self.bot.get_role

slate swan
#

!charinfo 2️⃣

unkempt canyonBOT
dapper cobalt
hasty iron
#

oh you mean the class it belongs to

wispy sequoia
#

!charinfo 😋

unkempt canyonBOT
dapper cobalt
hoary gust
hasty iron
#

its Client/Bot and Guild

hoary gust
dapper cobalt
lament mesa
hasty iron
#

huh

#

i thought it had

dapper cobalt
#

Nope. Only discord.Guild.

hoary gust
#

@hasty iron having a issue

wispy sequoia
#

!charinfo 😄

unkempt canyonBOT
hasty iron
novel rampart
#

my embed output is like this

hoary gust
#
                var = "verification"
                everyone = ctx.guild.get_role(ctx.guild.id)
                perms = var.overwrites_for(everyone)
                perms.send_messages = False
                perms.read_messages=False
                perms.speak=False
                perms.read_message_history=False
                await ctx.guild.create_category(var, overwrites=perms, reason="verification system", position=0)```
i wanna get the overwrites for that verification category but how
novel rampart
#

i am dm the message athour

hasty iron
supple thorn
#

Is there a way to join a server where your bot is in but dont know any invite codes

hoary gust
#

^

hasty iron
unkempt canyonBOT
#

overwrites```
Returns all of the channel’s overwrites.

This is returned as a dictionary where the key contains the target which can be either a [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role") or a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") and the value is the overwrite as a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/stable/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite").
hoary gust
hasty iron
#

"i wanna get the overwrites for that verification category but how"

novel rampart
#

this like

hasty iron
#

"the overwrites for that verification category "

novel rampart
#

output

hasty iron
hoary gust
#
perms = var.overwrites_for(everyone)

in here its telling that the str var has no attribute category but i want that for the verification category but how

#

@hasty iron ^ this one

hasty iron
#

create_category returns the created category channel

dapper cobalt
#

Try permissions_for instead of overwrites_for.

novel rampart
hasty iron
hoary gust
dapper cobalt
dapper cobalt
#

You need to get the category first.

hasty iron
hasty iron
dapper cobalt
#

create_category will return a CategoryChannel object of the category created.

hoary gust
dapper cobalt
#

!d discord.CategoryChannel

unkempt canyonBOT
#

class discord.CategoryChannel```
Represents a Discord channel category.

These are useful to group channels to logical compartments.

`x == y` Checks if two channels are equal.

`x != y` Checks if two channels are not equal.

`hash(x)` Returns the category’s hash.

`str(x)` Returns the category’s name.
hasty iron
#

i dont know what you dont undertsnad

hoary gust
#

ok

dapper cobalt
hoary gust
#

me getting confused at that cpoint

#

point

dapper cobalt
hoary gust
#

ok

#

lemme try

#

@dapper cobalt

                everyone = ctx.guild.get_role(ctx.guild.id)
                perms = var.overwrites_for(everyone)
                perms.send_messages = False
                perms.read_messages=False
                perms.speak=False
                perms.read_message_history=False
                var = await ctx.guild.create_category("Verification-Logger", overwrites=perms, reason="For zenesis verification system", position=0)```
still its wrong in the second line i need to assign something valid
dapper cobalt
hasty iron
#

var = await ctx.guild.create_category("Verification-Logger",overwrites=perms, reason="For zenesis verification system", position=0) needs to be before perms = var.overwrites_for(everyone)

#

these are basic issues

#

if you can't fix them alone

hoary gust
hasty iron
#

you should go back to basic python

#

what

dapper cobalt
hoary gust
dapper cobalt
#

Give me your full code.

ocean trail
#

How do I start writing a Discord BOT in Python?

dapper cobalt
ocean trail
#

say to me

hasty iron
dapper cobalt
#

Ask for help with your code here, not how to start from the zero.

dapper cobalt
valid perch
#

!d discord

unkempt canyonBOT
#

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.

ocean trail
#

pls

#

help me how to start from zero

#

I want it

valid perch
#

Heres the docs, go look into what you want and build a bot from it. Theres also examples

hoary gust
hasty iron
#

@hoary gusthttps://discordpy.readthedocs.io/en/stable/api.html?highlight=create_cate#discord.Guild.create_text_channel look at the overwrites argument

hasty iron
wispy sequoia
#

I want to add another or statement with "hello " string + the bot mention

hasty iron
#

oops

#

message before it

hoary gust
#

??

hasty iron
#

look at the overwrites argument

#

look at what it takes

#

it takes in a dictionary

#
overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    guild.me: discord.PermissionOverwrite(read_messages=True)
}

channel = await guild.create_text_channel('secret', overwrites=overwrites)
#

thats the example

hoary gust
#

@hasty iron i am using overwrites_for

hasty iron
#

dont use that ??? the thing doesnt even exist

#

use your brain for a moment

dapper cobalt
hoary gust
#

look at this

hasty iron
#

are you even listening

#

to what i am saying

#

the category doesn't even exist???

#
overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    guild.me: discord.PermissionOverwrite(read_messages=True)
}

channel = await guild.create_text_channel('secret', overwrites=overwrites)
``` this is how you're supposed to do it
hoary gust
dapper cobalt
#

Then you can do the rest.

hasty iron
#

replace create_text_channel with create_category and change the overwrites dict

hoary gust
hoary gust
hasty iron
#

what

hoary gust
#

lol

dapper cobalt
#

Can you show us the full code?

hoary gust
hasty iron
#

man i give up, good luck

dapper cobalt
#

!paste if it's too long

unkempt canyonBOT
#

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.pydis.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.

dapper cobalt
ocean trail
#

hmmmmm?

ocean trail
hoary gust
#

@dapper cobalt

        stats = w.find_one({"guild": ctx.guild.id})
        print(3)
        category = discord.utils.get(ctx.guild.categories, name='Verification-Logger')
        print(4)
        if stats is None:
            print(5)
            if category is None:
                everyone = ctx.guild.get_role(ctx.guild.id)
                perms = var.overwrites_for(everyone)
                perms.send_messages = False
                perms.read_messages=False
                perms.speak=False
                perms.read_message_history=False
                await ctx.guild.create_category("Verification-Logger", overwrites=perms, reason="For zenesis verification system", position=0)
ocean trail
#

Ok

compact field
#

guys can i use member token instead bot token ?

dapper cobalt
vagrant brook
#

Against TOS

compact field
#

ok,but how can i do that ?

vagrant brook
#

You will get banned if you get caught doing that

hoary gust
#

!rule 2

unkempt canyonBOT
valid perch
#

Lets not do that

compact field
dapper cobalt
hoary gust
vagrant brook
#

Okay did you just ignore the 3 above messages

manic wing
compact field
hoary gust
slate swan
#

@compact field We won't be helping you with ToS breaking projects

slate swan
#

Please don't ask for help with it

compact field
hoary gust
#

i need to define var

#

but with what?

dapper cobalt
#
        stats = w.find_one({"guild": ctx.guild.id})
        print(3)
        category = discord.utils.get(ctx.guild.categories, name='Verification-Logger')
        if category is None:
          overrides = {ctx.guild.default_role: discord.PermissionOverwrites(send_messages=False, read_messages=False)}
          category = await ctx.guild.create_category(name="Verification-Logger", overwrites=overrides)
#

@hoary gust

hoary gust
dapper cobalt
#

Yes.

hoary gust
#

i see lemme try it

#

@dapper cobalt got a error
discord dont have any permission overwrites

dapper cobalt
hasty iron
#

i think its discord.PermissionOverwrite

dapper cobalt
#

My bad, I added an s.

hoary gust
#

ok

void fox
#

i have a problem, when someone joined my server then nothing happening why?
code:


import discord
from discord.ext import commands
from datetime import datetime
from discord import Game




client = commands.Bot(command_prefix=".")


@client.event
async def on_ready():
    print("Bot is ready!")

@client.command()
async def on_member_joined(member):
    channel = client.get_channel(id=882282531276345416)
    embed=discord.Embed(title="Sample Embed", url="https://realdrewdata.medium.com/", description="This is an embed that will show how to build an embed and the different components", color=0xFF5733)
    embed.set_author(name=member.mention,url="https://twitter.com/RealDrewData", icon_url=member.default_avatar_url)
    embed.set_thumbnail(url="https://i.imgur.com/axLm3p6.jpeg")
    embed.add_field(name="Title 1", value="his is the value for field 1. This is NOT an inline field.", inline=True)
    embed.set_footer(text="This is the footer. It contains text at the bottom of the embed")

    await channel.send(embed=embed)




client.run(TOKEN)
lament mesa
#

Enable the members intents

#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

dapper cobalt
ocean trail
#

Learn me how to make a enmbed in Python

valid perch
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(**kwargs)```
Represents a Discord embed.

`len(x)` Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
void fox
#

When I make the intent error I get, I already had this problem!

dapper cobalt
void fox
#

Traceback (most recent call last):
File "D:\discord\main.py", line 35, in <module>
client.run(TOKEN)
File "D:\python\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "D:\python\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "D:\python\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "D:\python\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000002CB072C9EE0>
Traceback (most recent call last):
File "D:\python\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "D:\python\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "D:\python\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "D:\python\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

When I experience this error, it is always written to cover leaks, but as soon as I delete it it's okay

#

what's the problem??

valid perch
#

It tells you in the error.

calm vortex
#

Traceback (most recent call last):
File "D:\discord\main.py", line 35, in <module>
client.run(TOKEN)
File "D:\python\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "D:\python\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "D:\python\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "D:\python\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000002CB072C9EE0>
Traceback (most recent call last):
File "D:\python\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "D:\python\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "D:\python\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "D:\python\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

void fox
#

Now it works .......

compact field
#

hi guys how can i get channel in on message event ?

#

??

valid perch
#

message.channel

compact field
#

thanks

hoary gust
#

@lament mesa is there any event for category delete?

lament mesa
#

on_guild_update

gloomy coral
#
elif isinstance(error, discord.errors.ClientException):
            await ctx.send(embed=discord.Embed("Sorry im already playing audio. Do !stop to stop it",color=discord.Color.random()))```
#

Whenever i play audio, and if it is already playing audio, why isnt this handling it?

#
 _run_event
    await coro(*args, **kwargs)
  File "bot.py", line 100, in on_message
    await bot.process_commands(message=message)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 976, in process_commands
    await self.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 943, in invoke
    await ctx.command.dispatch_error(ctx, exc)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 422, in dispatch_error
    await injected(cog, ctx, error)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 71, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/chad-the-discord-bot/cogs/fun.py", line 964, in vcmeme_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: ClientException: Already playing audio.
Timed out oops
172.18.0.1 - - [01/Sep/2021 13:23:44] "HEAD / HTTP/1.1" 200 -
The Great Hall
The Great Hall
Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/chad-the-discord-bot/cogs/fun.py", line 909, in vcmeme
    voice.play(discord.FFmpegPCMAudio(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/voice_client.py", line 558, in play
    raise ClientException('Already playing audio.')
discord.errors.ClientException: Already playing audio.

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 "bot.py", line 100, in on_message
    await bot.process_commands(message=message)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 976, in process_commands
    await self.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 943, in invoke
    await ctx.command.dispatch_error(ctx, exc)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 422, in dispatch_error
    await injected(cog, ctx, error)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 71, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/chad-the-discord-bot/cogs/fun.py", line 964, in vcmeme_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: ClientException: Already playing audio.
Timed out oops
Timed out oops```
#

playing voice memes, not against tos

#

also how to stop what it is playing?

hoary gust
#

@lament mesa is it even possible cause i am not getting anything related to category in this event in the dpy docs

hoary gust
void fox
#

how can i create one in my embed?

hoary gust
#

i didnt get anything about category in the docs

lament mesa
#

check if before.categories is equal to after.categories

gloomy coral
#

also how to auto leave vc after inactivity

#

@lament mesa

lament mesa
lament mesa
gleaming torrent
#

How do I make my bot ban other bots that wasnt invited? Like raid bots

#

Hello?

void fox
#

what is needed for it!?

gleaming torrent
#

some people use bots to nuke servers

#

So I wanna make my bot ban

#

those

void fox
gleaming torrent
#

I know that

void fox
#

you misunderstood i don't know your problem i wanted to solve my own!

gleaming torrent
dapper cobalt
gleaming torrent
dapper cobalt
#

A bot can't join a server without being added by someone who has manage server permissions, and no user can join a server without a valid invite link.

gleaming torrent
#

Well incase my staff decide to add bad bots

#

Like raid bots

#

Btw nice username

dapper cobalt
#

The problem can be solved by decreasing the staff permissions. manage server permissions are pretty dangerous to grant.

dapper cobalt
gleaming torrent
#

how do I make my bot ban bots

#

that wasnt invited

dapper cobalt
#

!d discord.Member.ban

gleaming torrent
#

by me

unkempt canyonBOT
#

await ban(**kwargs)```
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/stable/api.html#discord.Guild.ban "discord.Guild.ban").
gleaming torrent
#

Well do I put something loke that?

#

like*

dapper cobalt
#

Bruh

gleaming torrent
#

So

dapper cobalt
#

!d discord.AuditLogAction.bot_add

unkempt canyonBOT
gleaming torrent
#

Thank you

#

: )

compact field
#
@bot.event
async def on_message(message):
    if message.channel.id == 823882816160661232:
        channel1 = bot.get_channel(8280224876213124)
        await channel1.send(message.content)

guys what is wrong ?
Error : discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message

#

please help me :)

sterile carbon
#

how do i add a role to someone?

member = ctx.message.author
    guild = ctx.message.guild
    for role in ctx.guild.roles:
        if role.name == 'S1':
            role1 = get(member.guild.roles, name="S2")
            await member.add_role(role1)
Command raised an exception: AttributeError: 'Member' object has no attribute 'add_role'
stark bobcat
compact field
stark bobcat
#

content

compact field
#

this is my text

#

some text

stark bobcat
#

Message is spelled weong

#

And you need : after a if statement

gleaming torrent
#

Emoji limit?

gleaming torrent
#

how do I make emoji limit

stark bobcat
#

if message.content.startswith("n/news"):

#

Should be like this

spring flax
#

@slate swan also what is your bot prefix

#

so why not use commands?

#

you don't know what commands are ?

compact field
vagrant brook
#

somehow message.content is empty

#

Maybe because someone sent an image

compact field
#

no thats text

#

not image

vagrant brook
#

are you sure no one sent a blank message

modern pewter
compact field
vagrant brook
#

I think user join message also counts as a blank message

compact field
stark bobcat
vagrant brook
#

You can just use on_member_join instead of on_message

modern pewter
#

Pycord?? Hmmm

sterile carbon
#
    for guild in bot.guilds:
        for member in guild.members:
            print(member)
testerbotlolaaaaaddd#1519
@everyone
testerbotlolaaaaaddd

why is this the output, the bot is only in one server with me, and 2 other bots

compact field
vagrant brook
#

Can you replicate the error and send me what message you sent in the channel

compact field
#

yes wait

modern pewter
vagrant brook
#

Do you have any code below that one

sterile carbon
#

yes

stark bobcat
#

Pycord is active

vagrant brook
#

Which prints roles ig

#

The two last lines are roles

sterile carbon
#
    for guild in bot.guilds:
        for member in guild.members:
            print(member)
            for role in member.roles:
                print(role)
                if role.name == 'S1':
                    role1 = discord.utils.get(message.guild.roles, name = "S2")
                    await member.add_role(role1)
#

it gets only the bot then

#

for some reason

vagrant brook
#

Are you sure the bot has enough permissions to add the role

sterile carbon
#

yes

#

admin

vagrant brook
#

Are you sure the bot's role is higher than S2

compact field
#
@bot.event
async def on_message(message):
    print(message.content)
    if message.channel.id == 823882816160661544:
        channel1 = bot.get_channel(828022487660494867)
        await channel1.send(message.content)
#

and my code

sterile carbon
vagrant brook
sterile carbon
#

it only finds itself

vagrant brook
#

And stops the function right after that

#

I guess ¯_(ツ)_/¯

compact field
#

@vagrant brook

vagrant brook
#

Ah I mean your message

sterile carbon
#

no, i gave it the highest role and still doesnt work

compact field
vagrant brook
#

The message you sent that caused the error

compact field
#

how can i fix it ?

vagrant brook
#

The message has empty content

#

That's the problem

#

You are missing : after if

compact field
sage mural
#

plus what is the code before it?

vagrant brook
#

Embeds or images don't count as content

#

Uhmmm

#

You need a colon after the )

sage mural
#

why are people doing on_message

vagrant brook
#

imo you should go back and learn some basic python before using discord.py

sage mural
#

just do

async def commandname(ctx):
#

also send the code here

#

I will fix it for you

vagrant brook
#

I just told him he's missing a colon after )

sage mural
#

@slate swan just post it here

vagrant brook
#

You should really learn basic python first smh

#

That's why I told you to learn python first

gleaming torrent
#

Hello, how do I make my bot detect self botting?

#

And ban

vagrant brook
#

How is that even possible

slate swan
hasty iron
slate swan
#

lol

gleaming torrent
vagrant brook
#

I guess you can check if someone sent an embed with an user account

slate swan
vagrant brook
#

Btw discord TOS requires you to be at least 13

slate swan
#

how to do that?

gleaming torrent
#

Im 13 so I can be here

vagrant brook
#

That's called button components

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

slate swan
maiden fable
slate swan
#

Anyone know how to add timestamp in embed footer?

compact field
#

guys how can i get message text from message id ?

sage mural
#

send the code you have already

maiden fable
unkempt canyonBOT
slate swan
maiden fable
unkempt canyonBOT
slate swan
unkempt canyonBOT
slate swan
sage mural
# slate swan I'm not on pc rn

here

embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text='\u200b',icon_url="https://i.imgur.com/uZIlRnK.png")

\u200b = Empty Line

maiden fable
unkempt canyonBOT
#
Nah.

No documentation found for the requested symbol.

maiden fable
#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

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/stable/api.html#discord.Message "discord.Message") from the destination.

This can only be used by bot accounts.
compact field
vagrant brook
#

!d discord.Message.content