#discord-bots

1 messages · Page 323 of 1

fading pollen
#

but then i get different errors

final iron
#

What's the error

fading pollen
# final iron What's the error

Traceback (most recent call last):
File "/home/gaelg/Desktop/xtreme-main/xtreme.py", line 28, in <module>
conn = mysql.connector.connect(
File "/home/gaelg/.local/lib/python3.10/site-packages/mysql/connector/init.py", line 179, in connect
return MySQLConnection(*args, **kwargs)
File "/home/gaelg/.local/lib/python3.10/site-packages/mysql/connector/connection.py", line 95, in init
self.connect(**kwargs)
File "/home/gaelg/.local/lib/python3.10/site-packages/mysql/connector/abstracts.py", line 716, in connect
self._open_connection()
File "/home/gaelg/.local/lib/python3.10/site-packages/mysql/connector/connection.py", line 208, in _open_connection
self._do_auth(self._user, self._password,
File "/home/gaelg/.local/lib/python3.10/site-packages/mysql/connector/connection.py", line 144, in _do_auth
self._auth_switch_request(username, password)
File "/home/gaelg/.local/lib/python3.10/site-packages/mysql/connector/connection.py", line 177, in _auth_switch_request
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'u79588_E6O83yeRrg'@'172.58.166.30' (using password: YES)

latent jay
#

Does interaction.edit_original_response() attachments arg have a maximum amount

latent jay
#

Yeah I think it's 10

final iron
#

Okay, so test it then

latent jay
# final iron Okay, so test it then

How could I added attachments to this pagination?

            KEYS_PER_PAGE = 10
            pages = []
            for chunked_files in more_itertools.chunked(files, KEYS_PER_PAGE):
                embed = discord.Embed(
                    url=url,
                    title=f"Downloaded {index} files.",
                    description=new_desc,
                    color=discord.Color.green(),
                ).set_author(name=username, url=f"https://www.instagram.com/{username}/").set_footer(
                    text=f"👍 {likes} • 💬 {comments}"
                )
                pages.append(embed)
            await Paginator.Simple(timeout=60).start(interaction, pages=pages)
fierce elm
#

tengo un problema

naive briar
unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

vapid parcel
#
    async def edit_footer(self, interaction: Interaction) -> None:
        """This method edits the embed's footer (text, icon_url)"""
        modal = ModalInput(title="Edit Embed Footer")
        modal.add_item(
            TextInput(
                label="Footer Text",
                max_length=255,
                required=False,
                default=self.embed.footer.text,
                placeholder="Text you want to display on embed footer",
            )
        )
        modal.add_item(
            TextInput(
                label="Footer Icon",
                required=False,
                default=self.embed.footer.icon_url,
                placeholder="Icon you want to display on embed footer",
            )
        )
        modal.add_item(
            TextInput(
                label="Include Timestamp (True/False)",
                max_length=5,
                required=False,
                default="True",
                placeholder="True or False",
            )
        )
        await interaction.response.send_modal(modal)
        await modal.wait()

        self.embed.set_footer(
            text=str(modal.children[0]), icon_url=str(modal.children[1])
        )

        include_timestamp = str(modal.children[2]).lower() == "true"

        if include_timestamp:
            self.embed.timestamp = discord.utils.utcnow()
        else:
            self.embed.timestamp = None```
#

can someone tell me why if True the timestamp doesnt set?

final iron
vapid parcel
#

let me test

final iron
#

A modal also isn't great for True/False inputs

vapid parcel
#
Include Timestamp: False
Not setting timestamp.
final iron
#

Why are you showing 2 outputs?

vapid parcel
#

Show you what it does for Both True or False

final iron
#

I know what it'll do, I'm just saying it's not a good format overall

#

What if somebody says yes instead of True?

vapid parcel
#

then they are dumb?

final iron
#

Average Discord user is

vapid parcel
#

it states what to put 😭

final iron
#

Most users don't read carefully

vapid parcel
#

If they dont read, then its on them tbh

final iron
#

They'll see include timestamp and act accordingly

vapid parcel
#

Well, thats on them, im just trying to fix the issue :/

#

"label="Include Timestamp (True/False)","

vapid parcel
#

also says it twice, so theres no way they miss it :)

vapid parcel
final iron
#

You showed 2 outputs

#

So which is it

#

It cannot be both True and False at the same time

vapid parcel
#

Thats if you put True or False..?

final iron
#

If you print include_timestamp is it True or False?

vapid parcel
#

oh, hold on

vapid parcel
final iron
#

include_timestamp is set off the user input. You're having an issue where even if the user enters true then it's still not setting. Therefore, you need to pass the true value and print include_timestamp

slate swan
#

And handle such scenarios accordingly

vapid parcel
#
Collecting git+https://github.com/RejectModderss/dispie (from -r requirements.txt (line 9))
  Cloning https://github.com/RejectModderss/dispie to /tmp/pip-req-build-iz8wec4o
  Running command git clone --filter=blob:none --quiet https://github.com/RejectModderss/dispie /tmp/pip-req-build-iz8wec4o
  error: unable to write file Lavalink.jar
  error: unable to write file README.md
  error: unable to write file __pycache__/embed_options.cpython-38.pyc
  error: unable to write file application.yml
  error: unable to write file dispie/__init__.py
  error: unable to write file dispie/embed_creator/__init__.py
  error: unable to write file dispie/embed_creator/__pycache__/__init__.cpython-38.pyc
  error: unable to write file dispie/embed_creator/__pycache__/base.cpython-38.pyc
  error: unable to write file dispie/embed_creator/__pycache__/methods.cpython-38.pyc
  error: unable to write file dispie/embed_creator/methods.py
  error: unable to write file dispie/help_commands/__init__.py
  error: unable to write file dispie/help_commands/__pycache__/__init__.cpython-38.pyc
  error: unable to write file dispie/help_commands/__pycache__/minimal.cpython-38.pyc
  error: unable to write file dispie/help_commands/minimal.py
  error: unable to write file dispie/music/__init__.py
  error: unable to write file dispie/music/client.py
  error: unable to write file dispie/music/player.py
  error: unable to write file dispie/music/types.py
  error: unable to write file dispie/paginator/__init__.py
  error: unable to write file dispie/paginator/__pycache__/__init__.cpython-38.pyc
  error: unable to write file dispie/utils/__init__.py
  error: unable to write file dispie/utils/__pycache__/__init__.cpython-38.pyc
  error: unable to write file dispie/utils/__pycache__/input.cpython-38.pyc
  error: unable to write file dispie/utils/input.py
  error: unable to write file examples/embed_creator/command.py
  error: unable to write file examples/embed_creator/embed_options.py
  error: unable to write file examples/pagination.py
  error: unable to write file logs/spring.log
  error: unable to write file logs/spring.log.2023-03-06.0.gz
  error: unable to write file main.py
  error: unable to write file requirements.txt
  error: unable to write file setup.py
  error: unable to write file tcwalther.cython-0.1.0.vsix
  fatal: unable to checkout working tree
  warning: Clone succeeded, but checkout failed.
  You can inspect what was checked out with 'git status'
  and retry with 'git restore --source=HEAD :/'

  error: subprocess-exited-with-error
  
  × git clone --filter=blob:none --quiet https://github.com/RejectModderss/dispie /tmp/pip-req-build-iz8wec4o did not run successfully.
  │ exit code: 128
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --filter=blob:none --quiet https://github.com/RejectModderss/dispie /tmp/pip-req-build-iz8wec4o did not run successfully.
│ exit code: 128
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.```
#

Can someone tell me why it does this?

#

i just need help fixing it..

shrewd apex
#

a simple format could be {embed: attachment, embed1: ...}

shrewd apex
#

lemme take a look

shrewd apex
latent jay
#

So there's no hacky way to do it besides editing the package

shrewd apex
#

its barely a package it's just a single file

#

i suggest you just make your own

#

its pretty easy to make one

latent jay
#

I already use that package for the rest of my commands DEAD

shrewd apex
#

subclass it then

vapid parcel
#

well thats what the server is running

#

On my IDE it worked fine which is 3.10.5

#

but i thought it would work for 3.11 too?

shrewd apex
#

it should

shrewd apex
vapid parcel
vapid parcel
#

that?

#

I think its more of the host... because my friend could clone it, an i can clone it... i will have to talk to my Manager about it so he can fix it.

#

My friend owns the Host, so I will need him to look into it I think..

glad cradle
vapid parcel
#

Which is a host error, not a github or anything else, just a host error 99% sure

vale wing
#

Also please run ls -ld .. in the dir you are running git in and show the output

slate swan
#

just -a would be enough

slate swan
#

How to run discord bots 24/7 for free in replit?

final iron
slate swan
final iron
#

It’s definitely not

slate swan
#

Nuh uh

final iron
#

Why would a host require you to setup a web server alongside your main application and ping it every 30s to prevent replit from disconnecting it?

#

That’s not normal

#

Keep alive is a workaround to a prevent replit created

slate swan
#

😂

final iron
#

That doesn’t make replit a valid host

slate swan
final iron
#

You should. Most people aren’t going to help you “setup” replit for hosting

patent lark
slate swan
#

patent lark
#

You're the only one being anyhwere near rude.

slate swan
#

I didn't do anything💀

patent lark
#

I assume you're a little kid, maturity must be new to you.

slate swan
#

It's already gotten to me

#

And I'm 15 years old so what are you saying?

patent lark
#

You're not mature.

slate swan
#

Yeah and?

#

Ok can we just stop ur kinda getting off topic

#

@patent lark If ur assuming I'm a lil kid them how old are you?

#

Bro why is the text like that

patent lark
#

Can you stop? You're getting off topic.

slate swan
#

Who hurt u

patent lark
#

!ot

unkempt canyonBOT
slate swan
#

Ok

vapid parcel
#

Bro said replit 😭

patent lark
vale wing
slate swan
#

😭

vapid parcel
vale wing
#

Replit drama

vapid parcel
#

did you not just see the drama...?

vale wing
#

Idk I just came

vapid parcel
#

That was my only text 😭

slate swan
#

I'm leaving this server this server doesn't respect me

vale wing
patent lark
vapid parcel
vale wing
#

Except me ofc

vapid parcel
#

All you have done is be rude and disrespect anyone who said anything to you.

patent lark
vapid parcel
#

ive only used github for like 3 weeks now 😭

vale wing
#

💀

vapid parcel
#

Thats crazy 😭

vale wing
vapid parcel
potent fox
#

@vapid parcel we don't need to repost that. Moderators have handled it.

patent lark
#

<@&831776746206265384>

patent lark
#

Oop

vale wing
#

Can you run the command I mentioned @vapid parcel

patent lark
#

Sorry for the ping.

vapid parcel
#

what command?

patent lark
#

I didnt know it was handled

potent fox
# patent lark Oop

can you please change your nickname to something not invisible/unclickable?

patent lark
#

Sure.

vale wing
patent lark
#

There we go

vale wing
vapid parcel
potent fox
patent lark
#

👍

vapid parcel
#

so just do exactly ls -ld ..?

vale wing
#

Yeah in your directory that you are trying to run git

vapid parcel
#

Like this?

vale wing
#

Yeah

vapid parcel
#

it does nothing,..

vale wing
#

Well it should give output

#

Into stdout or stderr idk for sure

#

I don't think you can submit commands while it runs

vapid parcel
#

So turn it off?

vale wing
#

Prob

#

Idk that host

#

I prefer bare ssh ☺️

vapid parcel
#

Im just going with what i have

#

cant really complain, this host is free because my friend lets me use it...

#

plus im poor, so no complaining here :)

vapid parcel
vale wing
#

It should give output like this

vapid parcel
#

hold on

#

waiting for my friend to answer

#

to see how to run commands :/

tulip frigate
#

@vapid parcel @vale wing i think its a pterodactyl panel, it doesnt allow user commands

#

its just made to host specific stuff, nothing more

vale wing
#

Probably

#

To fix that you need ssh access definitely

tulip frigate
#

does it look like this?

vapid parcel
tulip frigate
vapid parcel
#

Would show the server address

tulip frigate
#

oh then

vapid parcel
tulip frigate
#

well then

#

yeahh i think normal pterodactyl panels dont allow user commands

vapid parcel
#

hm

#

so the owner has to do it?

tulip frigate
#

the owner of the server yes

vapid parcel
#

Damn okay

vapid parcel
tulip frigate
#

yea

#

i mean either way it might be good to ask him bc i might be wrong too xD

vapid parcel
#

idk

#

who knows 😭

#

@vale wing

#

welp what does this command do

#

we will just have to do it manually. its a Docker (i have NO clue what that means)

vale wing
vapid parcel
#

hm

#

starlight dpy, works, but when i do dispie it just wont work

vale wing
vapid parcel
#

So whats the trouble shoots here to fix this cloning thing..

#

@vale wing ^

vale wing
#

Investigating this without direct access will be a pain

vapid parcel
#

:/

#

Well why does 1 git work, but the other doesnt?

#

that means the host supports the git? idk man im just really lost on what the damn issue is...

vale wing
vapid parcel
#

imma be real, i have no clue, all i know is that i goes through the requirements, which its inside of requirements then it starts installing everything inside of requirements

#

what if i put the git inside of the startup command?

spark nimbus
#

Well I lost my mobile ssd so I think that it may be a nice time to try other libary to rewrite my bot. I thought of my trying disnake but bot sure about that. What do you think about these libary?

#

I used to code on d.py

tulip frigate
#

i mean discord.py is pretty much the best one to me: its very well documentated and literally 90% of the python discord bot coders are using it hence why many people can help with it

final iron
#

More than 90%

#

Not to mention the amount of git clones of the discord.py repository for the master build

whole patio
#

i use that for my bots its pretty cool

final iron
whole patio
whole patio
final iron
#

interactions.py is an extremely outdated and deprecated library

#

discord.py natively supports app commands, and has for a long time

whole patio
#

idk im not sure which one i use but it has something to do with interactions

#

im relatively sure i used to use int.py for one of them before i swapped it

final iron
#

All of those slash command extension libraries are deprecated as 99% of people removed them when discord.py added slash command support

slate swan
#

Discord.py only Has so many downloads cause its assumed being "main" library

#

For me personally i find nextcord and disnake the best

final iron
#

For which reasons

hushed galleon
#

though goose's statement maybe implies they were using <=3.0.3? back when it used to be called discord-py-slash-command and imported as discord_slash, that or goose meant they were running both libraries alongside each other which is... definitely a way to do it

final iron
hushed galleon
#

so their last activity was a few days ago

final iron
#

Oh I didn’t even know it’s still active

#

I’ve actually never seen anybody use that library surprisingly

hushed galleon
#

hmm yeah, i guess their discord would be a better place to ask

whole patio
#

hi. i need some help with code

#

how do i add arguments to the @tree.command()?

from discord import app_commands

client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)

@tree.command(name = "initiate", description = "Initiate the PyGoose command g4-sAB.GXC")
async def initiate(interaction):
    commandname = "g4-sAB.GXC"
    await interaction.response.send_message(f"`initiated {commandname}.`")
final iron
whole patio
#

wdym

#

i need help

whole patio
final iron
whole patio
final iron
#

!d discord.app_commands.CommandTree.command

unkempt canyonBOT
#

@command(*, name=..., description=..., nsfw=False, guild=..., guilds=..., auto_locale_strings=True, extras=...)```
A decorator that creates an application command from a regular function directly under this tree.
final iron
#

Which options are you talking about?

#

There's options for select menus, but not slash commands

drifting arrow
#

How do I set a command to bot owner only again? lol

final iron
drifting arrow
#

slash

#

I forgot and cbf finding a bot that has owner only lol

#

too many discord bots ;-;

final iron
#

You'd have to manually check it iirc

drifting arrow
#

Found commands.is_owner()?

#

wouldnt that work on a slash command

final iron
#

commands

drifting arrow
#

😠

#

Fine. time to manually do it I guess

final iron
#

You can do it with an if statement in the command or a decorator with app_commands.check

final iron
drifting arrow
whole patio
final iron
final iron
drifting arrow
#

psh

final iron
#

uh

whole patio
drifting arrow
#

ty @final iron

final iron
#

!d discord.ext.commands.Bot.is_owner

unkempt canyonBOT
#

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

Checks if a [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User) or [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) is the owner of this bot.

If an [`owner_id`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.owner_id) is not set, it is fetched automatically through the use of [`application_info()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.application_info).

Changed in version 1.3: The function also checks if the application is team-owned if [`owner_ids`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.owner_ids) is not set.

Changed in version 2.0: `user` parameter is now positional-only.

Changed in version 2.4: This function now respects the team member roles if the bot is team-owned. In order to be considered an owner, they must be either an admin or a developer.
final iron
#

You can call that, and return it

whole patio
#

i want the user to input an option into a variable of str type and then it returns something specific if it has a value of something

final iron
whole patio
#

can u provide an example

#

pls

toxic ibex
#

alr so im trying to import things

import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext

i have everything installed but for what ever reson it says no modual named discord_slash import SlashCommand

final iron
#

There's no reason to use a 3rd party library

toxic ibex
#

oh ._.

#

then how do i get it when i press / to have stuff pop up?

#

what do i use to replace it?

final iron
#

For the gist, I know it's long but please read the entire thing. I've had many people ask questions which are answered later in the page

toxic ibex
#

alr thx

final iron
#

I'm willing to breakdown code or further explains concepts but please just read the entire page, the first part is especially important

whole patio
vapid parcel
#
                else:
                    reply = await ctx.reply(f"Clearing warnings from {member.mention}...", ephemeral=True)

                    await self.bot.db_connection.execute("DELETE FROM warnings WHERE user_id = ? AND guild_id = ?", (member.id, ctx.guild.id))
                    await self.bot.db_connection.commit()

                    success_embed = discord.Embed(
                        title="Warnings Cleared",
                        description=f"{warning_count[0]} warnings for {member.mention} have been cleared.",
                        timestamp=discord.utils.utcnow(),
                        color=config.main_color
                    )
                    success_embed.add_field(name="Reason", value=reason, inline=False)
                    success_embed.set_author(name=f"By: {ctx.author.display_name}", icon_url=ctx.author.avatar.url)
                    success_embed.set_footer(text=config.footer_text, icon_url=self.bot.user.avatar.url)
                    await ctx.send(embed=success_embed)
                    await reply.delete()```
#

this works the same as ctx.send... correct?

naive briar
#

What works the same?

vapid parcel
#

ctx.reply

#

to accept the interaction in a Hybrid

#

so no timeout

naive briar
#

Sure

vapid parcel
#

Okay, just making sure

naive briar
#

Wait, no

vapid parcel
#

Bruh

#

so it needs to be ctx.send?

naive briar
#

Yes, yes

vapid parcel
#

Yes or no 😭

#

So do reply or send?

naive briar
#

You'd already be responding to the user with the ctx.send if the command was an interaction

vapid parcel
#

Im wondering, does ctx.reply do the same thing

naive briar
#

No

vapid parcel
#

so it has to be ctx.send

naive briar
#

You'd just create another message to reply

naive briar
vapid parcel
#

So reply doesnt accept interaction, thats all i needed 😭

reef tide
#

using guild to create a text channel wont work within subcommands :?

#

or is there an issue somewhere else i keep getting the error that bot doesnt have id

reef tide
naive briar
#

Oh yes, bot instances doesn't have ids, but its account does

#

You can get the bot's account (or user) instance from the bot.user attribute

reef tide
#

ah says clientUser doesnt have the attribute create text channel either

naive briar
#

Because it doesn't. Maybe I should have explained it better

#

Are you trying to create a channel with a permission overwrite for the bot?

reef tide
#

wait

#

i think i understand now

#

yes oh my gosh i cant believe such a long headache was so simple

#

i am silly thank u!! @naive briar

naive briar
#

Don't worry about it vibing

void pumice
#

How can we get discord user about me content in discord.py 1.7.3 version

naive briar
#

You cannot. Also, discord.py 1.7.3 is very outdated

lofty pecan
#

Little question, if I want a user to give a value between 0 and 10 (0, 1, 2, ..., 10), what's the best thing to do:

A user text input where they send a value in chat, but I have to make sure this value is within the range?

A series of button below the question that the user has to click, so I don't have to check the value. But I repeat this button process for the series of question the bot asks

shrewd fjord
#

With a integer argument

lofty pecan
shrewd fjord
#

Oh, then ig use chat input

#

I dont get a point using button anyway, it think button isnt bad either, its upto your choice

#

Something like create a range(10) amount of buttons with the label i and have a same callback for each then add the button to a View then use View.wait() ig its better hmm

lofty pecan
#

Ye

hexed egret
#

!d

unkempt canyonBOT
naive briar
vapid parcel
#

Kinda just needing help... we have no clue how to fix this in anyway.

lofty pecan
#

Hey so, I'm trying to dynamically create several buttons with value between 0 and 10 so that when a user click on one of them, it sends its value in chat. I've done this so far:

class StatButtons(discord.ui.View):
    def __init__(self, bot, ctx):
        super().__init__()
        self.ctx = ctx
        self.bot = bot

    def create_button(self, value):
        return discord.ui.Button(label=str(value), custom_id=f'number_button_{value}')

    def add_buttons(self):
        for value in range(1, 11):
            button = self.create_button(value)
            self.add_item(button)

    async def interaction_handler(self):
        interaction = await self.bot.wait_for('button_click', check=self.interaction_check, timeout=self.timeout)
        await self.callback(interaction.component, interaction)
        await self.interaction_handler()

    async def callback(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.response.send_message(f"You clicked the button with value: {button.label}")

    async def on_timeout(self) -> None:
        await self.message.channel.send("Timed out")
        await self.disable_all_items()

    async def disable_all_items(self):
        for item in self.children:
            item.disabled = True
        await self.message.edit(view=self)

    async def interaction_check(self, interaction: discord.Interaction):
        return interaction.user == self.ctx.author```

with a test command:
```python
@commands.hybrid_command(name='test', with_app_command=True)
    async def test(self, ctx: CustomContext):
        view = StatButtons(self.bot, ctx)
        view.add_buttons()
        await ctx.send("Click a button:", view=view)
        await view.interaction_handler()```

But every time it gives me **THIS INTERACTION FAILED**. Is there a way to fix that?
slate swan
slate swan
#

thats how you create buttons and generally use views

lofty pecan
#

I'm trying to add multiple buttons using a for loop by the way

slate swan
#

i still dont see you assign callback to them

#

no wonder they do nothing when clicked

lofty pecan
#

how would you do that then

#

I kinda get how this works for one but when you have several like that?

slate swan
#

!d discord.ui.Button.callback

unkempt canyonBOT
#

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

The callback associated with this UI item.

This can be overridden by subclasses.
slate swan
#

or create a Button subclass and override the callback method

lofty pecan
#

huh

lofty pecan
slate swan
lofty pecan
#

then do I just make the same thing expect I put a for loop in the init or somewhere else

#

problem is the label depends on the button pressed

#

so I can't just put a label in the decorator

slate swan
#

no like i said assign callback yourself or use custom subclass

#

if you want dynamic you cant use button decorator

lofty pecan
#

yeah I want something dynamic

slate swan
#

custom Button subclass ^

lofty pecan
#

I don't want to repeat the same button function 10 times that's kinda stupid

final iron
#

You can manually initialise the button class and set the callback inside your loop to dynamically create them

lofty pecan
# slate swan https://github.com/Rapptz/discord.py/blob/master/examples/views/tic_tac_toe.py
# Button for character statistics definition
class StatButtons(discord.ui.Button):
    def __init__(self):
        super().__init__(style=discord.ButtonStyle.secondary, label='\u200b')

    # This function is called whenever this particular button is pressed
    async def callback(self, interaction: discord.Interaction):
        assert self.view is not None
        view: OCStat = self.view
        view.stop()
        await interaction.response.send_message()


# This is our actual statistics selection View
class OCStat(discord.ui.View):
    def __init__(self):
        super().__init__()
        for i in range(11):
            self.add_item(StatButtons())

I'm trying to make sense of the example in this context

#

it's just how to I get the label of the button pressed in the interaction.response.send_message()

slate swan
#

you need to get the number in button from the for loop

lofty pecan
lofty pecan
#

no wayyyyyy

#

but if I want to store this value in a variable how would that work

unkempt canyonBOT
#

examples/views/tic_tac_toe.py lines 17 to 18

self.x = x
self.y = y```
lofty pecan
#

so uh, like before, simply self.label ?

slate swan
#

what

#

just show code

lofty pecan
#
class StatButtons(discord.ui.Button):
    def __init__(self, label):
        super().__init__(style=discord.ButtonStyle.secondary, label=label)

    # This function is called whenever this particular button is pressed
    async def callback(self, interaction: discord.Interaction):
        assert self.view is not None
        view: OCStat = self.view
        view.stop()
        await interaction.response.send_message(self.label)


# This is our actual statistics selection View
class OCStat(discord.ui.View):
    def __init__(self):
        super().__init__()
        for i in range(11):
            self.add_item(StatButtons(label=str(i)))```
#
    # Example usage:
    @commands.hybrid_command(name='test', with_app_command=True)
    async def test(self, ctx: CustomContext):
        """Starts a counter for pressing."""
        await ctx.send('Press!', view=OCStat())```
slate swan
#

and what is the problem about it?

lofty pecan
#

I want to save the label value selected when the button is clicked

#

not just send it in chat

slate swan
#

you want to save it where

lofty pecan
#

because I need it for later use when running a command

lofty pecan
slate swan
lofty pecan
slate swan
#

you can create some dictionary in view

#

and save it to it

lofty pecan
#

wdym by that

slate swan
#

self.view["data"] = 123

lofty pecan
#

so simply self.view['data'] = self.value?

slate swan
#

actually

#

i missed it

#

its self.view.data["somedata"] = 123

#

and you have to define data dictionary in view

lofty pecan
#

mmh

#

I mean then it's an empty dictionnary

lofty pecan
slate swan
#

could be

lofty pecan
#

mmh

#

dude

lofty pecan
#
class StatButtons(discord.ui.Button):
    def __init__(self, label):
        super().__init__(style=discord.ButtonStyle.secondary, label=label)
        self.label = label```
#

lmao and then access the label value like that

slate swan
#

yeah like i didnt show you that already

proper cape
#

How do I make the "/" commands actually show up when you type "/"

lofty pecan
lofty pecan
#

I think there is also a time where it needs to be updated in the list so give it some time

proper cape
#

Sorry, but how?

#

This is my first time making a discord bot. Lol

lofty pecan
# slate swan .

yeah but it's not an object of OCStat but of the StatButton

slate swan
proper cape
#

Yea

slate swan
unkempt canyonBOT
#

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

Syncs the application commands to Discord.

This also runs the translator to get the translated strings necessary for feeding back into Discord.

This must be called for the application commands to show up.
white citrus
#

cog.py

    async def ticket_add(self, inter: 
Interaction):

        ticket_add_member_view = TicketAddMember()

        await inter.response.send_message(content="Hi", view=ticket_add_member_view)```

view.py

```py
class TicketAddMember(nc.ui.UserSelect):
    def __init__(self):
        super().__init__(placeholder="Please select a member...", min_values=1, max_values=1)

    async def callback(self, inter: Interaction):
        query = BotDB().query_ticket_informations(inter.channel.id)

        if query is not None and query[3] == inter.channel.id:
            selected_option = self.options[0].value
            print(selected_option)

            members = query[2]
            member_list = members if members is not None else []
            
            if selected_option not in member_list:
                member_list.append(selected_option)

            # BotDB().update_ticket_add_member(inter.channel.id, member_list)
        else:
            pass```
#

Error

Traceback (most recent call last):
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 497, in _run_event
    await coro(*args, **kwargs)
  File "c:\Discord\Maja Projekt\Maja-Beta\bot.py", line 206, in on_application_command_error
    raise error
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 918, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "c:\Discord\Maja Projekt\Maja-Beta\modules\ticket_system\cog.py", line 43, in ticket_add
    await inter.response.send_message(content="Hi", view=ticket_add_member_view)
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\interactions.py", line 880, in send_message
    payload["components"] = view.to_components()
AttributeError: 'TicketAddMember' object has no attribute 'to_components'```
hushed galleon
#

assuming nextcord didn't change this, a quick way to put it in a view would be: py view = nextcord.ui.View() view.add_item(SomeButtonOrSelect())

candid escarp
#

Anyone an idea on how to make a AI support discord bot? Like a bot who replys to users questions and problems in a ticket like a supporter

final iron
proper cape
#

Ok, so, when I was making my discord bot, I decided to use a symbol "$" instead of "/", and now the only way that the new slash commands will show up is if I'm using the bot on my test server. Anyone know why?

#

@slate swan

patent lark
#

yo, i need a little help. So ive created some modmail functionality, and i am grabbing the "thread channel" using discord.utils.get, looping through guild.text_channels and accessing the TextChannel.topic (which is the thread users id). I want to create a subscribe function that does the following: When a staff member runs .subscribe in the thread, it adds their ID to the topic as well, separated by a comma. And will ping them anytime the thread user sends a message. Heres my issue, when the subscribed users id is in the topic along with the thread user id, the thread channel will return None because im checking if the topic is their user id. And obviously two IDs and a comma is NOT their user id. How can i get around this?

naive briar
#

!d discord.TextChannel.threads

unkempt canyonBOT
naive briar
#

Just a double loop basically

patent lark
#

Im just calling it "thread channel" in my code

naive briar
#

Who would ever be confused

final iron
#

I feel like this whole implementation is convoluted but you could just split the string on “,” and loop through the indexes, or if the target ID will always be first then you can just grab the index

nova vessel
#

Anyone got an example on how to create a slash command using discord.py?

patent lark
nova vessel
final iron
nova vessel
#

And how'd I add the buttons to the embed?

final iron
#

The views folder lol

#

It’s in the example folder

nova vessel
#

And is it possible to use this in my moderation class?

final iron
hushed galleon
#

as for embeds you would create an instance of the discord.Embed class, set whatever attributes you want, and then send it in your message using the embed= argument

nova vessel
#

So I couldn't do embed.add_action?

final iron
#

Not sure what that is tbh

#

Which library are you using?

hushed galleon
#

the discord API doesn't have any relationship between buttons and embeds, so dpy doesn't provide a method like that

nova vessel
#

Ah

final iron
#

Yeah, buttons are bound to the message itself, just like embeds

nova vessel
#

Dang, alot of code to add in a button lol

final iron
#

Not really if you take it step by step

nova vessel
#

So in theory, could I make a file within my cogs folder called "counters.py" and just place all of the individual buttons in there and then call them onto messages when I need such as in my "moderation.py" file and then depending on the button they click, perform the rest of the actions within the "moderation.py" file?

#

Struggle with building the logic behind my code sometimes lol

final iron
#

The typical implementation for buttons is the discord.ui.button decorator is used on a function, and that function becomes the callback for the button created

#

Buttons can be dynamically created though

hushed galleon
#

or do you mean you want your view to be reusable across multiple cogs? sure you can do that

nova vessel
#

Honestly, I have never used buttons before and slash commands so I am just trying to learn them (the wrong way, I know lol)

#

Are either of you able to hop into one of the VCs to explain please?

hushed galleon
#

i cant, but i would recommend looking at the view documentation to see what methods are provided

nova vessel
#

Where is that located?

hushed galleon
#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
hushed galleon
#

views are usually written to handle actions in the callback of each button but they do allow you to wait for the view to be stopped, at which point you can have some attribute to represent whatever selection they made

nova vessel
#
import discord, json
from discord.ext import commands
# Cogs
from cogs.moderation import Moderation

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

class Client(discord.Client):
    def __init__(self, *, intents: discord.Intents):
        super().__init__(intents=intents)
        self.moderation = Moderation(self)
    
    async def on_ready():
        try:
            synced = await # commands tree sync
            print(f"Synced {len(synced)} command(s)")
        except Exception as e:
            print(e)

        await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="RMC play!"))
        print(f'Logged in as {bot.user.name}')

    @bot.event
    async def on_message(message):
        await bot.process_commands(message)

    with open('config.json', 'r+') as f:
        config = json.load(f)

    bot.run(config['botkey'])

As I am going to have multiple classes, how can I cycle through them all to sync them?

hushed galleon
#

err you should only have one client/bot instance

#

also seems unusual to be instantiating the cog manually without adding it with add_cog(), or more conventionally setting it up as an extension

nova vessel
#

As it works of a "tree"

hushed galleon
#

the Bot class handles registering slash commands in cogs defined with @app_commands.command() for you

vernal folio
#

HELP PLEASE

hushed galleon
#
  1. use just the commands.Bot class (it does everything discord.Client can do, and comes with a free CommandTree and prefix command support)
  2. have a command to sync your tree when you want to
  3. setup your cog as an extension so you can load it
    in summary it might look like: ```py
    class Bot(commands.Bot):
    async def setup_hook(self):
    await self.load_extension("cogs.moderation")

bot = Bot(command_prefix="!", ...)
bot.run(...) py

cogs/moderation.py

class Moderation(commands.Cog):
...

async def setup(bot):
await bot.add_cog(Moderation(bot))```

nova vessel
#

Ah, this seems a lot more efficient and has filled a void in my knowledge, thank you 💙

candid escarp
solar elbow
#

I created a discord bot that helps you make and find new places to get coffee. Who would like to try it?

grizzled yew
#

anybody thoughts?

gusty forum
#

Pretty nice! Nice icons, overall nice theme

grizzled yew
#

thank you, any way to improve it?

gusty forum
#

Maybe some other icon for Duration ? User Id and Duration have same icon AnimuThinku

grizzled yew
#

I'm making a really good bot in python passionately, looking for some team members aswell to help me make it the best visual embed bot on discord

grizzled yew
gusty forum
#

👌 Ye, other than that it looks real nice

grizzled yew
#

Thank you!

#

you seem like an experienced developer/person, just offering would you like to join the development of this bot? we have plans to publically launch it by next year jan-feb and till then we'll be working on making it a really good visual experience (the stylish embeds and informative responses rather than just saying "xyz was banned")

#

I can personally code this bot, but I run out of ideas so It would be nice to have a team to work with ^^

#

we've got one of my friends already onboard the project

gusty forum
#

I've got plenty of work myself 😅 And just getting back to Python rn from doing C# only for the past few months.. xD

grizzled yew
#

yeah you don't really need to code anything tbh, just guide me on the embed/visual stuff etc

#

lmk if ur down, totally fine if you cannot.

gusty forum
#

I just came here to ask some peeps for advice on how to communicate to Discord bot from website and back asynchronously 😅 How do people usually do this ? Do I just run both under 1 process ? With Python running on 1 thread for most part without using multiproc it scares me lol..
I got a bot sitting in little over 100 servers with ~8K users it frequently iterates over and uh xD I was using RPyC to communicate between web process and bot process but damn is it slow xD

What/how do other big python bots do this ? xD GuraConfused

#

Do they just store all the user-data etc.. and everything on their DB Sus

golden portal
gusty forum
golden portal
#

oke

grizzled yew
#

why are embed titles not aligned??

golden portal
#

discord client issue

grizzled yew
#

oh

hushed galleon
#

does your create_pool() literally have ... for the address? that seems to be implied by the Ellipsis in your error message

sharp whale
#

I need help with requests

#

im getting this error

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /Fraesh/vps-db/master/vpsdb.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000024A19D33B90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))```
#

but i can open the API url in my browser

#

code:```py
import requests

json_url = 'https://raw.githubusercontent.com/Fraesh/vps-db/master/vpsdb.json'

response = requests.get(json_url)
data = response.json()

if isinstance(data, list) and data:
sample_item = data[0]

if isinstance(sample_item, dict):
    keys = sample_item.keys()
    print(f"Keys in each item: {keys}")
else:
    print("Each item in the JSON data is not a dictionary.")

else:
print("The JSON data is either not a list or is empty.")

fast musk
#

is the error intermittent? Could be firewall. Could be their side

#

also in the context of discord bots, most are async so you wouldn't want to use requests, but an async library such as aiohttp

sharp whale
haughty dew
#

I'm currently writing a discord bot, and I'm looking for the best way to create and categorize slash commands. Previously I've used a CommandTree, but adding parameters, descriptions, and organization (for example, command groups) was difficult and needlessly complex. So before I fall into any pitfalls, what's the best way to create a slash command structure?

sharp whale
#

Cog groups

#

!d discord.ext.commands.GroupCog

unkempt canyonBOT
#

class discord.ext.commands.GroupCog(*args, **kwargs)```
Represents a cog that also doubles as a parent [`discord.app_commands.Group`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Group) for the application commands defined within it.

This inherits from [`Cog`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog) and the options in [`CogMeta`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CogMeta) also apply to this. See the [`Cog`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog) documentation for methods.

Decorators such as [`guild_only()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.guild_only), [`guilds()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.guilds), and [`default_permissions()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.default_permissions) will apply to the group if used on top of the cog.

Hybrid commands will also be added to the Group, giving the ability to categorize slash commands into groups, while keeping the prefix-style command as a root-level command.

For example...
hushed galleon
haughty dew
#

I couldn't find anything, really.

@tree.command(name = "addassignablerole", description="Add a role to the assignable roles list")
@app_commands.describe(role = "role to add")
@app_commands.rename(role = "role")
hushed galleon
#

you er don't need a rename if it's still going to be given the same name

#

but regardless for descriptions, Google/Sphinx/Numpy-style docstrings can be used instead: ```py
@bot.tree.command(name="add-assignable-role")
async def add_assignable_role(interaction, role: discord.Role):
"""Add a role to the assignable roles list.

:param role: The role to add.

"""```
haughty dew
#

Okay, what about grouping commands?

hushed galleon
#

if you're not using cogs/extensions the first two syntaxes would be appropriate, but if you are using cogs you'd want to pick one of the last two

haughty dew
hushed galleon
#

its part of the discord.ext.commands extension (to be used with commands.Bot rather than discord.Client), and it helps you organize your code in different files

#

for example: ```py

main.py

from discord.ext import commands

class Bot(commands.Bot):
async def setup_hook(self):
await self.load_extension("path.to.my_extension")

bot = Bot(command_prefix="?", ...)
bot.run(...) py

path/to/my_extension.py

class MyCog(commands.Cog):
def init(self, bot):
self.bot = bot

@commands.command()
async def some_prefix_command(self, ctx: commands.Context):
    await ctx.send("Hello world!")

@app_commands.command()
async def some_slash_command(self, interaction: discord.Interaction):
    await interaction.response.send_message("Hello world!")

async def setup(bot):
await bot.add_cog(MyCog(bot))```

haughty dew
#

Neat

acoustic kernel
#

Is it possible to make the same command accessible with different names?

#

Like I want users to be able to go
/info
or
/i

#

Also, can I have it so that a parameter in a slash command isn't required for the command.

@bot.tree.command(name="find",description="Searches a location on a map.")
async def find(interaction: discord.Interaction, location: str,):

Like can i make the location not be neccissary to type in

fast musk
#

discord.py uses type hints to accomplish this. Type location as an Optional[str] and assign to None as default

acoustic kernel
#

Alright thanks!

fast musk
#

afaik no aliases on app commands since they are registered

#

I haven't personally needed to use an alias since the UX is a context menu that displays them as you type

sharp whale
fast musk
#

same error? You'd be in the same boat as me. Google will show you the way

#

it isn't a python problem really

hushed galleon
fast musk
#

something something explicit is better than implicit 😄

#

j/k I won't die on this hill

haughty dew
#

What's a good way to get my bots permissions in a guild? interaction.guild.me.resolved_permissions.manage_messages doesn't seem to work

hushed galleon
unkempt canyonBOT
haughty dew
#

Nice

hushed galleon
#

or if it needs to consider the overwrites of another channel you'll probably want to use interaction.guild.me.permissions_in(channel)

#

wait they removed that didnt they

acoustic kernel
#

How do I have a bot automatically add reactions to a message?

                message = await interaction.response.send_message(embed=m_embed)
            await interaction.message.add_reaction("1")
            await interaction.message.add_reaction("2")
            await interaction.message.add_reaction("3")
acoustic kernel
#

huh it doesnt seem to be working idk why

#

I figured I was doing it wrong

candid escarp
#

Anyone an idea on how to make a AI support discord bot? Like a bot who replys to users questions and problems in a ticket like a supporter

haughty dew
#

Good question GAY STRIPER (FEMBOY), First you'll need a library of pictures of natsuki from doki doki

slate swan
#

niezle about me

haughty dew
candid escarp
haughty dew
acoustic kernel
haughty dew
#

do you delete the message at some point?

#

perhaps ```py
msg = await interaction.response.send_message("Reply")
msg.add_reaction("1")

#

though, I'm not sure if interaction.response.send_message() actually returns anything

#

if not try msg = await interaction.original_response()

final iron
acoustic kernel
#

I got it able to work and send emojis

#

Thank you for the help!

candid escarp
# haughty dew https://platform.openai.com/docs/guides/fine-tuning

This is the example i found in the docs:

{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What's the capital of France?"}, {"role": "assistant", "content": "Paris, as if everyone doesn't know that already."}]}
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "Who wrote 'Romeo and Juliet'?"}, {"role": "assistant", "content": "Oh, just some guy named William Shakespeare. Ever heard of him?"}]}
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "How far is the Moon from Earth?"}, {"role": "assistant", "content": "Around 384,400 kilometers. Give or take a few, like that really matters."}]}

but isnt this just a like keyword thing then?

haughty dew
#

I imagine it's used more like context than keyword.

#

Imagine "Respond in a sarcastic way, for example Question: "How far is the moon from Earth?' Response: "Around 384,400 kilometers. GIve or take a few, like that really matters.""

candid escarp
#

and if i write whats tthe distance between moon and earth? he will also answer my content?

haughty dew
#

I imagine it'll answer the question to the best of it's abilities while considering the context of the fine tuning

#

But it's probably better to go to a ChatGPT development related discord. as I'm not deeply familiar with ChatGPT, nor do I care.

#

the discord bot side of this is piping in prompt and replying with response

cunning briar
#

``py

#
@bot.tree.command(name="kick",description="kicks a member from the server")
async def kick(ctx, user:discord.Member, *, reason=None):
    await user.kick(reason=reason)
    embed = discord.Embed(title='{} has been kicked by {} for {}'.format(user,ctx.author,reason), color=0xf39c12)
    await ctx.respond(embed=embed)

bot.run(TOKEN)

[output]

#

TypeError: parameter 'reason' is missing a type annotation in callback 'kick'

hushed galleon
#

str is the type for strings, so reason: str would be appropriate

#

btw ctx.respond() doesn't exist in discord.py, and tree commands don't receive ctx Contexts

unkempt canyonBOT
#

examples/app_commands/basic.py lines 41 to 44

@client.tree.command()
async def hello(interaction: discord.Interaction):
    """Says hello!"""
    await interaction.response.send_message(f'Hi, {interaction.user.mention}')```
ornate linden
#

what's the difference between the @[discord.Client].hybrid_command decorator and the @commands.hybrid_command decorator?

#

the documentation is different but it seems like they do the same thing

glad cradle
#

none, you use the former when you have the client object, the latter when you're in a cog

ornate linden
#

that's exactly what i did lol
makes sense

hushed galleon
#

the commands.hybrid_command() decorator merely creates a HybridCommand instance (which gets registered during bot.add_cog()), but Bot.hybrid_command() also adds it to the bot instance

#

your bot instance isn't typically available in an extension until setup() gets called though, hence why it has to be deferred to add_cog(), or at least a Bot.add_command() call in setup()

ornate linden
#

another question
how should I go about making a custom error handler in a hybrid bot?
on_command_error or bot.tree.on_error or something else?

final iron
# ornate linden another question how should I go about making a custom error handler in a hybrid...

There is no global app (slash) commands error event but you can set one for your CommandTree.

Documentation

One way to do this is by subclassing CommandTree and overriding on_error. (recommended)
Or use the decorator:

Example

from discord import app_commands, Interaction

bot = commands.Bot(...)
# Bot has a built-in tree
# but this is the same for a CommandTree you define.
tree = bot.tree
# can't find your tree? -> ?tag definetree

# this will function as a global error handler for app commands
@tree.error
async def on_app_command_error(
    interaction: Interaction,
    error: app_commands.AppCommandError
):
    ...
ornate linden
#

cool, thanks

harsh egret
#

im trying to make it so where my bot always gives me permission to kick someone even when i dont have permission this is my coding

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
  if ctx.message.author.id == '338793925517115402':
    await member.kick(reason=reason)
    await ctx.send(f'User {member} has kicked.')
  if isinstance(error, commands.MissingPermissions):
    await ctx.send(f"Permissions needed {error.missing_perms}")
#

and it wont work

#

anyone know why?

golden portal
#

!e ```py
print(123 == '123')

unkempt canyonBOT
#

@golden portal :white_check_mark: Your 3.12 eval job has completed with return code 0.

False
half moth
#

Does anyone know how to create a bump reminder? More specifically, I don't know how to figure out when /bump is run to start a timer...

half moth
#

A bump reminder meaning after /bump is run for that bot it will start a timer to remind you later

naive briar
#

Just detect that bot's bump message and start your timer 🤷

half moth
#

That's the issue though i don't know how lol

#

Although, I'll look through the discord.py API Reference to find something

sick birch
#

you will probably not find anything there

#

bumping is a third party thing and not related to the official Discord API

half moth
#

I understand that, I'm looking for a way to detect the embed and the user who used the /bump

sick birch
#

!d discord.on_message

unkempt canyonBOT
#

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

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.messages) to be enabled.

Warning

Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot) does not have this problem.
sick birch
#

you would need to do some filtering to figure out of this message is a bump message but you can probably handle that

half moth
#

Ah ok, what about knowing the user that ran the command?

clear lark
#

if discord.on_message uses ctx you should be able to just use ctx.author(returns username) or ctx.author.id(returns user-id) If you want to message that user await ctx.send.author()

#

or the equivalents for interactions (no idea what discord.on_message uses)

half moth
#

That works for getting the bot's id as it's the one sending the embed but for the user who ran the command it doesn't really work

clear lark
#

You could try checking for the command instead of the bump embed? Not sure

half moth
#

Yeah that's the goal but i haven't found a way to check for the command because it's sent to the bump bot not my bot

clear lark
#

Oh is the bump command a slash command?

half moth
#

Maybe there is another round-a-bout way of figuring out the user who ran the command but i haven't been able to find anything

#

I know it's possible as this other bot has done it but don't know how

clear lark
#

I have no idea, never had to worry about reading from embeds, webhooks, etc that weren't integrated as part of my bot

half moth
#

hmm

nova vessel
#

Does a Discord accounts user ID ever change or does it remain the same since you made the account?

clear lark
#

Always the same iirc

nova vessel
#

Thank you!

slate swan
#

Why does it keep saying ImportError: attempted relative import with no known parent package

#

the line it says the error is on is just ```py
from ..ChurchEconomy import objectives

sharp whale
#

I am not able to send requests to any api using aiohttp or requests, please help

golden portal
main torrent
#

Anyone know how to setup autoresponder

#

@sick birch

thin raft
main torrent
old vine
#

anyone can help me?

shrewd apex
naive briar
#

How to not ask to ask

grizzled yew
#

views?

turbid condor
grizzled yew
#

88 hours = 3 days | 16 hours

#

will maybe look into fixing that soon

turbid condor
#

That's the only issue i see

#

Rest looks ok

naive briar
grizzled yew
grizzled yew
#

indentation*

turbid condor
naive briar
#

Yes

turbid condor
#

Well it's not needed there but it's their choice

#

And green color for a moderator action idk

grizzled yew
turbid condor
#

I'd rather say yellow looks better for that

grizzled yew
turbid condor
grizzled yew
#

okay

turbid condor
#

Well it's your choice since you are following a theme

grizzled yew
#

if you see all my icons match aswell, I believe in 1 theme (except the error embeds which are red)

#

yeah but one day I'll make the bot public for people so u can put ur point yk?

#

I'm looking for people to join the team to advise me on such topics btw.. if you're interested join vision development 😁

turbid condor
#

Well I can help out a bit if you'd like

#

Since I'm on a break

grizzled yew
#

sure

#

I've dmed you!

shrewd apex
final iron
#

You’re passing self when you call the argument

#

You need a discord.Interaction instance

obsidian fable
#

is there any way to restrict the data types passed in discord.ui.TextInput?

final iron
#

Best you can do is verify the information passed in on_submit

final iron
#

When you’re calling the argument you’re passing in self as an argument

#

Well I’d start with removing it

#

It’s your code though, and you don’t have any typehints so only you know what to pass

slate swan
#

I want to import a @commands.group in multiple files but im getting this error: ImportError: cannot import name '' from partially initialized module '' (most likely due to a circular import) ()

in most of the files i have something like that in my imports:

from cogs.filename import one, two
from cogs.filename import three
from cogs.filename import four

What is causing the error and how can i fix it?

final iron
#

!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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

slate swan
#

They are too big. If you want i can send you a small example.

slate swan
cunning briar
#
@bot.command()
async def clearbans(ctx):
    if ctx.author.guild_permissions.administrator:
        guild = ctx.guild
        bans = await guild.bans()

        if len(bans) == 0:
            await ctx.send('No bans were cleared.')
        else:
            for ban in bans:
                await guild.unban(ban.user)
            await ctx.send(f'{len(bans)} bans were cleared.')
    else:
        await ctx.send('You do not have the necessary permissions to use this command.')
bot.run(TOKEN)
``` why it dosent work
final iron
#

!d discord.Guild.bans

unkempt canyonBOT
#

async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator) of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/latest/api.html#discord.BanEntry).

You must have [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members) to get this information.

Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list.

Examples

Usage...
cerulean pasture
unkempt canyonBOT
#
Custom help commands in discord.py

To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000

shrewd fjord
#

Sup fellas

golden portal
#

schizo

rugged shadow
#

what did bro do 🤔

sharp whale
#

I need help with background tasks

#

how do i start the task

naive briar
#

task.start() 🫠

sharp whale
shrewd fjord
#

What is exactly not working

sharp whale
#
class MonitoringCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.compare_and_send.start()


    @tasks.loop(seconds=10)
    async def compare_and_send(self):
        print("running")
        
    def cog_unload(self):
        self.compare_and_send.stop()
        

async def setup(bot):
    await bot.add_cog(MonitoringCog(bot))```
shrewd fjord
#

Show code / error

sharp whale
sharp whale
shrewd fjord
#

Are you sure about the cog getting loaded?

sharp whale
#

yes

shrewd fjord
#

SUS add a print() in init

sharp whale
#

wait ill check with on_ready listener

#

yes its getting loaded

shrewd fjord
#

dead ?

#

Oh the cog

sharp whale
#

yes

#

btw nice pfp

shrewd fjord
#

Can you use cog_load and start it there?

sharp whale
#

what

#

oh

shrewd fjord
#

I think start() needs to be in asynchronous func

#

!d discord.ext.commands.Cog.cog_load

unkempt canyonBOT
#

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

A special method that is called when the cog gets loaded.

Subclasses must replace this if they want special asynchronous loading behaviour. Note that the `__init__` special method does not allow asynchronous code to run inside it, thus this is helpful for setting up code that needs to be asynchronous.

New in version 2.0.
sharp whale
#

it doesn't

#
from discord.ext import tasks, commands

class MyCog(commands.Cog):
    def __init__(self):
        self.index = 0
        self.printer.start()

    def cog_unload(self):
        self.printer.cancel()

    @tasks.loop(seconds=5.0)
    async def printer(self):
        print(self.index)
        self.index += 1
#

I found this at docs

shrewd fjord
#

Is it before or after migration, alot of stuff have been changed

fierce light
#

start isnt async

shrewd fjord
#

It isnt

sharp whale
shrewd fjord
#

But many methods need an asynchronous function to make it usable

fierce light
#

only async methods

shrewd fjord
fierce light
#

non-async doesnt need to be in async but can be in async functions

sharp whale
shrewd fjord
shrewd fjord
fierce light
#

async methods = should only be used inside an async function (or asyncio.create_task, asyncio.gather)
normal methods = can be used in both async and non-async

shrewd fjord
#

You are just not getting my point, some lib restricts a method to be only usable on an asynchronous func tho the method is synchronous

fierce light
sharp whale
fierce light
#

did it work?

sharp whale
#

no

shrewd fjord
#

try cog_load, that example might be old

sharp whale
#

when i have start it in cog_load it throws this error:

#

Extension 'Cogs.monitoring' raised an error: RuntimeError: Task is already launched and is not completed.

#

maybe i should remove itt from the initiator

fierce light
#

wrong reply

fierce light
#

wait what

sharp whale
fierce light
#

how are u loading ur cogs

shrewd fjord
sharp whale
# fierce light how are u loading ur cogs
async def loadcogs():
    for file in os.listdir("./Cogs"):
        if file.endswith(".py"):
            try:
                await bot.load_extension(f'Cogs.{file[:-3]}')
                print(f'Loaded Cog {file}')
            except Exception as e:
                print(f'Failed to load Cog {file}')
                raise e```
fierce light
#

yeah my brain is actually rotting

sharp whale
#

y

fierce light
#

no idea

sharp whale
#

lmao

shrewd fjord
#

Use logging i think

sharp whale
#

wat

shrewd fjord
#

!pip logging

unkempt canyonBOT
shrewd fjord
#

;-;

sharp whale
#

ik what logging is

#

im asking why

shrewd fjord
#

maybe the output of print is getting stored to stdout

fierce light
#

tried that cog in my bot

shrewd fjord
#

Thats why saying use logging to debug or smth xd

fierce light
#

it runs

#

no idea why it doesnt work for you though

sharp whale
#

[2023-11-24 16:24:40] [INFO ] discord.client: logging in using static token
[2023-11-24 16:24:42] [INFO ] discord.gateway: Shard ID None has connected to Gateway (Session ID: *).

#

not working

fierce light
#

lol

#

damn

sharp whale
#

my brain going brrr

fierce light
#

full main file? without the token

sharp whale
#
import discord
from discord.ext import commands
import logging
import os
import asyncio
from utils.config import basicconfig

bot = commands.Bot(command_prefix=basicconfig.prefix, intents=discord.Intents.all())


@bot.event
async def on_ready():
    print(f"""
          ready
          """)


async def loadcogs():
    for file in os.listdir("./Cogs"):
        if file.endswith(".py"):
            try:
                await bot.load_extension(f'Cogs.{file[:-3]}')
                print(f'Loaded Cog {file}')
            except Exception as e:
                print(f'Failed to load Cog {file}')
                raise e

import logging

handler = logging.FileHandler(filename="Error.log", encoding="utf-8", mode="w")


asyncio.run(loadcogs())
bot.run(basicconfig.token, log_handler=handler)```
shrewd apex
#
from discord.ext import commands


class MyCog(commands.Bot):
    def __init__(self, bot: commands.Bot):
        self.bot = bot


async def setup(bot: commands.Bot):
     await bot.add_cog(MyCog(bot))
sharp whale
robust fulcrum
unkempt canyonBOT
#

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

A coroutine to be called to setup the bot, by default this is blank.

To perform asynchronous setup after the bot is logged in but before it has connected to the Websocket, overwrite this coroutine.

This is only called once, in [`login()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.login), and will be called before any events are dispatched, making it a better solution than doing such setup in the [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready) event.

Warning

Since this is called *before* the websocket connection is made therefore anything that waits for the websocket will deadlock, this includes things like [`wait_for()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.wait_for) and [`wait_until_ready()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.wait_until_ready)...
sharp whale
#

I used it in the cog

#

to add cogs bruh

robust fulcrum
#

wdym?

sharp whale
#

just leave it

#

I want help with background tasks

#

@naive briar hi

#

helppppp

robust fulcrum
#

don't ping random people

sharp whale
#

sry

sharp whale
fierce light
sharp whale
fierce light
#

I have no idea💀

sharp whale
#

lmao its making my brain go brr

#

@fierce light what version of discord.py are you on?

fierce light
#

2.3.1

final breach
#

how to import slash command to my bot by loading extension
i did import regular commands but the slash command did not apirs in bot app commands

sharp whale
#

sync the command tree

#

ez

final breach
#

i did sync the command tree
but didnt show

sharp whale
#

wait for sometime

#

discord takes time to show the commands

#

2 - 3 minutes

final breach
#

ok i will see

final breach
# sharp whale wait for sometime

is this write

class PlayerPresenceCog(commands.Group):
    def __init__(self, bot):
        self.bot = bot

    @commands.command(
        name="player_presence",
        description="Retrieves and displays player presence information",
    )
    async def player_presence(self, ctx, discord_id: str):
        embed = await player_info_embed(discord_id)
        await ctx.send(embed=embed)
sharp whale
#

this is a prefixed command

#

!d discord.app_commands.command

unkempt canyonBOT
#

@discord.app_commands.command(*, name=..., description=..., nsfw=False, auto_locale_strings=True, extras=...)```
Creates an application command from a regular function.
fierce light
sharp whale
#

jed

#

can you show me your main.py and full cog

#

in which you used my code block

#

@fierce light

fierce light
#
from discord.ext import commands, tasks

class MonitoringCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.compare_and_send.start()


    @tasks.loop(seconds=10)
    async def compare_and_send(self):
        print("running")
        
    def cog_unload(self):
        self.compare_and_send.stop()
        

async def setup(bot):
    await bot.add_cog(MonitoringCog(bot))
#
import os
import json

from discord import Game, Message
from discord.ext.commands import Bot
from yoyo import read_migrations, get_backend

from config.config import get_config
from constants import intents, token
from database.moderation import ModerationDB


class Molina(Bot):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(
            *args,
            command_prefix="?",
            intents=intents,
            **kwargs
        )
        self.filters = []  # global list of filtered words

    async def get_prefix(self, message: Message) -> str:
        pfx = get_config("bot", "commandPrefix")
        return pfx or "?"

    async def update_filters(self):
        db = ModerationDB()
        filters = await db.get_filtered_words()
        self.filters = [f[1] for f in filters]

    async def on_ready(self) -> None:
        await self.wait_until_ready()
        await self.update_filters()
        await self.change_presence(activity=Game(name="Mobile Legends: Bang Bang"))
        print(f"{self.user} is ready.")

    async def setup_hook(self) -> None:
        config_path = "bot/config/config.json"
        if not os.path.exists(config_path):
            with open(config_path, "w") as c:
                json.dump({}, c)

        for cogs in os.listdir("bot/cogs"):
            if cogs.endswith(".py"):
                await self.load_extension(f"cogs.{cogs[:-3]}")

        url = f"sqlite:///./bot/database/mlbbph.db"
        backend = get_backend(url)
        migrations = read_migrations('./migrations')
        backend.apply_migrations(backend.to_apply(migrations))


molina = Molina()
molina.run(token)
#

@sharp whale

sharp whale
#

why would any one name the bot instance as molina lmao

shrewd apex
#

its triggered multiple times throughout a bots lifespan

fierce light
shrewd apex
#

fair

fierce light
#

ugly ahh code 🔥

fierce light
sharp whale
#

Asher

#

halp me pls

#

should i try my code in replit or something

#

@fierce light bro i just called the start function in "on_ready" listener and now it works lmaoaoaoooaoao

fierce light
#

do it in "setup_hook"

final breach
#

is this write

from discord import app_commands
from discord_py import player_info_embed

class PlayerPresenceCog(app_commands.commands):
    @app_commands.command(
        name="player_presence2",
        description="Retrieves and displays player presence information",
    )
    @app_commands.describe(discord_id='the member to retrieve information for')
    async def player_presence(self, ctx, discord_id: str):
        embed = await player_info_embed(discord_id)
        await ctx.response.send_message(embed=embed)

async def setup(bot):
    bot.tree.add_command(PlayerPresenceCog())
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

shrewd apex
#

cog and bot

sharp whale
#

it works now

shrewd apex
#

aight cool what was the issue the cog loading i am gonna assume

shrewd apex
fierce light
# final breach is this write ```py from discord import app_commands from discord_py import play...
from discord import app_commands
from discord.ext.commands import Cog
from discord_py import player_info_embed

class PlayerPresenceCog(Cog):
    def __init__(self, bot):
        self.bot = bot

    @app_commands.command(
        name="player_presence2",
        description="Retrieves and displays player presence information",
    )
    @app_commands.describe(discord_id='the member to retrieve information for')
    async def player_presence(self, ctx, discord_id: str):
        embed = await player_info_embed(discord_id)
        await ctx.response.send_message(embed=embed)


async def setup(bot):
    await bot.add_cog(PlayerPresenceCog(bot))
#

wrote that on top of my head

#

dunno if its right

fierce light
#

yeah i was skeptical bout what i wrote

young dagger
#

How can I wait for a user to move to a voice channel?

fierce light
#

np

fierce light
drifting arrow
#

hhmm

young dagger
#

How can I send a message in the voice channel after the user has been moved?

    create_vc_channel_id = 1151598666239463488

    # Check if the member joined the "Create VC" channel
    if before.channel is None and after.channel and after.channel.id == create_vc_channel_id:
        # Wait for the user to be moved to another voice channel
        def check(new_after):
            return new_after.channel and new_after.channel.id != create_vc_channel_id and new_after.channel != after.channel and new_after.channel.guild == after.channel.guild

        try:
            new_after = await client.wait_for('voice_state_update', check=check, timeout=10.0)
        except asyncio.TimeoutError:
            print(f'Timed out waiting for {member.display_name} to be moved to another channel.')
            return

        await new_after.channel.send(
            f"{member.mention} You can block a member from joining your voice channel. When you block someone, they won't be able to see your voice channel. Visit [#1151576650069311499](/guild/267624335836053506/channel/1151576650069311499/) to manage your voice channel.")
        return
shrewd fjord
#

!d discord.VoiceChannel.send

unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) objects. **Specifying both parameters will lead to an exception**.
shrewd fjord
#

Well yeah just use it?

#

And depends on in which channel do you want to send msg like before or after

young dagger
#

[2023-11-24 14:48:12] [ERROR ] discord.client: Ignoring exception in on_voice_state_update Traceback (most recent call last): File "C:\Users\Gamer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\client.py", line 441, in _run_event await coro(*args, **kwargs) File "D:\discord bots\blitzcrank.py", line 2313, in on_voice_state_update new_after = await client.wait_for('voice_state_update', check=check, timeout=10.0) File "C:\Users\Gamer\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 445, in wait_for return fut.result() File "C:\Users\Gamer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\client.py", line 474, in dispatch result = condition(*args) TypeError: on_voice_state_update.<locals>.check() takes 1 positional argument but 3 were given

shrewd apex
#

!d discord.on_voice_state_update

unkempt canyonBOT
#

discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) changes their [`VoiceState`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceState).

The following, but not limited to, examples illustrate when this event is called...
shrewd apex
#

@young dagger check needs 3 arguments

young dagger
#

Do I need to fetch the voice channel before sending a message?

#

Checking: Beerhunter, ➕ Create VC, Aram Timed out waiting for Beerhunter to be moved to another channel.

#

Aram = New voice channel in this case

shrewd apex
#

its method under the voice channel object

young dagger
#

For some reason when two users are joining create_vc_channel_id at the same time. The bot sends 2 (double) messages to the same user and ignoring the other one

stark nexus
#

Anyone have suggestions gor my bot?

#

I mean i successfully made a bot

#

But i hope the dialogue change according the guild(server)
Is there there way?

#

I already made 2 main.py , fuctions are same but i edited dialogue

latent harness
#

Hey guys! Is there a complete guide for making discord bots from scratch?

#

I really just started making one

#

in replit

#

And i don't want tto discontinue

#

but am getting stuck a lot

shrewd apex
latent harness
#

since i am a complete beginner

latent harness
shrewd apex
#

its guides u to make a bot from scratch right from installing python and creating the bot

shrewd apex
#

few areas are still yet to be documented but the slash command and basic commands stuff is present

latent harness
#

i did on replit is that fine asw?

shrewd apex
#

i suggest developing locally

shrewd apex
#

yeah

latent harness
shrewd apex
#

only views is left iirc

shrewd apex
latent harness
shrewd apex
latent harness
#

omg thanks a lot!!

shrewd apex
#

start from here lmk if u get stuck somewhere

latent harness
shrewd apex
#

ping me here I'll answer if i am active if not there will probably be other people active here helping as well if it's some doubt with the guide u can dm me or leave a comment

latent harness
#

Here it's said making a folder

#

Dows that mean on the pc?

#

@shrewd apex

#

?

shrewd apex
#

yeah

latent harness
#

So then I just make a folder on pc

#

then whats a code editor

#

just python right?

#

@shrewd apex ?

#

Sorry for the pings!!

shrewd apex
#

vscode is a code editor

#

u need something to code in

shrewd fjord
latent harness
shrewd fjord
#

Ping me instead

shrewd apex
latent harness
shrewd fjord
#

And yeah you need a code editor to like write python codes, but you can use notepad too 💀

shrewd apex
#

similar to how u write English but using ms word

latent harness
#

oooh ok

#

makes sense. So should i use vs code?

shrewd apex
#

vscode pycharm etc is the ms word equivalent for coding it autocompletes and corrects your code

#

yeah

shrewd fjord
latent harness
#

Uderstood!!

#

thnx!

shrewd fjord
latent harness
latent harness
#

what's going wrong here?

#

@shrewd fjord

#

?

shrewd apex
#

did u add python to path u had to mark a check box when installing

#

type in python --version in the terminal

latent harness
shrewd apex
#

have u installed python?

latent harness
shrewd apex
#

following the guide?

#

u ran the installer?

latent harness
latent harness
shrewd apex
#

u downloaded the installer right from python website?

#

can u double click on that

#

and send me a screenshot of the window that opens

#

also on another note i dont think discord bots run on python 3.12 yet coz aiohttp max is 3.11

latent harness
shrewd apex
#

the installer

latent harness
shrewd apex
#

yeah

latent harness
shrewd apex
#

install the 3.11 installer and send me a screenshot pf the window that pops up

shrewd apex
latent harness
#

I get that

#

does this work?

shrewd apex
#

yeah

latent harness
sharp whale
#

asher, i got another problem :)

#

the error handler isn't getting triggered```py
@commands.command(name="setnotificationchannel")
@commands.has_permissions(administrator=True)
async def setnotificationchannel(self, ctx: commands.Context, channel: discord.TextChannel):
LogChannelSet(value=channel.id)
await ctx.send(f"Successfully changed the channel for Notification updates! to {channel.mention}")
embed = discord.Embed(title="Channel Set!", description="This channel has been set for VPS updates notification", color=discord.Color.green())
await channel.send(embed=embed)

@setnotificationchannel.error
async def setnoti_error(self, error, ctx: commands.Context):
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("**You don't have the required permissions to use this command, you need __administrator permissions__ in order to use this command!**")
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send("**Please mention a channel**\n `!setnnotificationchannel #channel`")```
#

there's no error in the logs

shrewd apex
#

also i think the order is wrong

sharp whale
#

wdym order

#

there's an order for that?

shrewd apex
#

!d discord.ext.commands.Command.error

unkempt canyonBOT
#

@error```
A decorator that registers a coroutine as a local error handler.

A local error handler is an [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error) event limited to a single command. However, the [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error) is still invoked afterwards as the catch-all.

Changed in version 2.0: `coro` parameter is now positional-only.
shrewd apex
#

its ctx, error

#

u wrote the opposite

sharp whale
#

OH

#

mb

latent harness
#

There you go

#

thats what you wanted right? @shrewd apex

shrewd apex
#

yeah

#

click the checkbox down then install

latent harness
#

did that earlier asw

#

done

shrewd apex
#

now go to search in taskbar

#

type in cmd open command prompt

latent harness