#discord-bots

1 messages · Page 1040 of 1

slate swan
#

helo?😭

granite parcel
#
ctx.message.created_at.timestamp()```
#

using this i get time 5 hours ago how i get the time that is now

shrewd apex
slate swan
#

that gives you the UTC datetime, as the name suggests

granite parcel
slate swan
#

!d datetime.datetime.astimezone

unkempt canyonBOT
#

datetime.astimezone(tz=None)```
Return a [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") object with new [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.datetime.tzinfo "datetime.datetime.tzinfo") attribute *tz*, adjusting the date and time data so the result is the same UTC time as *self*, but in *tz*’s local time.

If provided, *tz* must be an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass, and its [`utcoffset()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcoffset "datetime.datetime.utcoffset") and [`dst()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.dst "datetime.datetime.dst") methods must not return `None`. If *self* is naive, it is presumed to represent time in the system timezone.

If called without arguments (or with `tz=None`) the system local timezone is assumed for the target timezone. The `.tzinfo` attribute of the converted datetime instance will be set to an instance of [`timezone`](https://docs.python.org/3/library/datetime.html#datetime.timezone "datetime.timezone") with the zone name and offset obtained from the OS.
slate swan
#

enter your timezone for the tz arg

maiden fable
#

just do datetime.now()

#

!d datetime.datetime.now

unkempt canyonBOT
#

classmethod datetime.now(tz=None)```
Return the current local date and time.

If optional argument *tz* is `None` or not specified, this is like [`today()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.today "datetime.datetime.today"), but, if possible, supplies more precision than can be gotten from going through a [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time") timestamp (for example, this may be possible on platforms supplying the C `gettimeofday()` function).

If *tz* is not `None`, it must be an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass, and the current date and time are converted to *tz*’s time zone.

This function is preferred over [`today()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.today "datetime.datetime.today") and [`utcnow()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow "datetime.datetime.utcnow").
slate swan
#

yea that too, but just to make sure it returns my timezone even when hosted on a vps from another location, i prefer using astimezone

iron sorrel
#

on_member_leave or on_member_remove

maiden fable
#

leave doesn't exists

iron sorrel
#

remove?

maiden fable
#

it does

iron sorrel
#

hehe

stiff gorge
#

how to add server icon in embed author ?

slate swan
unkempt canyonBOT
slate swan
#

and use the url property on it

#

sure why not

light violet
#

can i add buttons in my bot's custom rich presence?

slate swan
#

no

light violet
slate swan
light violet
#

!ping

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

slate swan
#

huh?

velvet tinsel
#

how would one find the arguments for a command? I kinda forgot lmao

#

dead chat

placid skiff
#

Wtf?

velvet tinsel
#

i agree

placid skiff
#

wdym find the arguments for a command?

velvet tinsel
#

like

@bot.command()
async def command(ctx, arg1):
  await ctx.send(arg1)

and it would say something like
command name: command, arguments: arg1

#

i think there's something like <> for required and [] for optional?

solemn igloo
velvet tinsel
velvet tinsel
#

i mean yeah

solemn igloo
#

oh its just !help

#

mostly

velvet tinsel
#

bruh

solemn igloo
#

for bots?

velvet tinsel
#

I'm coding my own help command

solemn igloo
#

if thats what ur talking about

placid skiff
#

uhm all commands are an instance of discord.ext.commands.Command class, if you check the doc you can get all those parameters
to get all the commands of your bot you can use discord.ext.commands.Bot.commands

velvet tinsel
#

after surfing the docs I found my answer, thanks a lot!

placid skiff
#

np

slate swan
#

i want to host my bot on heroku but this comes up;
I watched a youtube tutorial and it didnt help me

maiden fable
velvet tinsel
#

how to get that though lmao

dapper cobalt
light violet
#

is anybody selling discord verified bot dm me@molten umbra give space after if

cloud dawn
slate swan
#

Hey anyone want to help me build a simple discord bot. I have no experience. It is a small bot that orders something through an API

molten umbra
#

hi guys, uhm sorta new and i followed a guide on youtube. I dont understand the problem here can anyone explain it? Thanks a lot

#

File "main.py", line 15
await message.channel.send('sup')
^
SyntaxError: 'await' outside function
^(the error)

placid skiff
#

The problem is that it seems that you don't know python D_D

light violet
molten umbra
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

light violet
placid skiff
#

indentation in python is important

light violet
#

@molten umbragive space after if

slate swan
#

Which import for buttons?

#

how to install discord py 2.0?

light violet
#

yesh

light violet
slate swan
placid skiff
#

PEP8 suggests tabs (4 spaces) D_D

cloud dawn
slate swan
slate swan
cloud dawn
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.
light violet
#

yesh

cloud dawn
#

!d discord.ui.button

unkempt canyonBOT
#

discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") being pressed.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
slate swan
cloud dawn
placid skiff
#

you must have git installed

slate swan
#

thx

light violet
#

;

molten umbra
cloud dawn
light violet
#

ok

placid skiff
light violet
#

;aw;

#

q1)which is fast for deleting channels httpx,aiohttp or aiosonic

placid skiff
#

lol

boreal ravine
light violet
light violet
cloud dawn
#

!pypi aiosonic

unkempt canyonBOT
slate swan
#

Can someone help me make a small simple discord bot with only one function or ordering a service through a api

light violet
#

which service

slate swan
#

ill dm you

placid skiff
light violet
#

ok

cloud dawn
light violet
#

hmm

cloud dawn
#

Def not aiosonic since that doesn't get updated as often.

placid skiff
#

you studied aiosonic before give the answer? xD

boreal ravine
light violet
#

though aiosonic is 101%faster than other apis still aiohttp fafstest in calling apis fast one after another

light violet
boreal ravine
light violet
#

+_+

placid skiff
light violet
#

i have tried each of the 3 and aiohttp is most effective so i recommend to use aiohttp in ur antinuke bots

#

: )

slate swan
#

hey @light violet can you look at my dms

light violet
#

ok

slate swan
#

pls send dpy 2.0 docs

light violet
#

alsmost same with added features

#

idk the new docs

slate swan
#

you forgot the protocol😭

placid skiff
#

didn't know that discord don't recognize urls without protocol

slate swan
#

no it needs it lol

#

only with invites

placid skiff
slate swan
#

For someone like me who often types . instead of space

placid skiff
#

well you have to type a domain after the . to make it a link D_D

slate swan
velvet compass
placid skiff
#

He asked me to make a bot lel

sick birch
#

!rule 6

unkempt canyonBOT
#

6. Do not post unapproved advertising.

sick birch
#

That includes in the DMs of server members

placid skiff
#

I did not ts_bruh

slate swan
placid skiff
#

That requires some experience tho, start by reading documentation or watching some course

velvet compass
slate swan
#

Can I DM you?

#

this is a help channel tho?

velvet compass
#

No, I don't provide help through DMs. Please ask your question in one of the available help channels (See #❓|how-to-get-help ). The main reason is that by asking your question in public, everyone can contribute to the answer or benefit from it. Also, as we're a fairly large server (300k+ members), it prevents our staff from getting flooded with DM requests for help.

placid skiff
#

Yes but it's not like we can provide the entire code of a project D_D

#

We are here to help the others, not to develop their ideas

slate swan
#

Where can I find someone that could maybe develop it for free

#

I cant afford to pay someone

velvet compass
#

We can help you learn how to do it, but won't do it for you

slate swan
#

just ask here?

slate swan
#

nevermind though

velvet compass
#

Alrighty. If you want to learn how to do it, we will be here

slate swan
#

self is meant to be used only inside classes

slate swan
rapid knoll
#

Is this how you add reactions ? and what would go into the ()

await ctx.add_reaction()
slate swan
#

!d discord.ext.commands.Context.message

unkempt canyonBOT
#

The message that triggered the command being executed.

Note

In the case of an interaction based context, this message is “synthetic”
and does not actually exist. Therefore, the ID on it is invalid similar
to ephemeral messages.

slate swan
#

returns a Message object

#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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

Adds a reaction to 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")...
slate swan
slate swan
#

😭

#

apparently, pylance wont bother

#

best param naming award goes to you

dull terrace
#

potatoes

rain salmon
#

how i make embed msgs?

#

i never rly understood

#

olie cool pfp

dull terrace
#

embed = discord.Embed(title="a string", text="a string")

#

message.channel.send(embed=embed)

#

create the object and then send it, will vary depending on what library you're using etc.

#

thanks

rain salmon
#

also what do i do when it says intents unfilled?

dull terrace
#

you're getting that for sending an embed?

rain salmon
#

client = discord.Client()

rain salmon
dull terrace
#

oops

#

that was meant to be description=

rain salmon
#

ah yes fixed

dull terrace
#

there's the docs for embeds

rain salmon
#

thank you

timber kindle
#

I’m making a discord bot for my school final project and one of the requirements is a loop… I could be unoriginal and do a spam ping command but I want to be original. What type of command could I do that uses a loop

timber kindle
#

Any kind of loop

slate swan
#

use tasks loop then.

boreal ravine
paper sluice
#

self is only for when ur using classes

#

!d discord.ext.commands.Context

unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

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

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

Huh ext

#

probably

paper sluice
slate swan
#

Lol

#

😂

#
@bot.event
async def on_message_edit(message):
    with open("logchannel.json", "r") as f:
        cfg = json.load(f)
        logchannel = cfg[str(message.guild.id)]
        embed = discord.Embed(title="Mohameme Logs", description="Logs message", colour=discord.Colour.random())
        embed.set_footer(text="Mohameme bot")
        await message.guild.get_channel(logchannel).send(embed=embed)```
slate swan
#

Another one

unkempt canyonBOT
#

discord.on_message_edit(before, after)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") receives an update event. If the message is not found
in the internal message cache, then these events will not be called.
Messages might not be in cache if the message is too old
or the client is participating in high traffic guilds.

If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") parameter
or use the [`on_raw_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_edit "discord.on_raw_message_edit") event instead...
slate swan
#
@bot.event
async def on_message_edit(before: Message, after: Message):
  ...
#

ty

#

i thought it worked like other events like msg delete

hardy yoke
slate swan
#

he wants his bot to spam messages so a while loop is better

#

Nuke prob

#

Ayo

#

should delete this

frail notch
#

How can I make my bot do this for each message sent? ```py

q = str(ctx.message.content)
answer = requests.get({API}+{q})
print(answer['cnt'])```because ```py

@client.command()
async def on_message(ctx):
q = str(ctx.message.content)
answer = requests.get({API}+{q})
await ctx.send(answer['cnt'])

slate swan
#

do what?

#

and why are you making the content of the message a string?

frail notch
#

because i uesd to get an error

slate swan
#

the attribute returns a string

frail notch
#

ok

slate swan
#

!d discord.Message.content

unkempt canyonBOT
slate swan
#

and the error is probably an attribute error

#

because youre trying to do Message.message.content

#

its on message so it doesnt have context

#

and its message.channel.send

#

as message doesnt have such a method

#

OK

maiden fable
#

@slate swan u do know that u can combine all those messages in a single message, right?

boreal ravine
slate swan
frail notch
slate swan
frail notch
#

How can I make it so that every time a message get's sent in the server, the bot sends it to the API and sends the API response to the chat?

slate swan
#

should be a command

#

because if someone sends a simple hi the api is going to get a request

#

and if the api doesn't have a ratelimit thats fine but if it does thats kinda a problem and you should never spam an api or make unnecessary calls

#

use some kind of regex/logic to make sure when to make api calls

gaunt ice
#

guys

#

is there a way i can get about me of a user

slate swan
#

nope

gaunt ice
#

or can someone suggest this about me to be added in the api

slate swan
#

bots dont have access to the about me section

bleak flower
#
@client.event
async def on_raw_reaction_add(reaction):
    user_id = reaction.user_id
    await auto_lu_msg.edit(content=f"{auto_lu_msg.content}\n{discord.Guild.get_member(user_id)}")

Error:

-   File "G:\FreezeBot\gather.py", line 79, in on_raw_reaction_add
-     await auto_lu_msg_id_msg.edit(content=f"{auto_lu_msg_id_msg.content}\n{discord.Guild.get_member(user_id)}")
- TypeError: Guild.get_member() missing 1 required positional argument: 'user_id'

whats wrong with this 🤔

slate swan
#

should be using an instance of a guild

maiden fable
#

Yea, like reaction.guild

#

Heh

slate swan
#

reaction does not have an author/user

maiden fable
#

Ah I forgot it has users

slate swan
#

you can get a list of users though

#

hm

maiden fable
#

Nvm I just saw he has access to the id

kind mulch
#

how do I create a slash command?

quaint epoch
kind mulch
#

oh I was using @bot.commands

#

derp

quaint epoch
kind mulch
slate swan
kind mulch
#

I dont think so

slate swan
#

no.

kind mulch
#

lmao

sick birch
#

We use app commands

slate swan
#

oh yea, or hybrid_command for mixed ones

#

!d discord.Guild.owner

unkempt canyonBOT
sick birch
#

I guess not

kind mulch
#

sooo

sick birch
#

maybe I’m just bad

maiden fable
#

Python bot hates app commands

bitter perch
#

discord.app_commands.app_command

sick birch
#

I will self diagnose myself with skill issue

bitter perch
#

iirc

slate swan
#

!d discord.app_commands.command

unkempt canyonBOT
#

@discord.app_commands.command(*, name=..., description=...)```
Creates an application command from a regular function.
maiden fable
#

Ah

kind mulch
#

its a client.command thing no?

slate swan
#

app_commands is just a folder

bitter perch
#

the namespace*

maiden fable
#

Just like ext

sick birch
#

What about command tree? I think that was included

bitter perch
#

app_commands.CommandTree

sick birch
#

Ah yeah

slate swan
maiden fable
#

Yea

slate swan
#

i always called it a folder, cause it is what it is :/

maiden fable
#

Hahaha but in C# its like

namespace Name{}

Python just treats the folders as namespaces

kind mulch
#

app_commands.CommandTree? man Im new to this

sick birch
#

Yeah 2.0

maiden fable
#

Yea haha
There are a few examples in the repo u might wanna look at those

kind mulch
#

so theres no other way?

slate swan
#

nope~

kind mulch
#

oof

slate swan
#

if you use commands.Bot, a commandtree is automatically initalised ( from what i see in source )

sick birch
#

Why would you need len for that

slate swan
#

you know what len does right?

kind mulch
#

counts the lenght?

sick birch
#

Then it’s probably in your best interest to learn what it does before using it

#

Right, a guild can have one owner

kind mulch
#

so it counts 1 pithink

sick birch
#

Not like guild.owner can return an iterable anyway

sick birch
#

It’d count the letters in the name

kind mulch
#

oo

sick birch
#

Actually no I don’t think so

#

Since it’s a member object

#

Don’t know if discord.Member implements the len dunder

#

Yes

slate swan
#

you would have to iterate thru all bot.guilds and use the .owner property on them

slate swan
placid skiff
slate swan
#

why iterate through a list to return another list of the same elements

slate swan
kind mulch
#

oh btw how do you run a bot again after changing/updating the code?

sick birch
#

If you use extensions you can hot reload it

slate swan
sick birch
#

If not you’ll have to kill the script and run it again

sly hamlet
#

If I'm using 2.0 am I am I required to use / command instead of regular commands?

slate swan
#

or cogs, as robin said

slate swan
sick birch
kind mulch
#

I dont think I have an extension

sly hamlet
sick birch
#

That’s probably something wrong with your code

slate swan
sick birch
#

Do you have any error handlers?

sick birch
#

!intents is usually the culprit

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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.

placid skiff
unkempt canyonBOT
#

@placid skiff :white_check_mark: Your eval job has completed with return code 0.

abcd
placid skiff
#

i don't see where the problem is D_D

paper sluice
paper sluice
#

just ''.join(lst)

sick birch
placid skiff
slate swan
#

and i see no reason why the extra list comp if str.join accepts an iterable

#

so you still couldve use the generator without casting it to a list

#

but theres already a list so no point in that

sly hamlet
slate swan
sly hamlet
sly hamlet
#
intents = discord.Intents.default()
intents.members = True  # Subscribe to the privileged members intent.





bot = commands.Bot(command_prefix='.',
                   status=discord.Status.dnd,
                   intents=intents,
                   activity=discord.Game('beach-hosting.com'))```
slate swan
#

see if you error handlers are stopping your errors from raising

#

thats not message_content intent

#

!d discord.Intents.message_content

unkempt canyonBOT
#

Whether message content, attachments, embeds and components will be available in messages
which do not meet the following criteria:

• The message was sent by the client

• The message was sent in direct messages

• The message mentions the client...

sick birch
#

Make sure it’s also enabled on the dashboard

sly hamlet
#

So I need to do message_context=True

slate swan
#

message_content = True, yeah.

#

No

#

intents.message_content = True

#

Heh

boreal ravine
#

@sly hamlet What bot did you make? I'm curious

sly hamlet
#

It's a general custom Discord bot for my server

kind mulch
#

It worked this way

#

ignore the potatos

slate swan
#

interactions.CommandContext huh?

placid skiff
slate swan
kind mulch
#

yea

#

wait

slate swan
#

nice choice 👌

kind mulch
#

discord-py-interactions

heady sluice
#

weird

boreal ravine
sly hamlet
heady sluice
#

bought?

boreal ravine
#

Right..👌

boreal ravine
vocal plover
heady sluice
#

so this is a missunderstanding and his custom bot isn't verified

#

the public one is

boreal ravine
#

Bot's don't have CPUs, your host does

vocal plover
#

they probably mean cpu usage of the process on the host?

#

if so, check out the psutil package

boreal ravine
#

yeah you can use psutil

unkempt canyonBOT
#

@distant river, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.

distant river
#

Hi guys, I'm trying to send all of this images in one embed. Currently, I'm sending one message after one message. Does anyone has a solution to this? Here is my code:

@client.command()
async def multiple_charts(ctx, s1, e1):
    embed = discord.Embed(
        title=f"6 Charts from date {s1} to {e1}", color=0x00ff00
    )
    file = []
    for ticker in tickers:
        VisualizeData(ticker, s1, e1, "gamma", theme).graph_data(zero_gamma=True)
        file.append(discord.File(f"{ticker}.png"))
        embed.set_image(url=f"attachment://{ticker}.png")
    # spx = file[0]
    await ctx.send(embed=embed)
    await ctx.send(file=file[0])
    await ctx.send(file=file[1])
    await ctx.send(file=file[2])
    await ctx.send(file=file[3])
    await ctx.send(file=file[4])
    await ctx.send(file=file[5])
heady sluice
#

I do think send has a files kwarg

#

but you can only have one image per embed

distant river
#

aww

boreal ravine
distant river
heady sluice
#

webhook library? ignoring discord limitations?

distant river
heady sluice
#

right

distant river
heady sluice
#

and you can send multiple images with the files kwarg

boreal ravine
#

Install it -> import it -> use it ```py
import psutil
percent = psutil.cpu_count() # I can't remember if this is the correct method or not, but tias

slate swan
#

What explains my on_message_delete logs only responding for messages that got sent and deleted after launching the bot

sly hamlet
#
Ignoring exception in view <Counter timeout=180.0 children=1> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Close Ticket' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\culan\Desktop\beach hosting\beach hosting.py", line 641, in count
    channel_id = Interaction.channel.id
AttributeError: 'CachedSlotProperty' object has no attribute 'id'``` why do i get this?
slate swan
#

the heck is a cacheslotproperty

sly hamlet
#

idk

slate swan
#

what library are you using?

boreal ravine
sly hamlet
heady sluice
#

normally....

boreal ravine
#

Up to you, idk

sly hamlet
heady sluice
#

Nakime you have to start being more self-learning

boreal ravine
sly hamlet
#

I'm confused what I'm doing wrong

pine knot
boreal ravine
sly hamlet
#
@discord.ui.button(label='Close Ticket', style=discord.ButtonStyle.red)
    async def count(self, button: discord.ui.Button, interaction: discord.Interaction):
        em = discord.Embed(color=0x1014C1,
                            description=(f"This ticket will close in 10 seconds."))
        await interaction.response.send_message(embed=em)
        await asyncio.sleep(10)
        await interaction.channel.delete()
        with open("data.json") as f:
            data = json.load(f)
            ticket_number = int(data["ticket-counter"])
            channel = bot.get_channel(793569113708036106)
            color = discord.Color.red()
            em = discord.Embed(color=color, title="Ticket Closed ", description=(f"{interaction.user} closed a ticket\n **Ticket #**\n {ticket_number}"))
            await channel.send(embed=em)
            channel_id = Interaction.channel.id
            index = data["ticket-channel-ids"].index(channel_id)
            del data["ticket-channel-ids"][index]
            with open('data.json', 'w') as f:
                json.dump(data, f)    ```
heady sluice
#

you wrote Interaction not interaction

#

😭 😭

boreal ravine
#

☝️

heady sluice
#

I feel like I could make a verified bot

slate swan
#

@slate swan 😔 I apologize for the random ping but, is it ideal to create inside an extension (and where should I start it) or in the main bot file?

heady sluice
#

he'll never forgive u for that ping

slate swan
#

and im completely foine with pings

slate swan
heady sluice
#

you just ruined his job interview at google with that ping

slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
heady sluice
#

I'm an idiot

slate swan
#

lemon_happy yw

kind mulch
boreal ravine
kind mulch
#

this aint working for some reason

slate swan
kind mulch
#

any one know why?

boreal ravine
slate swan
boreal ravine
boreal ravine
heady sluice
#

😔

kind mulch
slate swan
heady sluice
#

meh me 😔

kind mulch
heady sluice
#

me, meh

kind mulch
#

u wanted to see error?

boreal ravine
slate swan
#

you have some unwanted character in the command name

slate swan
boreal ravine
#

also, shouldn't it be components and not Components

boreal ravine
slate swan
#

its commands.Bot

paper sluice
heady sluice
#

it's commands.Bot

sick birch
#

Oh my

boreal ravine
#

Which library are you using?

heady sluice
#

what

kind mulch
#

hmm

slate swan
kind mulch
boreal ravine
heady sluice
#

my confusion isn't braining

boreal ravine
visual yarrow
#

Hello 👋 Is it possible to split a command group across cogs? Or rather, if there is a command group in an existing cog, is it possible to add sub-commands in a separate cog (without modifying or monkey-patching the original cog)?

heady sluice
#

how about importing the group

#

or cog

#

or getting it through bot.get_cog

#

cuz then, sure, you only need the group instance to make a sub command for it

visual yarrow
kind mulch
#

???

heady sluice
paper sluice
# kind mulch

send doesn't have kwarg called Component read the error pithink

kind mulch
#

it says it does in the api reference

paper sluice
#

!d discord.ext.commands.Context.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.

This works similarly to [`send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for non-interaction contexts.

For interaction based contexts this does one of the following...
visual yarrow
slate swan
#

@boreal ravine @paper sluice comments?

kind mulch
slate swan
#

😭 whats a maybe i just made a command to prove that lmao

heady sluice
#

the cogs are stored in the bot (I think in the cache), from which get_ gets all its information from

spring verge
#

Any game recommendations like we have akinator pypi

paper sluice
slate swan
kind mulch
#

I did earlier

heady sluice
#

but might be

#

I'm gonna look

sick birch
#

It’s easier if you’re just using the method calls

heady sluice
#

!d discord.ext.commands.Bot.get_command

unkempt canyonBOT
#

get_command(name, /)```
Get a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") from the internal list
of commands.

This could also be used as a way to get aliases.

The name could be fully qualified (e.g. `'foo bar'`) will get
the subcommand `bar` of the group command `foo`. If a
subcommand is not found then `None` is returned just as usual...
heady sluice
#

it seems to

visual yarrow
# sick birch Using a decorator or?

Erm, so I was hoping if I define the same group in two cogs, with different sub-commands, then I load both cogs, that the sub-commands might be merged together somehow 😄 But that's probably wishful thinking.

heady sluice
#

I think one would be overwritten

slate swan
#

it should raise an error saying command already exists

heady sluice
#

oh

visual yarrow
#

Ah right ; - ;

heady sluice
#

I'm throwing

sick birch
#

But your question of multiple subcommands spread throughout cogs should be possible

kind mulch
#

button = interactions.Button(
style=interactions.ButtonStyle.PRIMARY,
label="hello world!",
custom_id="hello"
)

@bot.command(
name="button_test",
description="This is the first command I made!",
scope=GUILD,
)
async def button_test(ctx):
await ctx.send("testing", components=button)

@bot.component("hello")
async def button_response(ctx):
await ctx.send("You clicked the Button :O", ephemeral=True)

bot.start()

old temple
heady sluice
#

yeah bot.get_command().command()😔

#

how you access bot is weird tho

visual yarrow
sick birch
#

It’s not very plug and play

visual yarrow
old temple
#

hello? anyone

boreal ravine
visual yarrow
#

Thanks lemon_pleased

sick birch
old temple
#

how do I use an API?

#

am I stupid, I feel stupid rn

boreal ravine
snow scaffold
#

idek wht an API is ;-;

kind mulch
visual yarrow
sick birch
old temple
visual yarrow
sick birch
#

Interesting project

#

If it’s a HTTP API aiohttp will serve you well

old temple
#

I already got the bot user set up

#

and the basic login code

#

just not much else

visual yarrow
#

I'd break the problem down into two tasks:

  • Figure out how to communicate with the Mindstorms brick from a python program running on a computer.
  • Integrate it into a Discord bot.
    For the first task, you may get better help in #microcontrollers
boreal ravine
old temple
#

thx

#

although I need help with the first step

visual yarrow
slate swan
#

Hello I’m making a discord bot that gives role on your status what would be best way to go about it

slate swan
unkempt canyonBOT
#

@event```
A decorator that registers an event to listen to.

You can find more info about the events on the [documentation below](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events).

The events must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)"), if not, [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") is raised.

Example...
slate swan
#

There is an event, which is on_member_update (iirc)

vale wing
#

!d discord.ext.commands.Bot.listen better

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").

Example...
pine knot
#

yo, does anyone have any suggestions for what i should put as the playing status for my bot

pine knot
#

btw do you have a suggestion for the prefix? currently its a comma, i'm trying to be unique so it doesn't get mixed up w/ other bots

vale wing
#

Just make slash commands

pine knot
#

i did, im using both

vale wing
#

I would recommend } nobody uses it

slate swan
pine knot
#

does anyone use "#"

vale wing
#

Yes

slate swan
pine knot
vale wing
#

Just make prefix customisation why not

slate swan
vale wing
pine knot
vale wing
#

Man make a database

#

Obv it will reset

pine knot
#

yeah i will im just lazy ngl

slate swan
#

Use mongodb its really simple petrdl it looks like "json" doe

pine knot
#

ill just watch a tutorial for custom prefixes, i haven't made a command like that yet

pine knot
#

how do people grow discord bots to reach 100+ servers?

#

i feel like im wasting my time if the bot doesn't reach many servers

slate swan
#

Can someone develop a bot for me, there is only really 1 command I need for it, I have little to no experience or knowledge. Please DM me if you have some spare time to develop it with me

slate swan
slate swan
slate swan
pine knot
#

maybe small communities won't think too much?

slate swan
# pine knot maybe small communities won't think too much?

from what i have seen, people add random bots to like test or try them too, even if its a small bot ( i log some basic information like server name, id, owner and member counts ) for my bot
from the data i get it seems like people causally add new bots

pine knot
#

i started developing it yesterday lol, just used saved code from my other bot and i'm adding slash commands and all to it

slate swan
pine knot
#

also, should i check the administrator permission or manually add other permissions? (its a moderation bot that can ban, kick, mute, etc)

slate swan
#

best to keep the admin perms optional

pine knot
#

okay

slate swan
#

because its a permissions a bot never really needs

pine knot
#

but it still needs to be able to ban and all, its a mod bot

slate swan
#

there are kick and ban permissions

pine knot
#

ik

slate swan
#

you can ask for them :D

pine knot
#

ill remove manage server and the unnessacary ones then

slate swan
#

yea~

pine knot
slate swan
#

code?

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
#

you tried converting the response from the first wait_for to a channel..

slate swan
pine knot
#

do you have a suggestion for a unique feature

slate swan
#

kinda hard question

#

bots are kinda limited to unique features

#

like its rare to see unique features and if you make one it eventually gets popular and its not unique anymore

#

i kinda stopped making bots because of this reason it gets boring

heady sluice
#

everyone stops making bots after a time

#

unless you own one of the most popular ones

slate swan
# pine knot fr?

2 bots 1st one verified in a week with 130 servers 2nd bot in 3 days 250 servers

heady sluice
#

I don't even get it

#

what does that do

slate swan
pine knot
#

bruh why

slate swan
#

I couldn’t pay for hosting not time for updates ect

pine knot
#

just use uptimerobot, it's free

slate swan
#

Bro I wasn’t hosting on replit

pine knot
#

oh

slate swan
#

I hosted on a 25€ a month hosting package

#

So it would never go offline

heady sluice
#

do you think replit would handle a bot with 250 servers

slate swan
#

Fr 💀

heady sluice
#

repl is a ridiculous host

slate swan
#

@bot.event
async def on_member_update(before, after):

    if after.bot == True:
        return

    if before.activities == after.activities:
        return

    userHasActivity = False
    for activity in after.activities:
        if isinstance(activity, discord.CustomActivity):
            if str(activity) == "test" :
                userHasActivity = True
    if userHasActivity:
        await after.add_roles([974367821708550184])
    else:
      await after.remove_roles([974367821708550184])``` it wont give roles on status
slate swan
#

If your hosting a test bot it’s ok

slate swan
#

I’ve never used user event before

#

Fair enough 💀

heady sluice
#

members & presences intents?

slate swan
dull terrace
#

froggy_chill is my bot approved yet

heady sluice
#

no

slate swan
vocal plover
#

The best host is your own server, if you have one mmLol

pine knot
heady sluice
slate swan
dull terrace
pine knot
#

okay

slate swan
#

a free google cloud/aws tier would be enough too
provided that it needs a credit card and the free trial period is one year

dull terrace
heady sluice
#

the what

slate swan
#

yea

slate swan
#

I’ve heard of it

#

Didn’t know if was good tbh

#

anything's better than replit

dull terrace
#

cannot recommend enough, there's a reason why amazon is at the top when it comes to hosting

#

although i'd prefer more competition

vocal plover
#

because they dont pay their employees enough they can spend more money on your behalf on servers

dull terrace
#

please no truths like that

pine knot
#

is sparked host good? the prices are low as hell

slate swan
pine knot
#

k

slate swan
pine knot
slate swan
pine knot
#

k

slate swan
#
async def on_member_update(ctx):
  if ctx.author.activities == "test" :
                userHasActivity = True
  if userHasActivity:
      await after.add_roles([974367821708550184])
  else:
     await after.remove_roles([974367821708550184])
     ``` it doesn’t give role on status
heady sluice
#

yeah the activities list isn't gonna be equal to a string

#

and add_roles and remove_roles don't take lists

frozen patio
slate swan
heady sluice
#

I said it's not a good host as in it's not good to use it for a host

slate swan
#

not a good host
so its a host?

heady sluice
#

bro

olive osprey
#

lol

sage otter
#

Obviously replit = hosting service.

#

Have you seen YouTube. 👌

regal pulsar
exotic maple
#

what..

#

It worked on other cmds

potent spear
exotic maple
potent spear
#

first thing you'll notice: on_raw_reaction_add has a different argument than the one you named here

sick birch
exotic maple
#

waitt

#

i see what i did wrong, i should have made the await ctx.send in a variable and edited that

#

im stupid

sick birch
#

No prob, it happens

zealous jay
#

Why do I get this error?
discord.errors.Forbidden: 403 Forbidden (error code: 20012): You are not authorized to perform this action on this application

#

Im trying to implement slash commands on an old bot

#

That has regular commands

#

Im just trying to sync my commands

#
#DISCORD & ASYNCIO IMPORTS
import discord
from discord.ext import commands
import aiohttp

#OTHER IMPORTS
import os
from dotenv import load_dotenv

class client(commands.Bot):
    def __init__(self):
        super().__init__(
            command_prefix='.',
            intents = discord.Intents.default(),
            application_id = 772489968823828490)
        self.synced = False
    
    async def setup_hook(self) -> None:
        self.session = aiohttp.ClientSession()

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

        await cltree.sync(guild = discord.Object(id=770698123915165747))

    async def on_ready(self):
        await self.wait_until_ready()
        print(f"Logged in as {self.user}")
        if not self.synced:
            await cltree.sync(guild = discord.Object(id=770698123915165747))
            self.synced = True

aclient = client()
cltree = aclient.tree

load_dotenv()
aclient.run(os.getenv("TOKEN"))            
#

My code

#

It works just fine on another bot

potent spear
#

I wouldn't sync the commands in on_Ready

zealous jay
#

Why?

#

altough that's doesn't seem to be the problem here

potent spear
#

It's generally discouraged to do any API calls in on_ready, the docs discuss why
as to why your syncing isn't doing what you expect it to: I'm only using 1.7.3 features, I can't say

zealous jay
#

oh

#

thanks!

slate swan
#

Why does it not work?

olive osprey
unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

but what did i do wrong then? I have the intent enabled == Fixed it

lime trench
#

I’ve seen some commands that can execute psql Cmds, get what they ask for and send it, like getting everything in a table and it would send it to a channel. It’s like it’s running it in the terminal, getting the response then sending it to a channel, how could I create this?

zealous jay
slate swan
#
    @commands.Cog.listener()
    async def on_command(self, ctx):
        results = collection_cmd.find_one({"guild_id": ctx.guild.id})
        if results is None:
            pass
        elif results is not None and results["disabled"] is not None:
            for x in results["disabled"]:
                print(x)
                print(ctx.command)
                if str(x) == str(ctx.command):
                    break

hello im coding a disable command
im checking if a disabled command gets called in the on_command event it works but how can i prevent the command from getting sent, when i break or send a message it sends it after the command

zealous jay
#

Add this at the ending

#
await client.process_commands(ctx.message)
slate swan
#

so like after the for loop?

zealous jay
#

Yes

slate swan
#

aight

zealous jay
#

Outside it

slate swan
#

yeah

zealous jay
#

And let me know if it works

potent spear
zealous jay
#

wait, did I read that wrong

slate swan
zealous jay
slate swan
#

np

zealous jay
#

yeah my bad sorry

slate swan
potent spear
#

here you go

slate swan
#

but if i do it this way

#

its globally disabled

potent spear
slate swan
#

and not only in 1 server

#

completely

potent spear
#

this does ^... right?

slate swan
#

no it disables it from your whole bot

#

and not in one server

potent spear
#

ah, I just read yours wrong ig

slate swan
#

alr np

#

i need to just figure out how to prevent the command from sending

potent spear
slate swan
#

why an exception?

hollow edge
#

im trying to iterate over files in a folder to create one choice for each file

potent spear
hollow edge
#
def genchoices():
  returnlist = []
  for i in os.listdir('Niko_expressions'):
    returnlist.append(
      create_choice(
        name = (i.replace('png', '').replace('_', ' ')),
        value = i,
    ))
  return(returnlist)
#

this is what I have now, but it generates this error:

#
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 0.options.1.choices.0.name: Could not interpret "[{'value': 'niko_neutral.png', 'name': 'niko neutral.'}, {'value': 'niko_eyebrow.png', 'name': 'niko eyebrow.'}, {'value': 'niko_mouthclosed.png', 'name': 'niko mouthclosed.'}, {'value': 'niko_crying.png', 'name': 'niko crying.'}]" as string.
slate swan
# potent spear try and see

where should i add an exception i dont really understand why i should add an exception
this is my code again:

    @commands.Cog.listener()
    async def on_command(self, ctx):
        results = collection_cmd.find_one({"guild_id": ctx.guild.id})
        if results is None:
            pass
        elif results is not None and results["disabled"] is not None:
            for x in results["disabled"]:
                print(x)
                print(ctx.command)
                if str(x) == str(ctx.command):
                    break
potent spear
slate swan
#

why should it raise an error

hollow edge
potent spear
hollow edge
#

yeah, might be because the function was in brackets

potent spear
hollow edge
#

getting rate limited from testing, ill give results once im back on

slate swan
#

that isnt my problem tho

potent spear
#

I found a perfect solution my guy

#

you'll love it for sure

slate swan
#

yeah? tell me

potent spear
#

You'll want a global check

#

this gets checked before every command is invoked and can make it prevent it from running in servers or even specific users!

slate swan
#

ohh thanks

potent spear
#

you could even handle the CheckFailure that will raise in a global error handler which notifies the author that the command has been disabled 😉

slate swan
#

yeah

#

how would i pass the command?

#
@client.check
async def dis_cmd(ctx):
    results = collection_cmd.find_one({"guild_id": ctx.guild.id})
    if results is None:
            pass
    elif results is not None and results["disabled"] is not None:
        for x in results["disabled"]:
            print(x)
            print(ctx.command)
            if str(x) == str(ctx.command):
                break

so i currently have this but my commands wont respond my other
how can i pass the commands that arent disabled

potent spear
#

you're thinking about this the wrong way

#

have you seen the link?

#

it's like 2 lines, the whole check

#

you could do so too

weak acorn
#

Hi, I'd like to ask if this code is wrongly used in anyway possible to get a @user_mention?

What am I trying to do?

Mention users without coming up as invalid on mobile

slate swan
potent spear
#

that's literally all you need

slate swan
#

yeah i first need to get all the words from the list

#

becauuse i have a list

potent spear
#

then I'd fix your DB structure tbh

slate swan
#

what do you mean?

potent spear
# slate swan what do you mean?

when getting a guild ID, you're getting a list?
a simple SQL query I have in mind is just

SELECT IS_DISABLED FROM GUILDCONFIG WHERE GUILD_ID = ? AND COMMAND_NAME = ?), (guild.id, ctx.command.name,))```
#

which would simply return the exact value you need

slate swan
#

no im not getting a list

#

i didnt know what you defined

#

and im working with pymongo

potent spear
#

any reason why?

slate swan
#

because i find its better and easier

potent spear
#

so you've never used with relational databases, right?

slate swan
#

i know sql

potent spear
#

anyways, you should just get the is_disabled of a specific command in a guild returned in a good query

weak acorn
#

on desktop the bot shows mentions but on mobile the bot shows @invalid user

zealous jay
#

huh

slate swan
#

it happens on mobile sometimes when someone mentions many users the client hasnt cached yet

weak acorn
slate swan
#

no not at all

zealous jay
slate swan
#

your client does it by itself

weak acorn
slate swan
#

its not related to your bot?

#

its related to your mobile client

weak acorn
#

I mean user mention

slate swan
#

im so confused on your problem. it shows invalid user right but in your desktop client you can see the mention formatted correctly if so then yes your mobile client hasnt cached the user yet

weak acorn
#

My bot is only showing...

#

Other bots -- user mention works without any problems, while my bot is showing invalid user. But on desktop, it shows the user.

zealous jay
#

does this only happens for you?

weak acorn
zealous jay
#

huh

weak acorn
#

Anyone on mobile, get @invalid user

zealous jay
#

mention that user yourself

weak acorn
slate swan
zealous jay
#

its probably what okimii says

weak acorn
slate swan
#

its a common problem in mobile ive seen it myself

weak acorn
#

That's what I'm confused.

slate swan
#

its not mobile its the mobile discord client aka your discord app

weak acorn
#

Cause every single bot works but my own bot so I'm trying to find the error.

slate swan
#

its not your bot!

weak acorn
#

Wym by didnt cache the user?

sick birch
#

Most modern apps use some sort of cache. Discord probably didn't cache that user which is why it shows up that way

slate swan
#

since your client hasnt seen it or encountered the user it doesnt cache anything

slate swan
sick birch
#

Usually though it just shows up as <@432643355634171905>

slate swan
sick birch
#

Don't know what's up with that, discord is funky

slate swan
sick birch
weak acorn
#

So no way to "fix" ?

slate swan
#

no

#

watch andy prove me and robin wrong

weak acorn
#

That's what I don't get 9ACOSP_laugh

sick birch
slate swan
#

its discord what do you expect

weak acorn
slate swan
#

👁️👁️

sick birch
slate swan
#

desktop client != mobile client

sick birch
#

It's not like you can get show something differently if the person viewing your bot is on mobile or not

weak acorn
#

Yeah you right

pliant gulch
#

Mobile phones tend to handle apps in the background differently

#

But it’s not always 100% loaded

sick birch
#

Lazy loading? sort of at least?

pliant gulch
#

You should just restart your discord app and it’ll render

sick birch
#

I'm guessing that's probably the first thing they tried

pliant gulch
#

This is a negligible issue though, you can pretty much ignore it

sick birch
#

Well you don't have much choice but to ignore it

weak acorn
#

It's not only me that can't see it.

#

Other server members on mobile can't see it.

sick birch
#

Well, that's probably on discord's end then

pliant gulch
#

Why wouldn’t they? It’s just an issue on your side

#

Eventually it’ll fix the cache issue, restarting usually works but sometimes you’ll just have to wait

sick birch
#

Perhaps just a coincidence that a bunch of you all are getting the same caching issue

#

That or discord is goofed and it'll fix itself given due time

weak acorn
#

I'll try restarting

sick birch
#

Sure, just give it a bit

#

Mobile apps are just... ugh

weak acorn
sick birch
#

Well, probably a discord issue then. just give it a bit

weak acorn
sick birch
#

Yes, because then it'd show the same on both desktop and mobile

weak acorn
#

If you wanna mention users in your own way, how would you script it?

#

Does your bot mentions work? Do you do <@{user.id}> to mention?

slate swan
#

yes mentions are <@id>

weak acorn
lyric apex
#

Hey

slate swan
weak acorn
#

I cri

lyric apex
#

How can i make universal error command saying you dont have this perm to use this Etc Not Separate for all one for all

weak acorn
#

@slate swan ty for explaining

slate swan
unkempt canyonBOT
#

discord.ext.commands.on_command_error(ctx, error)```
An error handler that is called when an error is raised
inside a command either through user input error, check
failure, or an error in your own code.

A default one is provided ([`Bot.on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.on_command_error "discord.ext.commands.Bot.on_command_error")).
slate swan
lyric apex
#

I want that it says the perm that is missing @slate swan

slate swan
#

with isintance

hollow edge
#

does anyone know any free bot hosts?
I was using replit but I can't use always on since I don't have hacker plan

sick birch
#

replit is not a host

#

but many reputable cloud service providers have some sort of free tier

boreal ravine
boreal ravine
sick birch
#

Yes, but it's still free in the sense that they don't charge you anything

#

And most reputable providers will ask you for a CC even if they won't charge you

hollow edge
#

being ratelimited hasn't been too big a problem since I can switch ips whenever it's close / ratelimited

#

can you do the same with those?

boreal ravine
sick birch
#

Unfortunately

#

But your options are very limited then and you'll have to put up with sub par service

hollow edge
#

luckily this is an incredibly small bot

dusk girder
#

so i have a few emotes

#

called :bar_<size>_<amt>: for progress bars

#

but i cant get it to actually send them

#

first attempt it just sent this :bar_left_100::bar_mid_100::bar_right_25:

boreal ravine
dusk girder
#

wait hang on

#

nvm i got it

#

but it'd be cool if i could just use :name:

#

instead of <:name:id>

keen mural
#

for discord.ui buttons how do i make it so that if a button is pressed the message is edited with the thing i want

boreal ravine
unkempt canyonBOT
#

await edit_original_message(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the original interaction response message.

This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.

This method is also the only way to edit the original message if the message sent was ephemeral.
boreal ravine
#

@keen mural My bad, you're supposed to use Interaction.edit_message

keen mural
boreal ravine
keen mural
#

some github one

boreal ravine
keen mural
#
Ignoring exception in view <Game timeout=180.0 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Left' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\Desktop\Discord Bot\main.py", line 709, in Left
    await interaction.edit_message(embed=embedVar)
AttributeError: 'Interaction' object has no attribute 'edit_message'```
maiden fable
#

edit_original_message edits the message u sent with inter.send

boreal ravine
#

Mhm

boreal ravine
keen mural
boreal ravine
#

You have two instances of your bot running, cancel the other process/instance or reset your bots token and use the new one to fix it

keen mural
#

wdym

#

ok

west mango
#

Does anyone know where I can see a good example of a cog listener with multiple on_message events? I know how to get the cogs working, load them, etc. Im just having trouble determining best practice on how to organize them and conditionally execute in the main file. Like I get that I can put conditions into the cog's event, but Im just having trouble conceptualizing the best way to put it all together so that I can adapt a bot I've already built to a cog-based setup.

keen mural
keen mural
#

like
(message content)
Button 1 Button2
Button 3 Button 4

#

yeah my bad

boreal ravine
#

Oh, specify the row kwarg in the button decorator ```py
@button(..., row=0) # 0 = the default row/first row, 1 = the second row and so on

keen mural
#

thx again

slate swan
#

hi sift 👋

boreal ravine
boreal ravine
keen mural
#

and i would disable the button the same way?

slate swan
keen mural
#

disabled=True

boreal ravine
slate swan
boreal ravine
keen mural
slate swan
#

:D

slate swan
slate swan
slate swan
frozen patio
#

Hey sparky

slate swan
frozen patio
#

I am not here much nowadays 🥺

slate swan
#

yes :<

#

what are u working on

slate swan
supple thorn
#

Rust?

frozen patio
slate swan
#

hey skev

boreal ravine
slate swan
#

;-;

frozen patio
#

And it does love giving me errors

slate swan
slate swan
frozen patio
slate swan
#

lol

supple thorn
#

I ate noodles

frozen patio
#

I like what I name my workspaces as well

supple thorn
#

They were good

frozen patio
#

Ok

slate swan
#

veg only