#discord-bots

1 messages ยท Page 657 of 1

slate swan
#

Guys keep this civil

prisma spoke
#

how else do i reply bruv

shadow wraith
#

trolleybus means troll

vast gale
#

I looked on the stats on discord, and disnake has the most changes made since it's been forked, dwarfing the other libraries by thousands of changes.

pycord has done some sketchy stuff, and nextcord forcibly installs the discord namespace in addition to nextcord.

prisma spoke
vast gale
#

tldr nextcord and pycord's success is mostly due to YouTube

shadow wraith
#

apparently discord-interactions uses discord_slash and ik how to use discord_slash so this should be ez

slate swan
tiny ibex
#

Disnake best

vast gale
#

discord-interactions is confusing with the library of the same name, discord-interactions

slate swan
#

And most pycord/nextcord vids are outdated

vast gale
#

!pypi discord-interactions <- this is my discord Inc themselves

unkempt canyonBOT
vast gale
#

discord-py-interactions is actually the lib you would use-- but they intentionally moved the repo and naming, and became more confusing, idek why

slate swan
#

๐Ÿคทโ€โ™‚๏ธ

vast gale
slate swan
vast gale
tiny ibex
prisma spoke
#

who can help wwith an aiosqlite question here?

slate swan
#

Disnakes only competitor is djs

vast gale
#

tldr: issue tracker spam and help questions.

pycord and nextcord both have a lot of these, but I haven't seen any of disnake ๐Ÿ‘€

#

also their support server doesn't provide that much support

#

it moves slower than my grandma in a 10 mile race

slate swan
vast gale
#

ye

#

they provide support when ppl ask, but ppl don't ask much

prisma spoke
#
@bot.command(aliases=["regs"])
async def registrations(ctx):
    cur = await bot.db.cursor()
    await bot.db.execute("SELECT * FROM users")
    membs = await cur.fetchall()
    for memb in membs:
        await ctx.send(memb[0] + "" + memb[1] + "" + memb[2])``` no output displayed//
slate swan
#

Server isnt quite big but the people there are very knowledgeable

vast gale
#

I should add a disclaimer now: I'm a contributor to disnake after finding how good it was

slate swan
prisma spoke
#

idk but soon

vast gale
slate swan
slate swan
vast gale
#

ironically, I feel like disnake is easier to use, but if I get a chance I'll be seeing if I can make a few features with pycord

#

even though I strongly dislike pycord for reasons

prisma spoke
#

u said one thing 5 times

vast gale
#

which lib

glass rock
#

does fetch_message return Member class?

slate swan
vast gale
#

make a check that will return false in the provided guild

glass rock
slate swan
glass rock
#

xy?

vast gale
#

!docs discord.Guild.fetch_member

unkempt canyonBOT
#

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

Retrieves a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.

Note

This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.
slate swan
#

error in line 41

slate swan
vast gale
vast gale
#

oh

slate swan
slate swan
vast gale
slate swan
#

Just use disnake as it has slash commands built in

vast gale
glass rock
#

i would like to get it from message ID

#

is that possible?

vast gale
unkempt canyonBOT
slate swan
glass rock
#

i have a message ID. Using fetch_message returns the message. Is this a string?

slate swan
vast gale
# slate swan Ah i see

I remember when there were third party supplements, they tended to fail and error with discord.ui.*

prisma spoke
slate swan
#

it joined vc too

slate swan
glass rock
slate swan
vast gale
#

you're gonna have to provide more than that.

slate swan
#

okay

prisma spoke
earnest ferry
prisma spoke
vast gale
#

why not follow that guide, lol?

prisma spoke
#

or i am the mad one

earnest ferry
#

bro the code is not woring

#

not online

prisma spoke
#

dude whaat? u srs rn?

slate swan
earnest ferry
#

yep is not online

slate swan
earnest ferry
#

pls help me the bot is not online

slate swan
#

I dont spoonfeed if you didnt do something right you didnt pay attention in the tutorial given

prisma spoke
slate swan
#

Most of them arent up to date but the one given isnt from yt

prisma spoke
earnest ferry
slate swan
prisma spoke
#

my bot also wudnt come onine there

slate swan
slate swan
prisma spoke
prisma spoke
earnest ferry
#

bot.run("your_token_here")

prisma spoke
earnest ferry
#

then what is best editor>?

slate swan
earnest ferry
#

ye

prisma spoke
#

Visual studio code

slate swan
earnest ferry
#

link?

prisma spoke
#

not pycharm

slate swan
prisma spoke
#

Pychrm makes ur Pc go brrrrrrrrr

earnest ferry
#

link plz

#

is it online editor?

slate swan
#

Not pycharms problem

slate swan
prisma spoke
prisma spoke
slate swan
earnest ferry
#

should we download it?

prisma spoke
slate swan
#

Your making stupid assumptions saying replit is bad without a balid reason

modest plover
#

Get Visual Studio Code.

prisma spoke
#

a download button

slate swan
prisma spoke
modest plover
#

It's not online however it is one of the most useful and best code editors out there currently.

prisma spoke
slate swan
slate swan
#

I've written a code to send an mp3 file in channel, but bot responds as <discord.file.File object at 0x7fe44d5676f0>

modest plover
slate swan
prisma spoke
earnest ferry
#

ok downloaded now?

prisma spoke
slate swan
prisma spoke
modest plover
#

If you clicked download and ran the .exe installer, then yes it's installed. @earnest ferry

slate swan
earnest ferry
#

then?

modest plover
#

Did you run the thing that downloaded?

prisma spoke
slate swan
#

try and except is only to join vc,and the bot is joining vc without errors @prisma spoke

modest plover
maiden fable
#

๐Ÿ˜

earnest ferry
#

ok

maiden fable
#

What's happening here

earnest ferry
#

fights

slate swan
prisma spoke
earnest ferry
#

lol

prisma spoke
slate swan
#

the bot basically has almost nothing to cache

maiden fable
#

Since the number of bots on replit have increased considerably

slate swan
ashen notch
#

That link will bounce, guys

#

Since it's considered pretty rude to drop at users

prisma spoke
slate swan
#

What link was that anyway?

maiden fable
#

You can't say it's "bad practice" but u really can't do anything since it will be ratelimited as soon as u start it

modest plover
#

Replit sucks ass if you're planning to host the bot permanently. If it's just for testing purposes, and not as a host, then I'd say replit is ok-ish. Still don't recommend it but as a last resort, it's usable

ashen notch
#

Yeah

maiden fable
earnest ferry
#

my my

prisma spoke
#

@ashen notch can u help with a db question please?

maiden fable
ashen notch
#

About on par with "lmgtfy"

slate swan
maiden fable
#

Ah

vocal plover
#

Hem your hat has two bobbles I like it

earnest ferry
#

uh craoop

ashen notch
#

@vocal ploverYou can thank Kat for that

modest plover
#

What's up @earnest ferry?

maiden fable
#

Lmfao

earnest ferry
#

ye downloadin

ashen notch
#

I asked her to make it silly, she delivered

vocal plover
#

Lol

kindred drum
#
@bot.event
async def on_raw_reaction_add(reaction):
    if reaction.member.bot:
        print("check 1")
        return
    if reaction.emoji == "๐Ÿ‘":
        print("Noted")
        await reaction.message.channel.send(f"Verified by {reaction.author.id}")``` Anyone know why the second if statement doesn't print or do anything? no error
earnest ferry
#

its loadin

prisma spoke
# maiden fable I can. What's up
async def brackets(ctx, p:int):

    while 0!=p:
        data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT 2;")    
        dataa  = await data.fetchall()
        await ctx.send(dataa)

        p-=1
    ``` ok so i want it like the 1st msg sent by the bot...any of the content of that msg shudnt be equal to the second one
maiden fable
kindred drum
#

I did

earnest ferry
#

clicked on run

prisma spoke
#

basically its a tourney brackets thing

maiden fable
#

Okay

prisma spoke
maiden fable
#

Ah it should be while p != 0

#

Well same thing but the other one is considered better ngl

prisma spoke
vast gale
prisma spoke
vocal plover
#

Am on mobile :(

earnest ferry
#

hlo? i downloaded vsc

prisma spoke
prisma spoke
#

create a file that ends with .py

earnest ferry
#

wait

vast gale
slate swan
#

You can do it in vsc

vast gale
#

and you committed it

vocal plover
#

Ok look

#

I'm a bad web dev dogekek

vast gale
#

no excuses, even discord has a better mobile app

prisma spoke
#

@maiden fable

maiden fable
#

Hi

slate swan
#

Mentioning and spamming won't give you more attention nor better help

vocal plover
#

Holy fuck you're right arl that is bad

earnest ferry
vast gale
#

yeah

prisma spoke
slate swan
maiden fable
vocal plover
#

I can fix it in 2 ways:
Be a better Dev
Yeet it

mmlel

vast gale
#

or make an issue and someone else might fix it

prisma spoke
vocal plover
#

You can probably do that easier than me rn lol

vast gale
#

issues-- the best way to solve a problem, letting someone else solve the problem

slate swan
#

Can you stop... @prisma spoke

#

People will help if they want/can

#

Spamming and pinging definitely won't make them want to help you

prisma spoke
prisma spoke
slate swan
#

Patience is part of being a developer

vocal plover
#

No I said I was on mobile, implying I couldn't help currently

kindred drum
#
@bot.event
async def on_raw_reaction_add(reaction):
    if reaction.member.bot:
        print("check 1")
        return
    print(reaction.emoji)
    if reaction.emoji == "๐Ÿ‘":
        
        print("Noted")
        await reaction.message.channel.send(f"Verified by {reaction.author.id}")``` how does that second statement not run
kindred drum
#

bro what

#

how is it indentation if I don't get an error

prisma spoke
maiden fable
maiden fable
kindred drum
#

what thats just see what the emoji was that was reacted to

#

and its the correct one

prisma spoke
#

and not print it

kindred drum
#

๐Ÿคฆ

maiden fable
#

Uhhhh?

prisma spoke
daring olive
#

@prisma spokedo not spam your requests for help please

maiden fable
#

Yea gimme just one opening discord on my PC

lament mesa
prisma spoke
maiden fable
#

@kindred drum the bot is reacting so it's triggering the first if statement and then returning

daring olive
#

regardless, no one is ever obligated to help you on this server. every one is free to walk away :) that's what makes this server the way it is. no strings attached. feel free to open a help channel #โ“๏ฝœhow-to-get-help and you may get more people willing to help you there.

maiden fable
#

It's printing check 1

kindred drum
#

it prints it once

maiden fable
#

Meaning the first if statement is being printed

kindred drum
#

because the bot reacts once

maiden fable
#

Oh

#

Hmmmmmmmmmmmmm

#

Try removing the return

lament mesa
kindred drum
#

nope

lament mesa
#

hmm

daring olive
# prisma spoke no one helps in a channel

server traffic varies depending on the day and time. people do answer help channels. if you've tried several times without a response, consider re-forming your question. see this guide for how to write good questions. https://www.pythondiscord.com/pages/guides/pydis-guides/asking-good-questions/. that being said you're free to ask your question in this channel too. just don't spam it, and especially do not feel that anyone is obligated to help you please.

kindred drum
#

I don't understand it at all

#

because I have this event

#
@bot.event
async def on_reaction_add(reaction, user): 
    if reaction.emoji == "๐Ÿ’ธ":
        if user == bot.user:
            return
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['paypal_bool'] = True
                    Json_Items[i][x]['aids_variable'] = int((Json_Items[i][x]['aids_variable']) + 1)
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        roleID = 915961885738819604
        roleObj = user.guild.get_role(roleID)
        await user.add_roles(roleObj)``` which works perfectly
lament mesa
#

maybe try type casting it to string

kindred drum
#

and I tried on reaction_add but it was cached or something

earnest ferry
#

@prisma spoke

#

done lol

rose shale
#

hey , in lavalink bot i should run lavalinkjar in the beginning and then the script , so how can i do this in replit?

shadow wraith
#

does anyone here use discord-py-interactions (aka discord_slash and discord-interactions)

prisma spoke
kindred drum
#

omg you just solved this THANK YOU!

#

Had to assign it to a string for some strange reason

daring olive
#

i would if i could. i know nothing about discord bots :P

late wigeon
#

is there an event that is called whenever an interaction button is pressed?

lament mesa
#

on_interation_click iirc

#

nvm thats not an event

kindred drum
#
@bot.event
async def on_raw_reaction_add(reaction):
    if reaction.member.bot:
            print("check 1")
            return 
    print(reaction.emoji)
    if str(reaction.emoji) == "๐Ÿ‘":
        
        print("Noted")
        await reaction.send(f"Verified by {reaction.author.id}")
    ``` How do I send the message
late wigeon
kindred drum
#

and then what would it be

lament mesa
late wigeon
#

I think it's reaction.message.channel

lament mesa
#

!d discord.RawReactionActionEvent.channel_id

unkempt canyonBOT
kindred drum
#

How do I remove the reactions from the message? I tried reaction.clear() and reaction.remove() and they both don't work

opal skiff
#
slash = SlashCommand(client=client,sync_commands=True)

@slash.slash(name="ping",guild_ids=[867750507774869545])
async def _ping(ctx):
    await ctx.send(content=f"Pong! ({round(client.latency*1000)}ms)")``` when i use the command it tells me "interaction failed" how do i fix this? i use discord_slash
slate swan
#

What library is that

opal skiff
#

discord_slash

slate swan
#

No idea about that library , sorry

slate swan
unkempt canyonBOT
#

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

Clears a specific reaction 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").

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.

New in version 1.3.
slate swan
#
    client.run("")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 666, in start
    await self.connect(reconnect=reconnect)
  File "/opt/virtualenvs/python3/lib/python3.8/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.```
#

guys how to settle it

tawdry perch
#

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

opal skiff
#

Does someone know some good and working slash command handler packages?

tawdry perch
#

Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions

    permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
    await role.edit(reason="shutdown", permissions=permissions)
    await ctx.send(f"Server shut down.")
#

but users with the role self.default (member role) can still chat

kind wind
#

mention a user by id in message? this is a question

tawdry perch
#

or if you have member object you can do member.mention

kind wind
#
@bot.command() #SUBMIT BOT COMMAND
async def submitbot(ctx):
    mentionedbot = '{0.member.mention}'
    await ctx.reply("Your request has been submitted! Bot submitted: " + mentionedbot)
tawdry perch
#

you want to mention command author?

kind wind
#

no

#

mention user mentioned in command by id

tawdry perch
kind wind
#

like v!mention 608575327811272704 and response will be like:
@kind wind
but behind the code the id given will go into the <@id> system to be able to tag people even out of the server

kindred drum
#
await discord.Message.clear_reactions("๐Ÿ‘")```
opal skiff
opal skiff
#

you just have to edit the code to fit your code

opal skiff
slate swan
opal skiff
# kind wind like?
mention = f"<@{yourmessagestringvariable.replace("v!mesntion ","")}>"``` like this. You have to change the message string variable to your message.content
kindred drum
quaint epoch
#

Hey guys how do i check if a member is a bot in the async def on_message(message):

slate swan
red blade
#
        for k, v in ordered.items():
            if k in users:
                if users[k] == 0:
                    """Idk what goes here"""
            member = ctx.guild.get_member(int(k))
            e.add_field(name = f"{index}. {member}", value = users[str(member.id)]["level"], inline = False)
            if index == 20:
                return
            else:
                index += 1```
How do i make it so for the `if users[k] == 0:` it will ignore that user if it is 0
slate swan
#

can I manually add a member to cache

#

curious

vast gale
vocal plover
#

yes Kek

vast gale
#

DisnakeDev/website#3

lament depotBOT
gloomy pewter
#

How to loope emoji in pycord?

#

for emoji in ctx.guild.emojis:
....

gloomy pewter
tawdry perch
#

Try it

gloomy pewter
#

okay

wild imp
#

why this is not working pls help

tawdry perch
#

Wdym by not working?

wild imp
#

the event was suppose to send message

#

but it didn't

#

and no console errors

tawdry perch
#

Is the first if statement True?

wild imp
#

idk

tawdry perch
#

Start by adding a print after it

wild imp
#

ok

#

ohh it worked tysm

#

nvm

tawdry perch
#

So it's more working?

wild imp
#

sorry

#

it didn't worked forgot to shutdowm my real bot

#

@tawdry perch still not working any solution?

tawdry perch
#

Is the first if statement returning True?

wild imp
#

idk about that

#

are you in repl?

#

i can invite you

tawdry perch
#

I can't join replit

wild imp
#

o

wild imp
tawdry perch
#

Add a print statement after the first if statement and see if it print anything when event is triggered

wild imp
#

ok

slate swan
#

hi

#

what do i do

kindred drum
#

discord.Message.clear_reactions() what do I put in the parameters

tawdry perch
wild imp
#

ok so its not trigering

slate swan
tawdry perch
unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

wild imp
#

no console print

slate swan
tawdry perch
wild imp
vocal shoal
#

Is it possible to give a command its own help command that is different from the other commands' help?

tawdry perch
kindred drum
#

discord.Message.clear_reactions() what I put in the brackets

tawdry perch
#

!d discord.Message.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.
tawdry perch
#

Nothing

wild imp
tawdry perch
wild imp
tawdry perch
#

Is the second if statement True as well?

wild imp
#

well the first needs to work right?

#

then only we can look on second

tawdry perch
kindred drum
#

what is a coroutine.

slate swan
#

uh i'm confused on something , so i've got a blacklist command that blacklists words that cannot be snipped nor sent , like they get deleted but i've got it running like this

    @tasks.loop(seconds=5)
    async def my_loop(self):
        x = await self.bot.db.fetch("SELECT blacklisted FROM blacklist")
        lst = ' '.join(words["blacklisted"] for words in x)
        lst = list(lst.split(' '))
        self.blacklisted_stuff = lst
    
@commands.command(aliases=['s'])
    async def snipe(self,ctx):
        if self.message is None: return await ctx.send('there are no deleted messages')
        embed = discord.Embed()
        embed = discord.Embed(title="   ",description=f"{self.message}")
        embed.set_author(name=self.author.name,icon_url=self.author.avatar_url)
        embed.set_thumbnail(url=self.author.avatar_url)
        embed.set_footer(text=f'requested by {ctx.author.name}',icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
```and this
```py
    @commands.Cog.listener()
    async def on_message(self,message) -> None :
        if message.author.bot: return
        msg = message.content.lower()
        new_string = "".join(c for c in msg if c.isalpha() or c == " ")
        lastest_string = new_string.split()
        x,y = set(lastest_string) ,set(self.blacklisted_stuff)
        if x & y:
            await message.delete()
            await message.author.send(embed=discord.Embed(title=f"you've sent a blacklisted word in {message.guild.name}",description=f"Blacklisted word : {x & y}"))```
but i'm making my bot public but theres one thing i'm confused about , how would i make my task update for each guild . and i thought someone here must know another way thats better , so i was asking if there is a way to do so ?
tawdry perch
wild imp
slate swan
#
async def function():
  #this is a coroutine
  ...
wild imp
#

can you send a basic cogs event so i can check if it works

novel apexBOT
#

This is not a Modmail thread.

slate swan
#

oh its python server

kindred drum
#

do I need pass anything through it?

tawdry perch
slate swan
#

?tag lucid

novel apexBOT
#

This is not a Modmail thread.

wild imp
tawdry perch
#

;-;

#

Ok so.. first if statement does not print anything?

wild imp
#

yea

tawdry perch
#

That means the IDs don't match

kindred drum
tawdry perch
#

To what function

tawdry perch
wild imp
slate swan
tawdry perch
slate swan
wild imp
wild imp
tawdry perch
#

But still doesn't work even if it's correct?

slate swan
kindred drum
# slate swan your question doesnt make sense , you should learn how basic stuff work first.
@bot.event
async def on_raw_reaction_add(reaction):

    
    if reaction.member.bot:
            print("check 1")
            return 
    channel = bot.get_channel(reaction.channel_id)
    print(reaction.emoji)
    if str(reaction.emoji) == "๐Ÿ‘":
        if reaction.member.id !=  861214093822394368:
            await channel.send("no no BOZO LOL")
        else:
            print("Noted")

            await channel.send(f"This reputation has been **VERIFIED** by {reaction.member}")
            await discord.Message.clear_reactions()``` its not that I don't know the basics is that this library makes literally no sense
wild imp
wild imp
tawdry perch
#

I give up, sorry can't continue

wild imp
#

np

upbeat otter
wild imp
slate swan
upbeat otter
#

()

upbeat otter
#

Haha

wild imp
slate swan
wild imp
#

memberupdate

slate swan
#

the parameters of the event

#

what doesn't work there

wild imp
#

k trying

slate swan
#

oh fair

wild imp
#

na

#

errors

kindred drum
slate swan
wild imp
#

breh cog.listen doesnt work

upbeat otter
#

@wild imp you are not in a cog

wild imp
#

its cog.listener right?

wild imp
slate swan
#

yes

slate swan
wild imp
upbeat otter
slate swan
#

!d discord.on_raw_reaction_remove

unkempt canyonBOT
#

discord.on_raw_reaction_remove(payload)```
Called when a message has a reaction removed. Unlike [`on_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_remove "discord.on_reaction_remove"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
slate swan
#

y'all need to learn how to send in errors

upbeat otter
#

!d discord.ext.commands.Cog.listener

unkempt canyonBOT
#

classmethod listener(name=...)```
A decorator that marks a function as a listener.

This is the cog equivalent of [`Bot.listen()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.listen "discord.ext.commands.Bot.listen").
kindred drum
# slate swan wait what line is that ?
  File "C:\Users\Tony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\message.py", line 1309, in clear_reactions
    await self._state.http.clear_reactions(self.channel.id, self.id)
AttributeError: 'str' object has no attribute '_state'```
slate swan
#

well

kindred drum
#

Doesn't work

tawdry perch
#

Just call the function

slate swan
#

yeah

#

oh you had discord.Message in the code

#

use an instance of it

#

not the base class

cloud dawn
#

This looks like half of the traceback..

upbeat otter
#

@wild imp try, client.listen()

wild imp
kindred drum
sick birch
upbeat otter
kindred drum
#

bruh

slate swan
slate swan
#

to you have it on ?

kindred drum
slate swan
#

no

cloud dawn
slate swan
#

you don't have discord.Message in your actual code

slate swan
#

you have an instance of discord.Message

slate swan
#

yeah its reaction.message aPES2_Sweat in ur case

kindred drum
#

TypeError: clear_reactions() missing 1 required positional argument: 'self

upbeat otter
slate swan
#

!d discord.Message.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.
cloud dawn
wild imp
slate swan
#

hm, takes no parameter

wild imp
#

is this what u meant @upbeat otter ?

upbeat otter
tawdry perch
#

Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions

    permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
    await role.edit(reason="shutdown", permissions=permissions)
    await ctx.send(f"Server shut down.")
kindred drum
# cloud dawn Can you show us your code..?
async def on_raw_reaction_add(reaction):

    
    if reaction.member.bot:
            print("check 1")
            return 
    channel = bot.get_channel(reaction.channel_id)
    print(reaction.emoji)
    if str(reaction.emoji) == "๐Ÿ‘":
        if reaction.member.id !=  861214093822394368:
            await channel.send("no no BOZO LOL")
        else:
            print("Noted")

            await channel.send(f"This reputation has been **VERIFIED** by {reaction.member}")
            await discord.Message.clear_reactions()
            ```
wild imp
#

how do i enable that

upbeat otter
wild imp
#

nothing lol

upbeat otter
#

smh code

wild imp
#

so any solution to my problem?

wild imp
upbeat otter
#

I meant show the code again

wild imp
#

k

cloud dawn
upbeat otter
# wild imp

Did you try printing anything to see if the event is triggered?

wild imp
#

i can invite you to my repl if u want @upbeat otter

maiden fable
#

I swear converting from docstrings to md files are a pain

cloud dawn
upbeat otter
wild imp
#

?

wild imp
#

wdym

upbeat otter
#

I dont wanna break all of your bot xd, i'm a little insane lmao

maiden fable
#

little or too

wild imp
upbeat otter
#

Imma switch to my laptop wait

wild imp
#

ye sure

maiden fable
#

@wild imp what is the issue

wild imp
wild imp
upbeat otter
wild imp
#

k

maiden fable
#

do u have members intent

upbeat otter
wild imp
upbeat otter
#

lol

maiden fable
#

R u loading the cog

sick birch
maiden fable
wild imp
sick birch
#

i see

maiden fable
#

r u loading the cog

wild imp
#

its auto

maiden fable
#

O

cloud dawn
# kindred drum oh god
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
    if payload.member.bot:
        return print("User cannot be a bot in raw reaction event")

    channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
    message = channel.fetch_message(message_id)
``` next part getting the channel and message object
sick birch
#

bot.add_extension() iirc

wild imp
cloud dawn
# cloud dawn ```py @bot.event async def on_raw_reaction_add(payload: discord.RawReactionActio...
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
    if payload.member.bot:
        return print("User cannot be a bot in raw reaction event")

    channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)

    if str(reaction.emoji) == "๐Ÿ‘":
        if reaction.member.id !=  861214093822394368:
            await channel.send("no no BOZO LOL")
        else:
            message = await payload.member.fetch_message(payload.message_id)

            print("Noted")
            await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
            await message.clear_reactions()
sick birch
wild imp
kindred drum
#

and I can't pre define it

sick birch
sick birch
kindred drum
rare saddle
#

How do I add validation to an event?

wild imp
cloud dawn
sick birch
#

do you have presences=true when you defined intents?

#

or at least Intents.all()?

#

you'll also need members=true

kindred drum
#

message = member.fetch_message(message_id) member undefined same with message_id

sick birch
#

why are you fetching a message with a member object

#

also fetch_* are coroutines as they make an API clal

whole tapir
#

how can i solve this error_
& : The term 'C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3

  • & C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe "c ...
  • + CategoryInfo          : ObjectNotFound: (C:/Users/ADMIN/...on39/python.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
kindred drum
cloud dawn
sick birch
#

Not sure how you'd do it on windows though, i've only ever done it on linux

cloud dawn
kindred drum
#

vRuntimeWarning: coroutine 'Messageable.fetch_message' was never awaited pass

sick birch
#

said again

#

fetch_* methods are coroutines

#

as they are API calls

kindred drum
#

uh

whole tapir
sick birch
sick birch
cloud dawn
#
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
    if payload.member.bot:
        return print("User cannot be a bot in raw reaction event")

    channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)

    if str(payload.emoji) == "๐Ÿ‘":
        if payload.member.id !=  861214093822394368:
            await channel.send("no no BOZO LOL")
        else:
            message = await payload.member.fetch_message(payload.message_id)

            print("Noted")
            await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
            await message.clear_reactions()
sick birch
#

the code i mean

#

is it the one in the elif

shut mango
#

this code doesnt have any errors but it doesnt work, why?

cloud dawn
sick birch
#

oh right

#

yeah i agree that's odd

slate swan
#

he really doesn't know much

sick birch
#

though fetch_message can only be done on a Messageable, not a member

cloud dawn
#

!d discord.Member.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/master/api.html#discord.Message "discord.Message") from the destination.
whole tapir
#

see

slate swan
sick birch
#

well i guess that makes sense as members are messageables

whole tapir
#

my add to PATH is checked

cloud dawn
cloud dawn
whole tapir
#

how can i solve this error_
& : The term 'C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3

  • & C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe "c ...
  • + CategoryInfo          : ObjectNotFound: (C:/Users/ADMIN/...on39/python.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
#

this error

tawdry perch
#

Wrong command, I mean you maybe had typo on command

slate swan
slate swan
tawdry perch
#

Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions

    permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
    await role.edit(reason="shutdown", permissions=permissions)
    await ctx.send(f"Server shut down.")
slate swan
#

dafuq

#

!d discord.Role.permissions

unkempt canyonBOT
woven cradle
slate swan
#

doesn't exist

tawdry perch
#

What..?

slate swan
#

permissions.update

#

or does it

shut mango
#

why is this command not working?

slate swan
#

doesn't exist

tawdry perch
#

!src defcon shutdown

unkempt canyonBOT
#
Command: defcon shutdown

Shut down the server by setting send permissions of everyone to False.

Source Code
kindred drum
slate swan
#

oh I see you copying class something

kindred drum
#

other than

#
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
    if payload.member.bot:
        return print("User cannot be a bot in raw reaction event")

    channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)

    if str(reaction.emoji) == "๐Ÿ‘":
        if reaction.member.id !=  861214093822394368:
            await channel.send("no no BOZO LOL")
        else:
            message = await payload.member.fetch_message(payload.message_id)

            print("Noted")
            await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
            await message.clear_reactions()```
tawdry perch
#

I have done that permission update before as well

unkempt canyonBOT
#

bot/utils/message_cache.py line 101

def update(self, message: Message) -> bool:```
tawdry perch
#

Ah fk

slate swan
#

the update is defined in the bot's file

wild imp
slate swan
#

it's what they use where you use it

tawdry perch
#

You sure?

slate swan
#

I just clicked on the method on github...

tawdry perch
#

It's not always valid

ocean leaf
#
    @commands.command()
    async def rank(self, ctx):
        if ctx.channel.id == bot_channel:
            stats = levelling.find_one({"id": ctx.author.id})
            if stats is None:
                embed = discord.Embed(description = "You haven't send any message yet. No rank for you!!")
                await ctx.channel.send(embed = embed)
            else:
                xp = stats["xp"]
                lvl = 0
                rank = 0
                while True:
                        if xp < ((50 * (lvl ** 2)) + (50 * (lvl - 1))):
                            break
                        lvl += 1
                xp -= ((50 * ((lvl - 1) ** 2)) + (50 * (lvl - 1)))
                boxes = int((xp / (200 * ((1 / 2) * lvl))) * 20)
                ranking = levelling.find().sort("xp", -1)
                for x in ranking:
                    rank += 1
                    if stats["id"] == x["id"]:
                        break
                rank_embed = discord.Embed(
                    title = "{}'s level stats".format(ctx.author.name),
                    colour = ctx.author.color()
                )
                rank_embed.add_field(name = "Name", value = ctx.author.mention, inline = True)
                rank_embed.add_field(name = "XP", value = f"{xp}/{int(200 * ((1 / 2) * lvl))}", inline = True)
                rank_embed.add_field(name = "Rank", value = f"{rank}/{ctx.guild.member_count}", inline = True)
                rank_embed.add_field(name = "Progress Bar [lvl]", value = boxes * ":blue_square:" + (200 - boxes) * ":white_large_square:", inline = True)
                rank_embed.set_thumbnail(url = ctx.author.avatar_url)
                await ctx.send(embed = rank_embed)
#

it dosen't send the rank_embed

kindred drum
#

if str(paypal.emoji) == ":thumbsup:": @cloud dawn

#

AttributeError: 'Command' object has no attribute 'emoji'

slate swan
#

then I don't know

woven cradle
#

how do i define bot in other way than this???

import discord
from discord.ext import commands


class Other(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.command()
    async def test(ctx):
        await ctx.send(f'cmd')

def setup(client):
    bot.add_cog(Other(bot))
tawdry perch
#

Can you send me a link where the line permissions.update is shown, I can't make it on mobile

slate swan
#

docs say update doesn't exist otherwise

wild imp
ocean leaf
ocean leaf
#

not is

shut mango
slate swan
#

you took client as a parameter

#

and proceeded to use bot

slate swan
#

@woven cradle

woven cradle
#

???

slate swan
slate swan
woven cradle
#

๐Ÿ˜ฎ

shut mango
woven cradle
#

im stupid thanks!

shut mango
#

still doesnt work

vocal plover
slate swan
#

you're welcome

cloud dawn
#

eeeeeeeeee

kindred drum
wild imp
shut mango
cloud dawn
unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

shut mango
wild imp
shut mango
#

sed?

tawdry perch
unkempt canyonBOT
#

update(**kwargs)```
Bulk updates this permission object.

Allows you to set multiple attributes by using keyword arguments. The names must be equivalent to the properties listed. Extraneous key/value pairs will be silently ignored.
tawdry perch
#

It seems to exist

ocean leaf
#

it is night here

tawdry perch
#

Breh 10 minutes is a low time

cloud dawn
tawdry perch
#

Please be patient

ocean leaf
#

i need to sleep

#

so please

slate swan
tawdry perch
cloud dawn
tawdry perch
#

@slate swan I got the docs not sure if I pong you before

ocean leaf
slate swan
#

and I saw it

#

and I have no idea

tawdry perch
#

Oh sorry then lemon_sweat

ocean leaf
#

mongodb has data

shut mango
#

does anyone know why it doesnt work?

cloud dawn
#

Sometime when i wake up i know the solution to my problem.

vocal plover
cloud dawn
slate swan
#

ctx.author.reply doesn't exist @shut mango

#

this time for sure

ocean leaf
#

it's ctx.message.reply

shut mango
#

ohh

#

im new to python

ocean leaf
#

or await ctx.send

slate swan
#

man

#

you shouldn't start with dpy

ocean leaf
slate swan
#

even tho this has nothing to do with py knowledge

ocean leaf
#

start with something simple

kindred drum
#

@cloud dawn bruh it can't get the message

shut mango
#

it works, after hours

#

how would i make it embed?

rare saddle
#

How do I add validation to an event?
Across:

def check():
   return inter.channel.id != member_ticket_channel1.id
whole tapir
#

help me with this error pls-
@client.command(aliases = ['8ball', 'test'])
AttributeError: 'Client' object has no attribute 'command'

tawdry perch
#

Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions

    permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
    await role.edit(reason="shutdown", permissions=permissions)
    await ctx.send(f"Server shut down.")
sage otter
#

Consider using

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
maiden fable
whole tapir
# unkempt canyon

i started discord bot development and i didnt understand a word he said, sorry ๐Ÿ˜ฆ

tawdry perch
slate swan
whole tapir
#

pls anyone help me too

tawdry perch
#

Role id

tiny ibex
#

And declare a bot using commands.Bot

#

Then you can just do whatever you were trying to do

polar ice
#
                        user = interaction.get_member(interaction.author.id)
                        await user.send_message(embed=embed)```

Any ideas why this isnt DM'ing the user who interacts with the button?
maiden fable
polar ice
#

@maiden fable ๐Ÿ‘€

maiden fable
#

Lmao

#

Happens dw

slate swan
#

this is captcha 1, if someone executes my verify command, it sends them this in dms (ill obviously format it in an embed and make it pretty), but if this image is selected, the bot knows that if the user reply's with "KZEXEH", they've successfully passed the verification. otherwise, they've failed and must re-execute the command. lets say I have 3 captchas, how can I tie the proper verification key (such as "KZEXEH") to its proper corresponding captcha image

maiden fable
#

U gotta use a dict or something

#

!pypi captcha is also there

unkempt canyonBOT
#

A captcha library that generates audio and image CAPTCHAs.

slate swan
maiden fable
#

Map the image name to the code?

#

Like image: code

slate swan
#
dict {
  "/captchas/captcha1.png" : "KZEXEH",
  "/captchas/captcha2.png" : "ABCDEF"
}```
maiden fable
#

Yea

#

It's inefficient tho

slate swan
#

wdym

maiden fable
#

Like it's manual so it's inefficient, the way

slate swan
maiden fable
#

I am not saying dicts themselves are inefficient

#

I am saying that this manual way of mapping is inefficient since u manually gotta hardcode the codes

slate swan
#

well then

#

ig ill try and figure something out lol

polar ice
#

!paste

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.

quaint epoch
#

Anyone know how i can get a role object?
because i have a role called muted
and i want to pass that role onto people that are muted
so how would i get that role object?

primal fox
quartz badger
#

I wanted to make the bot delete a message with a specific text, but if someone had a specific permission, it would not delete the message. How would I do this?

sick birch
quartz badger
#

ty

#

I'll try

slate swan
#

How can i check if a button in disnake was clicked by the ctx author?

rare saddle
#

How do I add validation to an event?
Across:

def check():
   return inter.channel.id != member_ticket_channel1.id
maiden fable
slate swan
maiden fable
unkempt canyonBOT
#
I don't think so.

No documentation found for the requested symbol.

maiden fable
#

!d discord.ui.View.interaction_check

unkempt canyonBOT
#

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

A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.

This is useful to override if, for example, you want to ensure that the interaction author is a given user.

The default implementation of this returns `True`.

Note

If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
quartz badger
#

My bot has a delete command, and it is taking a while to delete messages even though it quickly shows the message of how many messages it has deleted. Is this normal?

Code: ```py
from discord.ext import commands
from discord.ext.commands.errors import MissingPermissions, CommandError, MissingRequiredArgument

class Clear(commands.Cog):
"""Apaga mensagens"""

def __init__(self, bot):
    self.bot = bot

@commands.command(name = "clear")

@commands.has_permissions(manage_messages = True)
async def clear(self, ctx , amount=2):
    await ctx.channel.purge(limit=amount+1)
    
    if amount == 1:
        await ctx.send(f'Foi apagada `{amount}` mensagem com sucesso!')

    else:
        await ctx.send(f'Foram apagadas `{amount}` mensagens com sucesso!')

@clear.error
async def clear_error(self, ctx, error: CommandError):
    if isinstance(error, MissingPermissions):
        await ctx.send("Vocรช nรฃo tem permissรฃo para usar este comando")
        return

def setup(bot):
bot.add_cog(Clear(bot))```

maiden fable
#

Could be your bot is getting ratelimited?

#

Highly unlikely tho

quartz badger
#

It is hosted on my PC for the time being, but when I turned it on (which was also on my PC) this did not happen.

maiden fable
#

Hmm

slate swan
#

code in image

error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: PermissionError: [Errno 13] Permission denied: './cogs/ffmpeg.exe'

#

what does permission denied mean? can someone help?

#

?

quaint epoch
#

Guys my clear functions is lagging

#

before it used to clear 20 messages instantly

#

now it doesn't show it until i refresh discord

#

what do i do?

quartz badger
quaint epoch
quartz badger
#

And it shows that it deletes after a while, no need to refresh (at least, with me it does.) And yes, maybe it is the Discord own lag

#

Sorry for the bad English, I'm Portuguese

quaint epoch
#

its fine

final iron
grim hill
#

Is discord.py still good to use or not? i saw recently the developer was stopping and asked other contributers if they wanted to take over but no one stepped forward.
If it's better to go to something else what should i choose?

slate swan
#

It's by far the best fork yet of dpy, so the syntax isn't much different ๐Ÿ‘

grim hill
#

ok thanks will look at it

kindred drum
#

yo anyone got help? AttributeError: module 'discord.message' has no attribute 'clear_reactions' - ```py
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("User cannot be a bot in raw reaction event")

channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(payload.emoji) == "๐Ÿ‘":
    if payload.member.id !=  861214093822394368:
        await channel.send("no no BOZO LOL")
    else:
    
    
        print("Noted")
        await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
        await message.clear_reactions()
        ```
slate swan
#

Why did you imported something like discord.message

kindred drum
#

I imported this from discord import message

slate swan
#

Yeah remove that

#

That's not how it works

#

!d discord.abc.Messageable.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/master/api.html#discord.Message "discord.Message") from the destination.
slate swan
#

This is how it works

#

You have a message ID, pass it as parameter in the method

kindred drum
slate swan
#

Because you need to use on your channel object...

#

Maybe you need to take a look at what OOP is

#

msg = await channel.fetch_message(the_id)

#

Then you can use msg.something() since it will be a discord.Message object

rare saddle
#

How to add validation for this event

kindred drum
slate swan
#
def get_captcha():
   dict = {
  "captcha1.png" : "KZEXEH",
  "captcha2.png" : "123456",
  "captcha3.png" : "ABCDEF"
    }
  return random.choice(tuple(dict.keys())) # ('image.png', 'CODE') # return from a function

@bot.command()
@commands.check(checkk)
async def verify(ctx):
    variable = get_captcha # ('image.png', 'CODE')
    # now index them for the url and code
    # send [0] as output
    # wait for [1] as input
    # if input == [1], they succeeded verification
    # if not, whatever you want to do (i.e, display some message or return or anything of that sort)```
#

the # lines explain whats needed, its for a verification command, im tying images to keys, if captcha1 is sent, im trying to make the bot send the user a dm of that image, and they have to message the bot the proper corresponding key for the image. never used dictionaries before and this is all i have at the moment

quaint epoch
#

guys why does my ping keep going up?

#

before it was sub 40

#

then post 60

#

then 80

#

NOW 120

dapper cobalt
#

I believe that your bot's ping relies on the connection's latency between it and Discord API's servers.

#

Therefore, it has nothing to do with your code, nor Python. Anyhow, if you're running many tasks at once, that might be a reason too.

hollow agate
#
view = OtherTicket()
await ctx.channel.send(embed=embed, view=view)``` How would I ad multiple buttons to the view?
#

Bruh it says a token grabber

#

Let's just not...

quaint epoch
#

TOKEN GRABBER

#

bro why?

#

Isn't that against TOS?

thick sigil
#

xXh4ckerXx

quaint epoch
#

grabbing bot tokens?

#

yea right

thick sigil
#

๐Ÿงข

patent lark
#

hm.

hollow agate
#

Cap

quaint epoch
#

Ight imma head out

fringe harness
#

@slate swan

#

Wtf man

#

Y did u block

#

And what did u do to my testing server

#

@slate swan

#

Y

slate swan
#

This guy really tried to scam my work lmfao

quaint epoch
grim hill
#

hello, if i want to send a wikipedia page url how can i make it so it doesn't use an embed, can i set that somewhere

slate swan
quaint epoch
fringe harness
#

Cap

#

Tf

slate swan
#

Yeah

quaint epoch
#

'ight imma head out

fringe harness
#

Scroll up in chat

#

it was my idea

#

What is wrong with u

slate swan
#

This man said hes mom is gonna beat him ๐Ÿ’€

#

What type of excuse is that๐Ÿ’€

fringe harness
#

wdym

#

How is that scamming

#

And I never said that

hollow agate
#

Boys, this isn't the chat for this.

#

This is for support :P

slate swan
#

Yeah

fringe harness
#

He blocked on dms

#

So I cant communicate other wise

hollow agate
#

I don't care, leave it... This isn't what this chat is supposed to be about.

slate swan
#

Yeah keep asking for spoonfeeds but not here

fringe harness
#

Never asked for that shit

#

Fake ass bitch

hollow agate
#

@slate swan just leave him, please. Be more mature than him:)

slate swan
#

!ot

unkempt canyonBOT
hollow agate
#

xd, children sometimes

fringe harness
#

I mean calling me a child when he destroyed my testin server

tight obsidian
#

@fringe harness This is not a place to have a personal fight with someone. This is a channel for helping with Discord bots.

fringe harness
#

Yep ik

#

Im sorry

fringe harness
#

@slate swan

#

Unblock so we can talk

hollow agate
# slate swan Add more buttons in the class

In the documents I saw a view.add thing, but that doesn't seem to work, nor does a command like OtherTicket(), Stuff(). Could you assist me in the right direction, please?

fringe harness
#

Didnt try to scam

thick sigil
#

you can use add_item() method @hollow agate

tight obsidian
slate swan
fringe harness
#

Alr whatever

worldly bane
#

dm me

hollow agate
# slate swan Your viewing the whole class so make more buttons

So I just put more buttons in this area: ```py
class OtherTicket(discord.ui.View):
def init(self):
super().init(timeout=None)

@discord.ui.button(label='Other', style=discord.ButtonStyle.green, custom_id='pp1')
async def otherticket(self, button: discord.ui.Button, interaction: discord.Interaction):```?
hollow agate
#

I see, thank you very much!

slate swan
#

Yw

fringe harness
#

Is anyone here down to work on a collaborative discord bot

#

Dm me if interested

#

I will send you details in dms

fringe harness
#

@slate swan I worked on the basic part of the adalc if u still want to work on it

#

I made a ver basic calc

#

just to show I aint tryna steal

heavy folio
#
    super.__init__(timeout=None)
TypeError: descriptor '__init__' of 'super' object needs an argument
```how do i fix this error
slate swan
#

you mean fork?

heavy folio
#

none

heavy folio
#

oh yeah

#

if your bot is unverified then continue to use dpy

#

if you want slash commands there's one made by someone in the dpy server

fringe harness
outer violet
heavy folio
#

no

#

best not to since some ext libs dont work with dpy

sick birch
#

I prefer this as I really don't like any of the wrappers, but whatever you feel comfortable works

verbal cairn
#

Disnake is good

cobalt jacinth
#

Can I remove my bot from a server using a command ?

visual island
#

sure

#

!d discord.Guild.leave

unkempt canyonBOT
#

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

Leaves the guild.

Note

You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.delete "discord.Guild.delete").
shadow wraith
#

anyone here uses discord-interactions (aka discord_slash and discord-py-interactions)

#

because idk how to import discord_slash.utils.manage_components without an error

slate swan
#

how can i change a buttons color

#

Changing the button type will change its color

#

not that lol

#

after

shadow wraith
#

:thinknig

slate swan
#

disnake

#

Same for both

shadow wraith
#

i dont use disnake

#

oh

slate swan
#

like if a button gets disabled it turns grey

shadow wraith
#

oh yeahh like that

#

that made me think if inside a button function (async def my bot function0

#

hmmm try putting a style = ButtonStyle.grey

#

inside your button function

slate swan
#

thats setting the color of the button

shadow wraith
#

bru

whole tapir
#

Question = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
if message.content.startswith(".8ball"):
responses = Question
res = (random.choice(responses))
await message.channel.send(res)

#

why isnt this working?

#

no errors are showing

shadow wraith
#

๐Ÿ’€

prisma spoke
#
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 232, in brackets
    data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT ?*2;",(p))
  File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 184, in execute
    cursor = await self._execute(self._conn.execute, sql, parameters)
  File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
ValueError: parameters are of unsupported type

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 125, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type```
```py
@bot.command()
async def brackets(ctx,p:int):
    data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT ?*2;",(p))    
    dataa  = await data.fetchall()
    dt = list(dataa)
    for i in range(1,len(dt),2):
        await ctx.send(dt[i],dt[i+1])```
help
slate swan
#

i want it to change on a interaction

#

!d disnake.ui.Button , it takes a disabled kwarg , which you can use when you edit it to disabled button

shadow wraith
#

dudde you started off with no tutorials, responses are lists and why did you need like to rename the variable

slate swan
#

!d discord.ui.Button

#

bot....

shadow wraith
#

bots not down

shadow wraith
slate swan
prisma spoke
shadow wraith
#

but nows not the time to discuss about that

whole tapir
#

now?

#

Question = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
if message.content.startswith("$8ball"):
await message.channel.send(random.choice(Question))

slate swan
whole tapir
#

why is it not working with 0 errors

slate swan
# slate swan thx

Yea , read the disabled kwarg part , you can use it when you edit the message

prisma spoke
slate swan
#

For disabling the button

whole tapir
#

help me sir ples

slate swan
slate swan
#

i will not help someone with json if i know theirs better ways

whole tapir
slate swan
#

I mean , i just mentioned

slate swan
slate swan
whole tapir
#

yet it isnt working

prisma spoke
slate swan
#

it's allowed to read and write data in json , but that doesn't makes it a database

#

^

slate swan
whole tapir
#

import nextcord
import random

Question = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]

client = nextcord.Client()

@client.event
async def on_ready():
print("We have logged in as {0.user}"
.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith("$hello"):
    await message.channel.send("Hello!")
if message.content.startswith("$help"):
    await message.channel.send("I am not ur assistant sucka")
if message.content.startswith("$congrats"):
    await message.channel.send("Thanks to my coder Ashwary")
if message.content.startswith("fuck"):
    await message.channel.send("cut it kiddo")


if message.content.startswith("$8ball"):
    await message.channel.send(random.choice(Question))

client.run("

slate swan
whole tapir
#

elif?