#discord-bots

1 messages · Page 558 of 1

slate swan
#

can you give me link

slate swan
#

don`t working

#

i have send you frindship request please exept

#

there you can help me

ashen locust
lusty swallow
slate swan
#

how to get animated avatar of user?? ctx.author.avatar_url returns non-animated

slate swan
ashen locust
slate swan
ashen locust
#

are there any alternatives?

slate swan
slate swan
#

!pypi disnake

unkempt canyonBOT
ashen locust
#

oh ok ill see it thanks

slate swan
#

yw

slate swan
#

@lusty swallow i fixed

ashen locust
slate swan
#
@bot.command()
async def аватар(ctx, user:discord.Member = None):
    if user == None:
        user = ctx.author
    userAvatar=user.avatar_url
    embed=discord.Embed(title=f'{user.name} аватар',colour=0xffffff)
    embed.set_image(url=userAvatar)
    await ctx.send(embed=embed)
slate swan
slate swan
ashen locust
slate swan
#

yw

slate swan
#

no i won't personally help you learn python, i ain't got time since it seems like you don't even know how to install python

ashen locust
#

does python 3.10 support disnake?

slate swan
#

afaik yeah

ashen locust
#

what?

slate swan
#

afaik = as far as i know

ashen locust
#

oh lmao

slate swan
#

?? 😂

ashen locust
#

ah yes a software engineer who doesnt know the spelling of "software"

slate swan
#

ikr 😂

#

it some times the words get wrong it is normal

ashen locust
#

??

boreal ravine
slate swan
#

pfft-

storm brook
#

How to get the channel object using channel id

slate swan
#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
storm brook
#

ok

slate swan
#
    @tasks.loop(seconds=600)
    async def checker(self):
        try:
            fetchall = self.coll.find({})  # return all documents inside the db
            print("Hello!")
            current_time = datetime.utcnow()
            async for x in fetchall:
                if current_time >= x["BannedUntil"]:  # do stuff after this
                    unbanuser = x["user_id"]
                    member = discord.Object(id={unbanuser})
                    guild = self.bot.get_guild(int)
                    await guild.unban(member, reason="Tempban for new account expired.")
                    await self.coll.delete_one(unbanuser)

        except Exception as e:
            print(e)


    @checker.before_loop
    async def before_checker(self):
        await self.bot.wait_until_ready()

Thats a task in a cog to check against a db and unban however none of the prints are firing and its not working, I have that in my innit

slate swan
slate swan
#

try printing something at before_checker

#

before wait_until_ready and after, see if it starts and if it finishes

#

and a print above your fetchall

#

see if it prints then

#

kk

slate swan
#

weird

#

the code doesn't look like there's anything wrong pithink

#

Yeah been struggling for a long time nowpens

#

then yeah idk how to help u sorry 😔

#

does the guild exisit?

#

is it the correct guild id

#

also you might wanna add a await client.wait_until_ready() above where you're getting the guild

#

since it's most likely not in the cache yet

#

so .get will return None

#

This basically ^^

slate swan
#

Yeah

#

It's .before_loop not .before.loop

waxen granite
#

Command raised an exception: ValueError: max() arg is an empty sequence
What is this error

visual island
#

your arg passed there is an empty iterable

devout quest
#

hi

#

!recourse

#

!resources

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.

coral vessel
#

How to make Enter on Embed description?

rain rose
#

n/ or smth

#

\n mb

#

Its n with a slash

coral vessel
#

So i want make this for example in description embed
" test 1 tes 2 test 3"

to look like this
test 1
test 2
test 3

how i can do that?

rain rose
#

Test 1 \n test 2 \n test 3

#

In strings

coral vessel
# rain rose Test 1 \n test 2 \n test 3

Well its work, so how i can send code from description.
i want the code look like the original have a colour for example like this in description but have a colour.

HiresTextures = True
CacheHiresTextures = True

the code from .ini file, html, xml, & python
for example like this bot

coral vessel
slate swan
#

just put the string in Embed(description=””)

coral vessel
slate swan
#

like that

coral vessel
steep estuary
#

how to use multiple prefixes

boreal ravine
steep estuary
#
bot = command.Bot(command_prefix=[">","!"])
```do u mean this ?
#

oops :/

boreal ravine
#

sure why not lol

steep estuary
#

but it is giving error

#

that we wanted string

#

and u gave a list

#

:/

frank star
rain olive
frank star
frank star
#

and u can say in python also

rain olive
#

nice. ill help u out one by one, dont go to tutorials they are bad

boreal ravine
rain olive
#

.py

frank star
rain olive
#

dont u have the announcements role tho...

boreal ravine
frank star
rain olive
boreal ravine
#

then learn python first

frank star
frank star
# rain olive ?

nope , someone suggested me to go to this server and ask out

rain olive
#

no i mean the @announcement role

frank star
rain olive
#

u have it

slate swan
frank star
frank star
slate swan
boreal ravine
slate swan
#

all indians talk the same 🤢

boreal ravine
#

u realize

slate swan
boreal ravine
#

their native language is indian

#

not english

frank star
#

Yeah

boreal ravine
#

^

frank star
#

Our native language is Hindi

boreal ravine
#

ye that

frank star
slate swan
#

!ban 548345298376720406 1m Xenophobic behaviour isn't tolerated here. Please follow our #code-of-conduct if you choose to join again.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @tardy pasture until <t:1637836431:f> (30 days and 23 hours).

stiff nexus
#
vc1 = await self.bot.get_channel(862915601332699137).connect(reconnect=True)
vc2 = await self.bot.get_channel(844178791735885824).connect(reconnect=True)
await vc1.guild.change_voice_state(channel=vc1, self_mute=False, self_deaf=True)
await vc2.guild.change_voice_state(channel=vc2, self_mute=False, self_deaf=True)
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/cogs/owner.py", line 1114, in on_connect
    await vc1.guild.change_voice_state(channel=vc1, self_mute=False, self_deaf=True)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/guild.py", line 2943, in change_voice_state
    channel_id = channel.id if channel else None
AttributeError: 'VoiceClient' object has no attribute 'id'
```help?
slate swan
#

hi guys, please tell me how to ban everyone on the server using the command (all for educational purposes!)

surreal sierra
#

Is it possible for a discord bot to know if you reply to a msg and get all text from that msg?

meager chasm
stiff nexus
#

ya

plush spruce
#

@client.command()
async def getkey(ctx):
with open('Whitelisted.txt', 'r') as fr:
if str(ctx.author.id) in fr.read():
await ctx.send("You already have a key check your messages with the bot!")
else:
with open('Whitelisted.txt', 'a') as f:
key = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(35)])
val = [
(f'{key}', f'{ctx.author.id}')
]
sql = "INSERT INTO beta_keys (key, discordid) VALUES (%s, %s)"
mycursor.execute(sql, val)
keydb.commit()

    print(mycursor.rowcount, "was inserted.")
#

help?

meager chasm
#

with?

plush spruce
meager chasm
stiff nexus
#

READ THAT WARNINGS

plush spruce
#

???

slate swan
#

👀 what sql database it that?

meager chasm
stiff nexus
slate swan
#

isnt it like the values supplied must be a tuple

meager chasm
#

This looks like MySQL

slate swan
#

oh

stiff nexus
slate swan
surreal sierra
slate swan
#

How to send bold letters inside code block

stiff nexus
# slate swan `vc1` must be defined as a channel , so dont use the .connect part if you want t...
      await self.bot.get_channel(862915601332699137).connect(reconnect=True)
      await self.bot.get_channel(844178791735885824).connect(reconnect=True)
      guild = self.bot.get_guild(746337818388987967)
      vc1 = self.bot.get_channel(862915601332699137)
      vc2 = self.bot.get_channel(844178791735885824)
      await guild.change_voice_state(channel=vc1, self_mute=False, self_deaf=True)
      await self.bot.server.change_voice_state(channel=vc2, self_mute=False, self_deaf=True)
```still not working
pliant gulch
slate swan
stiff nexus
#

none

pliant gulch
#

!d discord.MessageReference.resolved

unkempt canyonBOT
#

The message that this reference resolved to. If this is None then the original message was not fetched either due to the Discord API not attempting to resolve it or it not being available at the time of creation. If the message was resolved at a prior point but has since been deleted then this will be of type DeletedReferencedMessage.

Currently, this is mainly the replied to message when a user replies to a message.

New in version 1.6.

slate swan
leaden jasper
leaden jasper
stiff nexus
slate swan
slate swan
#

any if-else statements around

stiff nexus
#

workss

slate swan
#

hm

tall canopy
#
How to make a cog.listener that send message to a specific channel when ctx.guild.member is online or offline?
boreal ravine
#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
slate swan
#

could someone give me an example code on how I would edit a default help command?

final iron
#

There were examples

slate swan
final iron
slate swan
#

ty

#

whats use of msg.lower()?

#

how it works

#

and what it does

final iron
#

Converts all of the characters in a string to lowercase

slate swan
#

ohhh

#

ty

slate swan
#
import discord.ext.commands
from discord.ext.commands import Bot, Cog, Context, command
from discord import Colour, Embed


class MyHelp(discord.ext.commands.HelpCommand):
    def get_command_signature(self, cmd):
        return '%s%s %s' % (self.clean_prefix, cmd.qualified_name, cmd.signature)

    async def send_bot_help(self, mapping):
        embed = Embed(title="Help")
        for cog, commands in mapping.items():
            filtered = await self.filter_commands(commands, sort=True)
            command_signatures = [self.get_command_signature(c) for c in filtered]
            if command_signatures:
                cog_name = getattr(cog, "qualified_name", "No Category")
                embed.add_field(name=cog_name, value="\n".join(command_signatures), inline=False)

        channel = self.get_destination()
        await channel.send(embed=embed)


def setup(bot):
    bot.help_command = MyHelp()
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'MyHelp' object has no attribute 'clean_prefix'
delicate flax
#

Hello! How to set a topic to a channel when I create it with a bot?

slate swan
#

nothing works 😄

valid niche
#

!d discord.TextChannel.edit

unkempt canyonBOT
#

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

Edits the channel.

You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 1.4: The `type` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
valid niche
#

you want to set the "topic" setting to whatever you want it to display

slate swan
delicate flax
#

await server.create_text_channel(topic=") like this?

#

not just with this arg but is it like this?

tall canopy
#

eurm bro ! if i want to make the bot online 24/7 ,except replit and heroku, does there have any method ?

delicate flax
tall canopy
#

Does it free forever ? bcause heroku im already use 550 hours..

maiden fable
#

No

#

Paid host

tall canopy
#

Ohhhhh i see ...

slate swan
#

import keyboard
if keyboard.press == "p":
command = win.destroy

#

why doesn't work?

#

dpy channel

slate swan
slate swan
#

guys you know how to make a bot copy the author's message discord py

tall canopy
slate swan
#

it doesn't die

#

550 hours/month

tall canopy
slate swan
#
@bot.command(pass_context=True)
async def (ctx, *,arg):
    await ctx.channel.purge(limit=1)
    await ctx.send(arg)
tall canopy
#

Ohhhhhh like this . Thanks Bro .

slate swan
#

not saying you should do this

#

but it sure is a trick

maiden fable
tall canopy
slate swan
#

this is my first attempt at any help

visual island
slate swan
#

cool , but you should still not spoonfeed people , it doesnt help them to understand what they are actually doing

slate swan
# slate swan 1 sec

code: ```py
@avatar.error
async def avatar(ctx, error,*,arg):
if isinstance( error, discord.ext.commands.errors.MemberNotFound ):
msg = await ctx.send(embed = discord.Embed(title = '',description = f"{ctx.message.author.mention} Ошибка: Не существует такой юзер{arg}", color = 0x2f3136))
await asyncio.sleep(7)
await msg.delete()
await ctx.message.delete(

#

someone help?

slate swan
#

so basically its just async def foo(ctx , error)

#

We already told you to not use an error handler as your command

#

mhm , its a really bad idea to use same function names for both command and error functions

#

there's no more arguments in an error handler

#

than ctx and error

maiden fable
#

But I guess they just wanted a say command, sooo 😐

slate swan
maiden fable
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.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.

maiden fable
#

The website...

slate swan
#

doesn't matter what website it is

maiden fable
#

Well, sorry but I never heard of that website, sooo ain't opening it 😐

slate swan
#

oh my god

#

don't respond then

#

nah. me neither

maiden fable
maiden fable
#

Lmao

slate swan
#

i literally wrote that code, and it's working

#

what error did you even get

#

it's not working for me, what am I doing wrong then

#

I get almost "something" doesn't have an attribute called "something" on multiple lines

#

example

#

lmao

#

menu.current_page doesn't have an attribute called current_page

maiden fable
#

Ah, attribute errors suck

slate swan
#

linter issue, has been since the first time menus was made

#

please actually show me the error, instead of talking about linter warning

#

self.helpcommand throws me a warning too and wont work

#

ok wait

maiden fable
#

Flake8 and Pylance always show all the possibile errors which can occur in each and every scenario, sooo I guess that's what u r getting?

slate swan
#

first error is discord.ext.commands.errors.CommandNotFound: Command "help" is not found

#

and after im done with that, ill prob get 5-6 errors

maiden fable
#

U didn't call the brackets on bot.command()?

slate swan
#

right, so you literally jump through the entire tutorial, didnt even read on how to add the helpcommand to your bot

#

i tried this bot.help_command = MyHelp() threw me a error on MyHelp()

#

i wont help you from here sorry, please read what i wrote

maiden fable
#

Nvm

slate swan
#

and in your tutorial it doesn't show how to call this function

#

please, actually read what i said

#

yes I read the code?

#

you didnt

#

it's not even the same as mine

#

stop being stubborn, not once did i asked you to use HelpPageSource to bot.help_command, that's not even a HelpCommand class, that's the menu, that class you're suppose to use it in your help command class, which i wrote here ```py
import discord
from itertools import chain
from discord.ext import commands

class MyHelp(commands.MinimalHelpCommand):
def get_command_brief(self, command):
return command.short_doc or "Command is not documented."

async def send_bot_help(self, mapping):
    all_commands = list(chain.from_iterable(mapping.values()))
    formatter = HelpPageSource(all_commands, self)
    menu = MyMenuPages(formatter, delete_message_after=True)
    await menu.start(self.context)

bot = commands.Bot("uwu ", help_command=MyHelp())

#

i dont get why do you insist on everything i said

#

okay

#

commands.Bot("uwu "

#

lost my mind

#

you should've also included a "whole working code for help command"

#

I did, you pretty much ignored it

#

this is getting pointless i aint gonna argue

velvet crest
#

why is it so that when i view the invite page of my bot it shows 10 guilds and when i run len(bot.guilds) it shows 6 servers ? Which is more accurate and why

slate swan
#
    async def format_page(self, menu, entries):
        page = menu.current_page

ok but why am i getting an error on this one?

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.

A full traceback could look like:

Traceback (most recent call last):
    File "tiny", line 3, in
        do_something()
    File "tiny", line 2, in do_something
        a = 6 / b
ZeroDivisionError: division by zero

The best way to read your traceback is bottom to top.

• Identify the exception raised (in this case ZeroDivisionError)
• Make note of the line number (in this case 2), and navigate there in your program.
• Try to understand why the error occurred (in this case because b is 0).

To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.

slate swan
slate swan
#

it's supposed to have

slate swan
slate swan
final iron
#

@slate swan When I get home I will try implementing the code but I do believe it was user error and not something wrong with the tutorial

slate swan
#

and it should work

slate swan
#

user error

#

you sure? check it

#

it's not a user error

manic wing
slate swan
#

its guild.icon_url

#

updated in 2.0

manic wing
#

pfft who uses 2.0

slate swan
#

all the forks , and the @unkempt canyonbot is now synced with 2.0 iirc

manic wing
#

pfffffft

urban star
#

@slate swan

#

This is channel

slate swan
#
class Newstuff(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    class MyMenu(menus.Menu):
        async def send_inital_message(self, ctx, channel):
            return await channel.send(f"**Hello, {ctx.author}.**")

        @menus.button('\N{THUMBS UP SIGN}')
        async def on_thumbs_up(self, payload):
            await self.message.edit(content=f'Thanks {self.ctx.author}!')

        @menus.button('\N{THUMBS DOWN SIGN}')
        async def on_thumbs_down(self, payload):
            await self.message.edit(content=f"That's not nice {self.ctx.author}...")

        @menus.button('\N{BLACK SQUARE FOR STOP}\ufe0f')
        async def on_stop(self, payload):
            self.stop()
    
    @commands.command()
    async def test(self, ctx):
        await self.MyMenu().start(ctx)

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotImplementedError:

#

error ends here

#

I also have no idea what '\N{THUMBS UP SIGN}' should do, I just wanna test out the examples so that I can finally start

#
roles_mention = "\n".join(role.mention for role in ctx.guild.roles[:0:-1])

How can I get the roles.id from this?

#

same way

#

iterating through ctx.guild.roles

#

I thought that too

#

didn't work

#

what did you do

#
roles_id = [role.id for role in ctx.guild.roles[:0:-1]]
#

this returns a generator object innit

#

wdym

#

Generator object at 0xsomething

#

nah it must return roles ids for roles withing the [:0:-1] index

#

what error do you get?

wispy spade
slate swan
#

nice

#

I'm gonna take my error to the dpy server

#

there are toxic professionals

#

if you server does not have any role , it will result into an error @slate swan

#
roles = sorted(ctx.guild.roles[:0:-1], key=lambda role: role.name)
        roles_mention = "\n".join(role.mention for role in ctx.guild.roles[:0:-1])
        roles_id = [role.id for role in ctx.guild.roles[:0:-1]]

        # Build a list
        role_list = []
        for role in roles_mention:
            role_list.append(f"`{roles_id}` - {roles_mention}\n")
#

how to make a bot count how many roles there are on the Discord

#
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds: Embed size exceeds maximum size of 6000
slate swan
slate swan
slate swan
#

in my server

slate swan
slate swan
slate swan
#

^ the thing tokkarevv just sent

slate swan
visual island
slate swan
#

yeah , pagination is a better way to do it if you really need to send everything

#
# Sort the roles alphabetically and remove the @everyone role
        roles = sorted(ctx.guild.roles[:0:-1], key=lambda role: role.name)

        # Build a list
        role_list = []
        for role in roles:
            role_list.append(f"`{role.id}` - {role.mention}\n")
#

this is what I did instead, but the roles are not sorted from highest rank to lowest

#

which is what im trying to do

slate swan
#

its sorted alpha

#

yes

#

role.position is what you need

slate swan
slate swan
#

!d discord.Role.position

unkempt canyonBOT
#

The position of the role. This number is usually positive. The bottom role has a position of 0.

Warning

Multiple roles can have the same position number. As a consequence of this, comparing via role position is prone to subtle bugs if checking for role hierarchy. The recommended and correct way to compare for roles in the hierarchy is using the comparison operators on the role objects themselves.

slate swan
#

or just dont sort it , it should already be sorted

#

mhm let me test that

#

Ah it works

#

im so dumb xD

#

why doesn't the bot write who is owner the server?
code:

 emb.add_field(name="Owner", value=f"{ctx.guild.owner}", inline=True)
slate swan
#

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

slate swan
#

or , you can mention them instead of their name using f"<@{guild.owner_id}>"

slate swan
# slate swan you need member intents for that

Btw, when I use role.position, the highest number is the higher rank, like I have 7 roles right, position 7 is the higher, but I want that to be printed as 1, basically reversed, so I tried doing reversed(role.position) but that doesn't work

visual island
#

you can just enumerate it

slate swan
#

it was a fricking typo

#

send_initial_message send_inital_message

slate swan
#

enumerate(role.position)

#

gives me incorrect type

visual island
#

wait, what are you trying to do?

slate swan
#

role.position gives me the position of role (a specified role)

#

so if i check role.position on my owner role (which is the highest rank)

#

i get the position 7

#

since I have 7 roles, and its the higher one

#

but I want to reverse it, so the highest one is number 1, and the lowest one is number 7

tidal hawk
#

How can I ignore discord.ext.commands.errors.CommandNotFound errors? Those errors are flooding my console D:

slate swan
#

fix them

#

jk, do you have the event on_command_error?

tidal hawk
#

Found the solution on goold old stackoverflow

visual island
slate swan
#

@visual islandlol I tried doing role_pos = (role.position+1) - role.position it didn't work well, everything was 1 haha

#

yours doesn't work either

visual island
slate swan
#
embed.add_field(name="Position", value=role.position)
visual island
#

value = abs(role.position - (7 + 1)) then?

slate swan
#

7 +1? it can vary on different guilds, that wont work

visual island
#

len(roles) + 1. That's why i gave the formula using len(guild.roles)

slate swan
#

roles isn't a thing

#

in my code

visual island
#

?

#

I thought you're using the last code

slate swan
#

I do, but i have no variable called roles nor a argument

#

but wait I got an idea

slate swan
#

That is another command

#

I can get len of a tuple right?

#

yup nah wont work

#
            embed.add_field(name="Position", value=abs(role.position - (len(parsed_roles) + 1)))

boreal ravine
#

Will this work?

    @commands.group(invoke_without_command=True)
    async def tag(self, ctx):
      pass

    @tag.command()
    async def create(self, ctx):
      await ctx.send("content")
visual island
boreal ravine
#

hm

visual island
#

hm?

slate swan
visual island
#

does your code include @everyone role?

slate swan
#

no

#

i have 7 roles (8 with everyone)

#

admin is position 6

#

owner is 7

visual island
#

what does len(parsed_roles) return?

slate swan
#
        parsed_roles = set()
        failed_roles = set()

        all_roles = {role.id: role.name for role in ctx.guild.roles}
        for role_name in roles:
            if isinstance(role_name, Role):
                # Role conversion has already succeeded
                parsed_roles.add(role_name)
                continue

            match = rapidfuzz.process.extractOne(
                role_name, all_roles, score_cutoff=80,
                scorer=rapidfuzz.fuzz.ratio
            )

            if not match:
                failed_roles.add(role_name)
                continue

            # `match` is s (role name, score, role id) tuple
            role = ctx.guild.get_role(match[2])
            parsed_roles.add(role)
#

and then I do ```py
for role in parsed_roles:
# etc....
embed.add_field(name="Position", value=abs(role.position - (len(parsed_roles) + 1)))

#

but that wont work

maiden fable
#

What do you wanna do?

slate swan
pliant gulch
#

If you want to list all the roles in a guild in reverse can't you just use reverse

gentle gyro
#

Guys

pliant gulch
#

Huh it's not documented?

gentle gyro
#

I hosted my bot on heroku...and it is throwing errors on the image commands...which use the pillow libraries

#

Any suggestions?

maiden fable
slate swan
#

another issue

#
bot_ping = (arrow.utcnow() - ctx.message.created_at).total_seconds() * 1000
        if bot_ping <= 0:
            bot_ping = "Your clock is out of sync, could not calculate ping."
        else:
            bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms"

        # Discord Protocol latency return value is in seconds, must be multiplied by 1000 to get milliseconds
discord_ping = f"{self.bot.latency * 1000:.{ROUND_LATENCY}f} ms"
``` I'm trying to get my bots ping, but it always returns the first if statement
delicate flax
#

Never seen like that

#

mb

slate swan
#

np

#

Hey guys, I am making a public discord bot and i wanna make my bot know what servers the owner of the server is in, how do i do that?

delicate flax
#

Why don't you do that to round? round(bot.latency*1000,1)

boreal ravine
#

isnt the bot ping normally > 0

#

makes sense why it did that didn't it

#

oh hm

slate swan
#

There is a issue and idk what the issue is tbh

#

could be arrow that's not working properly

slate swan
delicate flax
#

ah ok

elfin quest
#

hello i am new to pyton

manic wing
slate swan
#

what the

upbeat otter
#

Guys this is not setting the image

embed.set_image(url="attachment://wl.png")
slate swan
#
bot_ping = (arrow.utcnow() - ctx.message.created_at).total_seconds() * 1000
        if bot_ping <= 0:
            bot_ping = "Your clock is out of sync, could not calculate ping."
        else:
            bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms"

        # Discord Protocol latency return value is in seconds, must be multiplied by 1000 to get milliseconds
discord_ping = f"{self.bot.latency * 1000:.{ROUND_LATENCY}f} ms"
``` I'm trying to get my bots ping, but it always returns the first if statement
thick hamlet
#

How do you guys make your bot add a reaction to a message then it will check if a user reacted to it? I use this to make the bot react with ⚔️ to the embeded message, and it does it greatly, but when the player adds a similar reaction it doesn't get detected and I can add a different ⚔️ and the other one gets detected.

slate swan
#

please use
await ctx.send()

#

instead of
await ctx.message.channel.send()

thick hamlet
slate swan
#

that looks like a discord issue

#

if you hover over the reactions, what do they show?

kindred epoch
#

Channel is a rucuss

thick hamlet
#

they're both crossed swords

#

but one is added with it's unicode

slate swan
#

discord on top

kindred epoch
kindred epoch
dapper cobalt
unkempt canyonBOT
#

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**...
slate swan
#

add it with an str form of the emoji

upbeat otter
#

and it works for them

kindred epoch
dapper cobalt
unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
kindred epoch
#

^

upbeat otter
slate swan
#

"⚔️"

slate swan
slate swan
#

await message.add_reaction("⚔️")

upbeat otter
kindred epoch
slate swan
#

!pypi arrow

unkempt canyonBOT
dapper cobalt
upbeat otter
# slate swan full code pls
@client.event
async def on_member_join(member):
  with open("configure.json", "r") as f:
    channels = json.load(f)
  members = int(member.guild.member_count)
  try:
    channel = channels[str(member.guild.id)]["welcome"]
    welcomeChannel = client.get_channel(int(channel))
    embed = discord.Embed(title=f"Welcome {member.name}! Member: {members+1}", color=member.color)
    wanted = Image.open("images/border.png")
    asset = member.avatar_url_as(size = 128)
    data = BytesIO(await asset.read())
    pfp = Image.open(data)
    pfp2 = pfp.resize((1050, 650))
    wanted.paste(pfp2, (90, 50))
    wanted.save("wl.png")
    embed.set_image(url="attachment://wl.png")
    await welcomeChannel.send(content=None, embed=embed)
  except:
    pass
slate swan
upbeat otter
slate swan
#

waitup ill get an example

upbeat otter
kindred epoch
#

Probably the same time

slate swan
upbeat otter
slate swan
kindred epoch
#

It's the same time so either it's gonna return in negatives or only 0

slate swan
slate swan
kindred epoch
#

Wait

kindred epoch
#

@slate swan i tried it and it sent me a positive int result

#

idk why thats happening to u

#

also i used datetime

slate swan
kindred epoch
slate swan
#

2021-10-25T14:47:41.558235+00:00 2021-10-25 14:47:45.615000+00:00

kindred epoch
#

that T after the date, whats that

slate swan
#

i have no clue

#

probably time zone

#

idk, how could I use datetime instead of arrow in this case

kindred epoch
#

just import datetime and then do datetime.datetime.utcnow() instead of arrow.utcnow()

slate swan
#

whats the difference in utcnow() and now()

round yarrow
#

my bots in a server and i want to create a invite of that particular server (ik the id) how can i do that

kindred epoch
slate swan
velvet tinsel
#

Question:
I want to make a bot that stores an individual variable for each person that uses it, for example, storing points, they use, say ?balance and there is a variable stored for them, and it responds with like 1000 and somebody else says the same command but they have their own variable and the bot responds, say, 1

haughty quartz
#

how do i change my bot's activity

velvet tinsel
#

wth is database

kindred epoch
unkempt canyonBOT
#

await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
slate swan
unkempt canyonBOT
#

await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
kindred epoch
# velvet tinsel wth is database

A database is an organized collection of structured information, or data, typically stored electronically in a computer system. ... The data can then be easily accessed, managed, modified, updated, controlled, and organized. Most databases use structured query language (SQL) for writing and querying data.

slate swan
slate swan
kindred epoch
slate swan
#
        bot_ping = (datetime.datetime.utcnow() - ctx.message.created_at).total_seconds() * 1000

kindred epoch
#

and how did you import datetime

slate swan
#
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can't subtract offset-naive and offset-aware datetimes
#

import datetime

kindred epoch
#

ok

kindred epoch
#

instead of utcnow()

slate swan
#

same thing happens, already did

kindred epoch
slate swan
#

how is that possible

haughty quartz
slate swan
#

My timezone is CEST, 2021-10-25 16:55

velvet tinsel
#

its seems pretty limited

slate swan
# velvet tinsel its seems pretty limited

haha, if you think of storing those information in a file and access them like a variable, you'd have to use json or something similar, and it will eat up your space in your system

velvet tinsel
#

yay

kindred epoch
#

yay?

velvet tinsel
#

ok

kindred epoch
#

json as a db?

slate swan
round yarrow
#

my bots in a server and i want to create a invite of that particular server (ik the id) how can i do that

kindred epoch
#

lol no

velvet tinsel
#

nah i was being sarcastic

kindred epoch
#

lol

dapper cobalt
unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
dapper cobalt
#

Get a channel from that server and create an invite for it.

#

Though, you cannot create an invite for the guild itself.

round yarrow
#

oh okay

slate swan
#
bot_ping = (datetime.datetime.now() - ctx.message.created_at).total_seconds() * 1000

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can't subtract offset-naive and offset-aware datetimes

we think the issue might be because of my system datetime being out of sync, but how can I fix that?

dapper cobalt
unkempt canyonBOT
#

property latency: float```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.

This could be referred to as the Discord WebSocket protocol latency.
slate swan
#

not what I'm trying to do

dapper cobalt
shy schooner
#

how can i remove roles from User object, not Member, I used bot.get_user(id) to fetch a user but didn't know how to remove a role from them

boreal ravine
unkempt canyonBOT
boreal ravine
#

literally the same syntax

dapper cobalt
#

You can't manage a User object's roles.

slate swan
boreal ravine
#

whats the diff between member/user class

shy schooner
dapper cobalt
round yarrow
dapper cobalt
#

There's a big difference.

round yarrow
#

i fetched a random channel and made an invite of it

boreal ravine
round yarrow
#

yeah i did use the guild id

boreal ravine
#

what

round yarrow
#
@client.command()
async def guildinv(ctx):
    guild = client.get_guild(830316313808470057)
    channel = guild.channels[1]
    invitelink = await channel.create_invite(max_uses=1)
    await ctx.author.send(invitelink)```
boreal ravine
#

thats channel

velvet tinsel
#

cool

boreal ravine
#

oh

#

ur accessing a channel from a guild object

#

still a channel

dapper cobalt
slate swan
boreal ravine
#

isnt the syntax for .channels like this?

category:
  channel
``` i think he was doing this
dapper cobalt
unkempt canyonBOT
#

@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.

001 | first item
002 | second item
boreal ravine
#

just saying .channels

#

returns the categories too

slate swan
dapper cobalt
#

Ah.

#

@round yarrow try channel = guild.text_channels[0].

slate swan
#

Dpy 2.0's .created_at returns a timezone aware datetime

slate swan
dapper cobalt
#

!d discord.Guild.text_channels

unkempt canyonBOT
#

property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
slate swan
#

oh

slate swan
slate swan
#

And since it's a datetime object you can use .replace(tzinfo=None) to make it naive again

slate swan
#

I got it working

#
        time_1 = time.perf_counter()
        await ctx.trigger_typing()
        time_2 = time.perf_counter()
        bot_ping = (time_2-time_1)*1000
#

¯\_(ツ)_/¯

lyric moat
#

why when i do this the command does not send

          r = requests.get("https://nekos.life/api/v2/img/kill")
          res = r.json()
          embed = discord.Embed(color=0x2f3136,
              timestamp=datetime.datetime.utcnow(),
              description=f"{ctx.author.mention} killed {user.mention}",
          )```
slate swan
#

Well, you're not sending it anywhere

#

Also don't use requests, it's blocking

#

the , after description = "..... may be painful

#

Why?

lyric moat
#

when i use hug it works :/

lyric moat
boreal ravine
#

use aiohttp for an async enviroment

slate swan
#

As i said, you're not sending the message

slate swan
slate swan
lyric moat
slate swan
slate swan
boreal ravine
slate swan
#

It doesn't

boreal ravine
#

!e print("hi",)

unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

hi
lyric moat
slate swan
lyric moat
#

i said kill

#

?

boreal ravine
#

!e

def a(b, c, d,):
  return b
print(a(1, 2, 3))
unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

1
boreal ravine
#

still works easy

lyric moat
#

why hug works but not kill ??

boreal ravine
slate swan
#

Yeah and it won't magically send your message if you're not sending it wtf

lyric moat
lyric moat
#
  @commands.command()
  async def kill(self, ctx, user: discord.Member = None):
      if user is None:
          await ctx.send(f"`{ctx.author}` you must mention a user to do that!")
      else:
          r = requests.get("https://nekos.life/api/v2/img/kill")
          res = r.json()
          embed = discord.Embed(color=0x2f3136,
              timestamp=datetime.datetime.utcnow(),
              description=f"{ctx.author.mention} killed {user.mention}",
          )
          embed.set_image(url=res['url'])
          embed.set_footer(text=f"{ctx.guild.name}")
    
          await ctx.send(embed=embed)```
warped quail
#

oh thank goodness there is a dedicated channel for this, I want to make a discord bot that does a couple of hopefully simple things for a game server I am running. It needs to download files from a file server, then execute a command in the game's cmd and write to a cfg file which is just a text file. Never done anything with python before and I want to get this up soon not in 4-6 months after I learn python "real quick"

#

is there another way to go about making a discord bot

slate swan
#

What you want to do requires quite some knowledge

brazen raft
#

By learning discord botting with a programming language you already know.

slate swan
#

And no one's gonna baby sit you until you learn python

warped quail
#

never done any programming before :/

slate swan
#

Nor gonna spoonfeed/give you already made code

warped quail
#

ok

slate swan
haughty quartz
#

how can i add a image in the footer

#

of embed

slate swan
lapis lintel
#

Where can I find what does ctx is in the docs?

slate swan
boreal ravine
unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
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/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
haughty quartz
#

embed.set_footer(text="bot made by gorgonzola#6770")

slate swan
#

It's a kwarg so it doesn't matter where

haughty quartz
#

ok

boreal ravine
haughty quartz
#

i already saw it in footer many times tho huh

boreal ravine
#

how big was it

haughty quartz
#

small

#

icon like image

lyric moat
#

it works just when i put killed at

https://nekos.life/api/v2/img/kill```
it would not work
haughty quartz
#
@client.command(name="help")
async def helpDef(ctx):
  embed=discord.Embed(title="SCS Search Bot Commands", description="doenst matter",color=0xffffff)
  embed.set_thumbnail(url="doesnt matter")
  embed.add_field(name=":scroll: Commands:", value="doesnt matter", inline=True)
  embed.set_footer(text="bot made by gorgonzola#6770")

  await ctx.send(embed=embed)
``` why do i get ```Traceback (most recent call last):
  File "main.py", line 42, in <module>
    async def helpDef(ctx):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1263, in decorator
    self.add_command(result)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1149, in add_command
    raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.```
slate swan
haughty quartz
#

oh lol

#

how can i access it

boreal ravine
#

@lyric moat

#

L

lyric moat
boreal ravine
#

KeyError: "url"

slate swan
#

client.remove_command('help') right below where you define client

lyric moat
boreal ravine
lyric moat
boreal ravine
#

thats hug

#

your code was kill

lyric moat
#

yeah

boreal ravine
#

yes

#

they url was invalid

lyric moat
#

what could i put instead of kill?

boreal ravine
#

idk?

slate swan
#

any1 who can send me a example code on how to use on_command_error?

outer violet
#

Which ones better to use, mongodb or SQLite?

blazing beacon
#

does anyone know how to use the read messages scope on apps

boreal ravine
boreal ravine
outer violet
#

What does that means

boreal ravine
#

idk if u sqlite better but harder but mongo easier

rare saddle
#

Why is the error that there is no argument displayed to me in the command line, and not in the chat?

maiden fable
#

Wym...?

rare saddle
maiden fable
#

Ah, u never gave default values

#

member: discord.Member=None

rare saddle
slate swan
#

I'm trying to get a list of reactions on a post and then loop through them to delete them if they are in a list of mine.

#
if str(payload.emoji) in letters:
            print ('yea')
            uprint(msg.reactions)```
#

!src docs

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
slate swan
#

?

maiden fable
slate swan
#

cap

maiden fable
slate swan
maiden fable
#

I mean, what's the problem?

slate swan
#

read my message above it

#

trying to figure out the next step

maiden fable
#

Ah

slate swan
#

i'm staring at the discord docs for reactions. I can't seem to figure out

#

only attributes for class discord.Reaction are count,customer_emoji,emoji,me,message

maiden fable
#

!d discord.RawReactionActionEvent

unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
maiden fable
unkempt canyonBOT
#
Nope.

No documentation found for the requested symbol.

maiden fable
#

Breh

slate swan
#

not exactly what i am looking for

maiden fable
#

Ah, it's message_id

#

U gotta fetch the message

slate swan
#

I am trying to get list of reactions on a message. then loop through them and delete ones in the list

#

Has someone checked this?
Please help me

#

message has been fetched

maiden fable
#

!d discord.PartialMessage.clear_reactions

unkempt canyonBOT
#

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

Removes all the reactions from the message.

You need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this.
slate swan
#

not trying to clear reactions, those clear all reactions

maiden fable
#

Ah no need to fetch

slate swan
#

i'm only trying to delete certain ones

maiden fable
#

!d discord.TextChannel.get_partial_message

unkempt canyonBOT
#

get_partial_message(message_id, /)```
Creates a [`PartialMessage`](https://discordpy.readthedocs.io/en/master/api.html#discord.PartialMessage "discord.PartialMessage") from the message ID.

This is useful if you want to work with a message and only have its ID without doing an unnecessary API call.

New in version 1.6.
maiden fable
#

Use this, don't fetch the message. Save an API Call

#

!d discord.PartialMessage.remove_reaction

unkempt canyonBOT
#

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

Remove a reaction by the member from the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.

The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
maiden fable
#

There, use this

slate swan
#

not what i'm looking for I don't think

maiden fable
#

!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
#

this doesn't give me a list of them that I can loop through and delete

slate swan
maiden fable
slate swan
#

no

maiden fable
slate swan
#

that's not what i'm looking for

maiden fable
#

Then?

slate swan
#

i can do that easily

maiden fable
#

Okay....?

#

So what u wanna do?

slate swan
#

okay again

#

I'm looking to get a list of reactions on a post... then loop through them and IF they're in a list delete them

#

not as they're being added

maiden fable
slate swan
#

!d discord.Message.reactions

unkempt canyonBOT
slate swan
#

And loop

maiden fable
#

Okay, so

slate swan
#

And check

maiden fable
#

I was fast

rare saddle
#

How do I get a list of all the roles a user has?

#

member.roles ?

maiden fable
unkempt canyonBOT
#

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.
slate swan
rare saddle
maiden fable
unkempt canyonBOT
slate swan
#

But there is no guide on how to edit embeds.

maiden fable
#

You just do

embed = message.embeds[0]
embed.description = "I edited an embed!!!"
await message.edit(embed=embed) 
slate swan
#

with python await msg.remove_reaction(payload.emoji, payload.member)
using just msg.reactions I cannot get member

maiden fable
#

!d discord.Reaction

unkempt canyonBOT
#

class discord.Reaction```
Represents a reaction to a message.

Depending on the way this object was created, some of the attributes can have a value of `None`.

x == y Checks if two reactions are equal. This works by checking if the emoji is the same. So two messages with the same reaction will be considered “equal”.

x != y Checks if two reactions are not equal.

hash(x) Returns the reaction’s hash.

str(x) Returns the string form of the reaction’s emoji.
slate swan
#

count, emoji, me, message

#

is what i can get

maiden fable
#

Eh, lemme see

slate swan
#

yeah that's really what i'm trying to figure out

#

haha thanks for your help

maiden fable
#

Just do reaction.remove

#

!d discord.Reaction.remove

unkempt canyonBOT
#

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

Remove the reaction by the provided [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") from the message.

If the reaction is not your own (i.e. `user` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.

The `user` parameter must represent a user or member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
maiden fable
#

Wait 🤦

unkempt canyonBOT
maiden fable
#

There

slate swan
#

uhh. how can I do that

#

okay let me see for a min, confused on that

haughty quartz
#

@client.command(name="wallpapers") how can i have a 2nd possibility like || in js

haughty quartz
#

yes

maiden fable
#

Just do (name="", aliases=[list of strings])

slate swan
#

so i use msg.reactions to get the list then loop through the list and use reaction.me?

haughty quartz
#

uh alright

maiden fable
forest blade
#

Do you not have a RawReactionActionEvent object? Since you named it payload I am assuming you are using one of the raw reaction events

slate swan
slate swan
maiden fable
unkempt canyonBOT
#

property fields: List[_EmbedFieldProxy]```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of `EmbedProxy` denoting the field contents.

See [`add_field()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.add_field "discord.Embed.add_field") for possible values you can access.

If the attribute has no value then [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") is returned.
maiden fable
slate swan
slate swan
maiden fable
maiden fable
haughty quartz
maiden fable
#

I am literally helping 3-4 people at one time lmao

slate swan
#

Ok then, you mean I should enter some number here, and while editing, I should be doing edit.embed[*that number*]

maiden fable
#

!kwarg-arg

rare saddle
#

Correctly written function to remove all roles?

maiden fable
#

!positional-keywords

unkempt canyonBOT
#

Positional vs. Keyword arguments

Functions can take two different kinds of arguments. A positional argument is just the object itself. A keyword argument is a name assigned to an object.

Example

>>> print('Hello', 'world!', sep=', ')
Hello, world!

The first two strings 'Hello' and world!' are positional arguments.
The sep=', ' is a keyword argument.

Note
A keyword argument can be passed positionally in some cases.

def sum(a, b=1):
    return a + b

sum(1, b=5)
sum(1, 5) # same as above

Somtimes this is forced, in the case of the pow() function.

The reverse is also true:

>>> def foo(a, b):
...     print(a, b)
...
>>> foo(a=1, b=2)
1 2
>>> foo(b=1, a=2)
2 1

More info
Keyword only arguments
Positional only arguments
!tags param-arg (Parameters vs. Arguments)

maiden fable
#

There

maiden fable
unkempt canyonBOT
#

await remove_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
maiden fable
#

Yups

#

was seeing if its a kwarg or arg

slate swan
slate swan
#

like this?

slate swan
maiden fable
#

Ah, it should be x.remove

slate swan
#

oh yes

maiden fable
#

My bad, sorry

slate swan
#

my bad!

slate swan
slate swan
maiden fable
maiden fable
slate swan
maiden fable
#

New code

slate swan
#
@bot.event
async def on_message(message):

  if '@worn fern' in message.content:
    await message.channel.send('test')
maiden fable
#

Wait, u can use message.mentions

#

!d discord.Message.mentions

unkempt canyonBOT
#

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.

maiden fable
#

!d discord.Message.raw_mentions

unkempt canyonBOT
#

A property that returns an array of user IDs matched with the syntax of <@user_id> in the message content.

This allows you to receive the user IDs of mentioned users even in a private message context.

rare saddle
maiden fable
#

Use the second one

slate swan
#

okay

maiden fable
#

Wait, lemme get on my pc. Gimme 1

#

any errors?

slate swan
#

@maiden fablebtw this is for when i tag the bot then the bot send a text

haughty quartz
#

@client.command(name="", aliases =["best cube", "best yter"]) how can I use a space character in my command name?

maiden fable
unkempt canyonBOT
maiden fable
#

just use if bot.user.mentioned_in(message)

slate swan
# maiden fable It's fine haha. Happy to help

  File "C:\Program Files\Python39\lib\site-packages\discord\reaction.py", line 122, in remove
    await self.message.remove_reaction(self.emoji, user)
  File "C:\Program Files\Python39\lib\site-packages\discord\message.py", line 1259, in remove_reaction
    if member.id == self._state.self_id:
AttributeError: 'bool' object has no attribute 'id'```
maiden fable
slate swan
#

any idea what this is talking about

maiden fable
haughty quartz
#

what should it be

maiden fable
haughty quartz
#

oh

slate swan
#
for x in msg.reactions:
  if str(x.emoji) in letters:
    await x.remove(x.me)```
haughty quartz
maiden fable
maiden fable
slate swan
maiden fable
haughty quartz
haughty quartz
#

ok thx :D

#

tysm

slate swan
#

@maiden fable
x.me = False
x.emoji = \U0001f1f8
x = \U0001f1f8

waxen gyro
#

Guys I have one question

maiden fable
#

!d discord.Reaction

unkempt canyonBOT
#

class discord.Reaction```
Represents a reaction to a message.

Depending on the way this object was created, some of the attributes can have a value of `None`.

x == y Checks if two reactions are equal. This works by checking if the emoji is the same. So two messages with the same reaction will be considered “equal”.

x != y Checks if two reactions are not equal.

hash(x) Returns the reaction’s hash.

str(x) Returns the string form of the reaction’s emoji.
waxen gyro
# waxen gyro Guys I have one question

I have a class (in my Discord bot made using a d.py fork) like this:```py
class MyClass(discord.ui.View):
def init(self):
super().init(timeout=10)

@discord.ui.select(a_parameter=<something>)

...

I want to put a class attribute inside that `<something>` like `@discord.ui.select(a_parameter=self.options)`
How do I achieve this? I just want one class attribute inside the decorator but it shows wrong syntax, this is my issue, any idea how can I work this out?
maiden fable
#

lemme see, seems like I did something wrong

maiden fable
#

instead u can use add_item in the init

#

!d discord.ui.View.add_item

unkempt canyonBOT
waxen gyro
#

I am using add_item atm

maiden fable
unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Examples

Usage

```py
# I do not actually recommend doing this.
async for user in reaction.users():
    await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
waxen gyro
maiden fable
#

this returns the list of users who reacted with that emoji @slate swan

waxen gyro
maiden fable
rare saddle
#

Why doesn't the bot remove roles?

maiden fable
waxen gyro
maiden fable
waxen gyro
maiden fable
#

!d discord.ui.Button just subclass this instead and add this inside the view

unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
slate swan
waxen gyro
#

But I want it to remove the components from the message on timeout

maiden fable
rare saddle
waxen gyro
#

And the problem is once I use a component, the timeout restarts instead of stopping

slate swan
waxen gyro
#

So it removes the components 10 seconds after I use the component

rare saddle
#

@maiden fable

waxen gyro
#

I don't want it to do that

maiden fable
maiden fable
waxen gyro
maiden fable
#

Ah just do *roles

rare saddle
maiden fable
waxen gyro
#

I want it to remove the components only if the components were not used, not otherwise

maiden fable
waxen gyro
#

Sure

rare saddle
maiden fable
maiden fable
slate swan
rare saddle
maiden fable
maiden fable
maiden fable
slate swan
#

totally get it

#

thanks for all you're doing

maiden fable
#

It's fine haha

rare saddle
maiden fable
#

another error?

rare saddle
#

The same

maiden fable
#

oof any traceback?

rare saddle
slate swan
#

NameError: name 'reaction' is not defined

@maiden fable

maiden fable
#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.

A full traceback could look like:

Traceback (most recent call last):
    File "tiny", line 3, in
        do_something()
    File "tiny", line 2, in do_something
        a = 6 / b
ZeroDivisionError: division by zero

The best way to read your traceback is bottom to top.

• Identify the exception raised (in this case ZeroDivisionError)
• Make note of the line number (in this case 2), and navigate there in your program.
• Try to understand why the error occurred (in this case because b is 0).

To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.

waxen gyro
maiden fable
#

and no, u did it wrong

#

you gotta save the button in a class variable

slate swan
#

for x in msg.reactions:
users = await 
   reaction.users().flatten()
   print (users)```
maiden fable
#

wait

#

users = await x.users()

waxen gyro
maiden fable
#
self.btn = ButtonClass()
self.add_item(self.btn)
if self.btn.counter != 0:
    # never used
slate swan
waxen gyro
#

Oh ok

#

I'll try it out, just a min

haughty quartz
#

how can i make my bot case insensitive

maiden fable
#

you cannot

haughty quartz
#

WHAT

maiden fable
#

you can only make commands case insensitive

waxen gyro
#

commands.Bot(case_insensitive:bool)

slate swan
#

why command

asyncio.sleep(60*20)

Dont Work????

haughty quartz
slate swan
maiden fable
#

Yea that

waxen gyro
maiden fable
#

Thanks Sarthak (I am literally fucked up rn lmao)

slim whale
#

how i can make an embed with every line like a description?

#

like everything like the smiling face

slate swan
#

!d discord.Embed.description

unkempt canyonBOT
slim whale
#

i know hot to make the description

#

but i want to add more lines to it

maiden fable
slate swan
#

feels like i'm getting close lol @maiden fable

for x in msg.reactions:
    if str(x.emoji) in letters:
       users = x.users()
       for yy in users:
       await msg.remove_reaction(x.emoji, yy)```
maiden fable