#discord-bots

1 messages · Page 227 of 1

slate swan
#
bot = app_commands.Bot(intents=intents)
@bot.command(name="orders")
async def _orders(ctx: app_commands.Context):
  rest of the code  

Why when trying to make slash command like this. I have this error

    bot = app_commands.Bot(intents=intents)
          ^^^^^^^^^^^^^^^^
AttributeError: module 'discord.app_commands' has no attribute 'Bot'```
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

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

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
slate swan
#

not app_commands.Bot

shrewd apex
#

anyone which works

sick birch
#

Any of The Big Three will do

cold sonnet
#

raspberry pi 💪

burnt patrol
#

If anybody has some time i would apreciate if you take a look and help me.
Problem:
So i make a code for dropping some character images in a embed (this works perfectly fine) and i wanted to add a way to collect them so i made a way to collect them by adding a reaction and it will go to the inventory that is stored in a json file ( there where problems begun) so lets specify them.

  1. When i add a reaction under the embed bot does not send a message that is supposed to send.
  2. no character is added to collection nor the json file but the !collection command is working okay i think bcs since it respods with no characters collected yet it is okey.

i added some prints to help me find the issue but since i am a noob i just cant find a problem

termial print:
Reaction added!
reaction: 🎉
user: Valheru#8645
self.client.user: (bot name here) it is here but i just dont want to shere the name of it
message.author: (bot name here)
embeds: [<discord.embeds.Embed object at 0x000001531E9E2F80>]
embed: <discord.embeds.Embed object at 0x000001531E9E2F80>

https://paste.pythondiscord.com/ucuwuhanih - bot code
https://paste.pythondiscord.com/aqovejowix - the cog file code ( there is the feature so i supose the error cause is there)

jovial cape
#

Can I make only approved messages from my bot to be publicly visible?

#

Like

#

Message From Client -> Filter Bot -> Parsing Algorithm -> To Clients | Message falls and client gets a warning in the channel that the client sent the message but it's only visible to the cleint who sent that message

fading egret
#

anyone knows how to add the "check" that only specific persons can use a slash command?

@app_commands.command(name="createkey", description="Create a key!")
    async def createkey(self, interaction: discord.Interaction):
cold salmon
#

is there no cooldown decorator for slash commands in nextcord? I can only find

nextcord.ext.commands.cooldown

which only seems to work for non slash commands

hushed galleon
pliant bluff
#

When I try to run my discord bot commant this error happens. I don't know what's wrong.

hushed galleon
#

the middle of that error message is the important part, you need to follow the link there and enable whatever privileged intents you need (members, presences, or message_content)

fading egret
hushed galleon
fading egret
cold salmon
#
@commands.Cog.listener()
async def on_application_command_error(self, interaction: nextcord.Interaction, error):
    error = getattr(error, "original", error)
    # If the command is on cooldown
    if isinstance(error, CallableOnCooldown):
        emb = embed.errorEmbed(
                interaction, f"This command is on cooldown. Try again in: {round(error.retry_after, 2)}s!")
        await interaction.response.send_message(embed=emb, ephemeral=True)
    else:
        raise error

The error is handled and the embed is posted into the channel but the error is still annoyingly printed into the console, why is that?

tall temple
#

pls help me

#

could you help me about a new discord bot
i want to create a command taht adds a new role above every role with admin perms

from discord.ext import commands
import discord

activity = discord.Activity(type=discord.ActivityType.watching, name= "")
bot = commands.Bot(command_prefix = ">", intents = discord.Intents.all(), activity = activity)


@bot.slash_command(name="ez", description ="")
async def ez(ctx):
    user = ctx.message.author
    role = discord.utils.get(user.server.roles, name=":star:")
    await create_role(name= ":star:", permissions = Permissions.all() , display_icon= False , mentionable= False , position = 2 ) and client.add_roles(user, role)

bot.run("token")
naive briar
#

Oh yeah, I didn't read all of the message

tall temple
#

@naive briar are you able ?

cold salmon
#

yeah

robust fulcrum
#

Hi all, how can we detect an alt account in discord.py?

vale wing
robust fulcrum
vale wing
#

Alt detection typically works by mapping discord account to IP

#

Which is generally not ideal as VPN exists

#

There is not much you can do about alts

naive umbra
# robust fulcrum Any other way?

you could force members to verify through a custom verification website where you can store their IP address to check if a member is trying to verify with the same IP, but like exen said above; VPN exists :P

hushed galleon
unkempt canyonBOT
#

nextcord/client.py line 577

# TODO implement cog error handling```
cold salmon
hushed galleon
#

oh wait, the interaction doesnt give you a cog

tall temple
#

BRUH WHY TF ARE YOU DODGING MY HELP MESSAGE bruh

sick birch
tall temple
#

i just want help like the others

sick birch
tall temple
#

if anyone thinks that's a raid bot, i just want to retake my server bcz my main got hacked

sick birch
#

AWS, GCP, and Azure all have a free tier iirc

tall temple
#

@slate swan use ovh vps

vale wing
#

Hosting websites — no. VPS providers — yes goofysmile

tall temple
#

i can help you to setup it if you want

sick birch
#

Azure is pretty cool
But I mostly say that because Shennanigans manages all our devops on azure :P

idle palm
#

Hey i keep getting this error and ive tried loads of different things and its really annoying

Im trying to allow a user to mention many roles in the role arg.

sick birch
vale wing
#

Nice

sick birch
#

The devops at least is very good haha
Even if the code may not be

sick birch
idle palm
#

Sure

#
Traceback (most recent call last):
  File "C:\Users\ollie\PycharmProjects\robobotnew\main.py", line 572, in <module>
    async def bindrank(interaction: discord.Interaction, rank_id: str, role: List[Role], nickname:str = None):
  File "C:\Users\ollie\PycharmProjects\robobot\venv\lib\site-packages\discord\app_commands\tree.py", line 887, in decorator
    command = Command(
  File "C:\Users\ollie\PycharmProjects\robobot\venv\lib\site-packages\discord\app_commands\commands.py", line 665, in __init__
    self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__)
  File "C:\Users\ollie\PycharmProjects\robobot\venv\lib\site-packages\discord\app_commands\commands.py", line 373, in _extract_parameters_from_callback
    param = annotation_to_parameter(resolved, parameter)
  File "C:\Users\ollie\PycharmProjects\robobot\venv\lib\site-packages\discord\app_commands\transformers.py", line 834, in annotation_to_parameter
    (inner, default, validate_default) = get_supported_annotation(annotation)
  File "C:\Users\ollie\PycharmProjects\robobot\venv\lib\site-packages\discord\app_commands\transformers.py", line 793, in get_supported_annotation
    raise TypeError(f'unsupported type annotation {annotation!r}')
TypeError: unsupported type annotation typing.List[discord.role.Role]
Exception ignored in: <function CleanAsyncClient.__del__ at 0x0000018C7025F490>
Traceback (most recent call last):
  File "C:\Users\ollie\PycharmProjects\robobot\venv\lib\site-packages\roblox\utilities\requests.py", line 36, in __del__
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\events.py", line 739, in get_event_loop_policy
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\events.py", line 732, in _init_event_loop_policy
ImportError: sys.meta_path is None, Python is likely shutting down
#

@sick birch

sick birch
sick birch
#

Can you show us your code as well?

idle palm
#

Thats whats causing it

sick birch
#

You can do something similar in a select, however

slate swan
idle palm
sick birch
#

The select menu can be a role select type

idle palm
sick birch
#

You can't change that, yes

idle palm
#

is there any documentation for this list?

slate swan
#

!d discord.ui.RoleSelect

unkempt canyonBOT
#

class discord.ui.RoleSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, row=None)```
Represents a UI select menu with a list of predefined options with the current roles of the guild.

Please note that if you use this in a private message with a user, no roles will be displayed to the user.

New in version 2.1.
#

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.
cold salmon
hushed galleon
#

i guess you could define a cog_application_command_check that adds a key to the interaction.attached dict, then check for that key in the bot's cog_application_command_error to decide whether the error should be printed

cold salmon
#

hmm alright i'll try it out thank you

cold salmon
hushed galleon
#

i wouldnt recommend that, you'd hide any errors outside of your cog

cold salmon
#

oh ;-;

tulip frigate
#

how does this work?

naive briar
#

Timestamp format

glad cradle
tulip frigate
slate swan
#

hello, i have a command where it bans all users that joined newly, when there is e.g a raid and there are joining extremly many people the bot won't ban them anymore, could this be due to api ratelimit?

hybrid lark
#

Anyone know any website to host discord bots for free?

sullen shoal
sullen shoal
slate swan
sullen shoal
slate swan
hybrid lark
sullen shoal
slate swan
sullen shoal
sullen shoal
# slate swan the server

Can you show the code? This shouldn't be an API limitation if the implementation is well done.

slate swan
sullen shoal
sullen shoal
# slate swan right

what did your logs say during the raid? only banned X or no output at all?

slate swan
#

i just checked my logs and when just 1 or 2 members join it prints the first line

#

it seems that the bot isnt even recognizing that they joiend

sullen shoal
#

does your bot have a global error handler?

slate swan
#

uh no

#

what do you mean?

sullen shoal
#

was member joined X logged during the raid?

slate swan
#

no it wasnt

#

i have all intents enabled too

sullen shoal
#

is that the entire code under the event listener?

slate swan
#

no there is more

#

but its not relevant for the ban join

sullen shoal
#

that doesn't imply it can't interrupt this portion

#

also your i/o is blocking, so in cases of fast member joins, this method will get called multple times and block the code

slate swan
#

hmmm okay

#

under the join ban thing, there is a code that checks if the joined member is a bot

sullen shoal
#

and this code is under that condition?

slate swan
#

yeah

#

no, i mean the joinban is above the bot condition

sullen shoal
#

so your member join code only runs when the member is a bot?

#

is the code proprietary?

slate swan
#

im sorry, i dont understand what that means

sullen shoal
#

is the code not supposed to be shared more than five-four lines?

sullen shoal
#

the code under the listener

#

entire code

slate swan
#

wait ill give u the code

#

this is the entire code

sullen shoal
#

looks like the issue is with your practice of doing i/o on the same thread

slate swan
#

yeah i understand, so that means i need to remove one part of the code?

#

so the other part is alone

sullen shoal
#

I don't understand your use of "part" word

slate swan
#

by part i mean the code for the join ban or the bot check part

outer parcel
#

Hello im trying to make a modal but an error is appearing whenever i send the modal

sullen shoal
#

and you're doing this inefficient reading whenever a new member is joining

slate swan
#

i can rewrite it so it works with pymongo

sullen shoal
#

if you have time to spend, a better choice for discord bots can be RDBMS dbs

slate swan
#

i currently use it to develop for my global bot

sullen shoal
#

NoSQL databases can get messy and aren't as powerful as RDBMS ones for certain/most tasks you'll be facing with Discord bots

#

however it is fine if you want to use it

slate swan
#

hmm okay, when my bot gets bigger ill definitely think about switching

#

but for now it isnt even out

#

and for the single server bot its atleast better than json

sullen shoal
#

switching from NoSQL to SQL is worthless

slate swan
#

why?

sullen shoal
#

because you'd by then already be making inefficient workarounds and design choices for NoSQL databases that you'll have to ensure cannot be exploited or aren't too buggy with SQL ones

slate swan
#

yeah thats right

sullen shoal
#

either choose NoSQL or SQL, and keep it forever

slate swan
#

are the differences between these dbs dramatically or are they only slightly noticeable?

sullen shoal
#

NoSQL databases like Mongo and RDBMS databases like PSQL, can be dramatical as per your knowledge. For PSQL, you will have to fetch/execute SQL queries like SELECT * FROM guilds WHERE server_id = ? or SELECT COUNT(*) FROM tasks WHERE name = ?, and so on. However Mongo is similar to how Python dicts work

slate swan
#

okay thank you

#

and also by the open statement you mean the if member.bot right?

sullen shoal
#

no, with open(...) as f to be precise

slate swan
#

oh okay

#

i still changed the code to if member.bot else join ban code

#

but ill rewrite this so it works with pymongo

sullen shoal
#

is pymongo async tho?

slate swan
sullen shoal
slate swan
shrewd apex
#

pymongo is sync

shrewd apex
smoky sinew
slate swan
#

so atleast there are a few libraries that make pymongo async

#

like gevent

smoky sinew
#

or just use motor

slate swan
#

or that

surreal quail
#

hey guys, any tips on learning discord py properly? or any sources ?

smoky sinew
slate swan
#

hello i have the list with the mentions in a message, now if i loop through the list with 2 requirements: user id should be .. and guild id should be .., there is an error: TypeError: 'NoneType' object is not subscriptable
the list should originally have atleast 1 field, im sure i have something wrong in my code

            msg_mentions = message.mentions
            matching_entries = [member for member in msg_mentions if member.id == afk_check["user_id"] and member.guild.id == message.guild.id]
pale wraith
#

That's likely the afk_check["user_id"] in there

#

Wherever that's coming from, afk_check is None

slate swan
pale wraith
#

Not really possible to comment on this without seeing the rest of your code, but from the partial traceback you've provided, this is the only thing you're subscripting

slate swan
#

um yeah i think i found the error..

#

searched for the wrong document in my db

slate swan
#

Anyone know how to get the guild icon of a server?

unkempt canyonBOT
#
Nuh-uh.

No documentation found for the requested symbol.

slate swan
#

Nuh-uh

unkempt canyonBOT
smoky sinew
#

.url

slate swan
#

what does it return if the server has no avatar set?

smoky sinew
#

it's optional, so None

#

pretty sure the default guild icon is generated client-side anyways

slate swan
#

ctx.guild.banner.url exists, right?

#
banner = ctx.guild.banner
    if banner:
        # send banner.url
    else:
        # no banner set
naive briar
#

Read the docs, then you'd know

#

!d discord.Guild.banner

unkempt canyonBOT
naive briar
#

!d discord.Asset.url

unkempt canyonBOT
slate swan
#

Probably an obvious solution, but why is my command still raising a MissingRequiredArgument error despite having it's own error handler for that exact thing?

smoky sinew
#

can you show your error handler?

slate swan
# smoky sinew can you show your error handler?
@roleinfo.error
async def roleinfo_error(ctx: commands.Context, error) -> None:
    if isinstance(error, commands.MissingRequiredArgument):
        em = discord.Embed(
            description=f":warning: <@{ctx.author.id}>: Missing required argument `role`.",
            color=0x808080,
        )
        await ctx.send(embed=em)
    if isinstance(error, commands.RoleNotFound):
        em = discord.Embed(
            description=f":warning: <@{ctx.author.id}>: No role was found.",
            color=0x808080,
        )
        await ctx.send(embed=em)
    else:
        raise error
#

oh my

#

it's elif not if

maiden fable
#

Uh

#

Did you fix the error?

slate swan
#

Is it possible to get the ID of a user that does not share a server with the bot, solely having there username and discriminator?

#

@maiden fable

maiden fable
slate swan
#

I thought that fetches the user via ID not username and discrim?

#

!d discord.Client.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

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

Changed in version 2.0: `user_id` parameter is now positional-only.
maiden fable
#

Uh I don't think that's possible sorry

slate swan
#

Gotcha, I didn't think it was

sullen shoal
drifting arrow
#

is it possible to use a discord application and oauth2 to read what guilds a user is in and the members of that guild?

maiden fable
#

Yea, but it's outside the scope of discord bot making
You gotta use OAuth2

drifting arrow
#

Been trying but it doesnt seem to work ;-;

#

I think i'm doing something wrong lol

#

And I am well aware it's outside of the scope of discord bot making, however this is also a discord related channel 😄

#

Unless you can redirect me to a most specific channel

naive briar
vale wing
#

Idk how dead it is

#

But oauth2 is easy, examples on discord dev portal are even written in python

maiden fable
#

If I remember right, they tried renaming this channel to discord api right?

#

Or they renamed the channel to discord-bots

gilded ravine
#

Anyone have any idea why this type of code```py
@bot.event
async def on_command(ctx):
if config["maintenance_mode"] and ctx.author.id not in config["whitelisted_users"]:
await ctx.send("Sorry, the bot is currently in maintenance mode.")
raise commands.CommandError("Maintenance mode is enabled")

#

ive tried regenerating the token, doesnt work

naive briar
slate swan
#

does anyone know why i cant use .send with ctx in cogs

vocal snow
#

because your ctx variable is a hello object and not a commands.Context object as the error says

#

(you forgot the self parameter)

slate swan
#

before the ctx ?

vocal snow
#

!class

unkempt canyonBOT
#
Classes

Classes are used to create objects that have specific behavior.

Every object in python has a class, including lists, dictionaries and even numbers. Using a class to group code and data like this is the foundation of Object Oriented Programming. Classes allow you to expose a simple, consistent interface while hiding the more complicated details. This simplifies the rest of your program and makes it easier to separately maintain and debug each component.

Here is an example class:

class Foo:
    def __init__(self, somedata):
        self.my_attrib = somedata

    def show(self):
        print(self.my_attrib)

To use a class, you need to instantiate it. The following creates a new object named bar, with Foo as its class.

bar = Foo('data')
bar.show()

We can access any of Foo's methods via bar.my_method(), and access any of bars data via bar.my_attribute.

vocal snow
#

self is always the first parameter ^

vale wing
#

Unless it's a staticmethod nerddog

vocal snow
vale wing
#

Is that a horse with lightsaber

vocal snow
#

it does look like a horse but issa duck

slate swan
#

Is it possible to handle errors in cogs file ?

#
@commands.command()
    async def device(self, ctx, country: str, year: int):
        country = country.upper()
        file_paths = {}
        if not country:
            await ctx.send('Specifiy a country betwenn France/Germany/Finland/Canda/Australia/Brazil')
        elif not year:
            await ctx.send('Specify a year between 2012-2021')
        else:
            if (country, year) in file_paths:
                file_path = file_paths[(country, year)]
                await ctx.send(f"Most used device in {country} in {year} was:")
                await ctx.send(file=discord.File(file_path))
            else:
                await ctx.send(f"No data for {country}/{year}. Contact flyizz to add the data you're looking for")
#

my device command ⬆️

vocal snow
#

is your cog class also called device?

slate swan
#

yes

vocal snow
#

the error handler needs to be indented inside the class

slate swan
#

do i have to change

vocal snow
#

and please follow the python style guide

slate swan
vocal snow
#

classes should be named in PascalCase

vocal snow
#

!pep8

unkempt canyonBOT
#
PEP 8

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
PEP 8 document
Our PEP 8 song! :notes:

slate swan
#

so u advising me to change device into Device?

vocal snow
#

the class name, yes

abstract kindle
#

is it possible to edit source code and update it without restarting the bot?

vocal snow
#

yes, discord.py provides Extensions and Cogs which can be hot-reloaded

abstract kindle
#

But surely you don't put all of your code into cogs, right?

vocal snow
#

there's nothing wrong with it

abstract kindle
#

Do people actually do that though?

vocal snow
#

people usually split up their bot's functionality into separate extensions+cogs, yes

abstract kindle
#

Well yes, I understand that

#

I have almost every different section of commands / listeners in cogs

#

but I'm talking about the code that would not go into cogs

vocal snow
#

You could just make that an extension without a cog

#

or go the hard route and write your own hot-reload functionality

abstract kindle
#

But for example, with the discord bot for this server. There are many files that aren't in exts or cogs

#

If they were developing the bot, would they have to restart whenever they made changes to those files?

vocal snow
#

yes

#

with correct type-checking and linting setups you shouldn't ever have to restart that often anyways

abstract kindle
#

I guess so. I'm just not as experienced, so I find myself testing code after small changes, and it gets tedious restarting so often

vocal snow
#

makes sense

#

I'd recommend setting up a good LSP like pyright along with a good typechecker and linter like mypy

#

Depending on what IDE you're using that can be very simple or require a bit of configuration

whole shoal
#
selector_list=discord.ui.Select(
                    placeholder="Choose your action",
                    options={
                        discord.SelectOption(label="N/A", description="Do Nothing", default=True),
                        })
            for user in player_list:
                selector_list.add_option(label=f"Shoot {user[0].name}", description={user[0].nick})```
i got an error
` AttributeError: 'set' object has no attribute 'append'`
vocal snow
#

full traceback please

#

although it looks like options requires a list

#

and you're passing a set

whole shoal
#

Alr solved

#

Thanks

#

i tried passing the integration object as a parameter to another function and then use integration.followup in second function

#

But its converting the integration object to interaction type

vocal snow
#

what is integration

whole shoal
#

slash command

vocal snow
#

I'm not sure what you mean

whole shoal
#

Interaction*

vocal snow
#

Application Commands receive an Interaction object

whole shoal
#

I made a typo one sec

#

💀

#

Alr so

vivid axle
#

im making a discord bot to get a random post from a subreddit, does anyone know how i can make this
https://www.reddit.com/r/{subreddit}/random.json
not give a NSFW post ?

slate swan
#

can i host my bot in this?

vivid axle
#

maybe

slate swan
vivid axle
#

idk

slate swan
#

it cant

vivid axle
#

can it

#

but u can get it on sunday 16 april

vocal snow
#

How many servers is it going to be in

vivid axle
#

do commands

vocal snow
#

Are the commands going to do computationally intensive things

vivid axle
#

idk itsnot my bot

maiden fable
#

?

slate swan
#
    @commands.command()
    async def reddit(self, ctx, subreddit: str):
        try:
            subreddit = await self.reddit.subreddit(subreddit)
            post = await subreddit.random(timeout=5)
            if post.url.endswith(('.jpg', '.jpeg', '.png')):
                embed = discord.Embed(title=post.title)
                embed.set_image(url=post.url)
                await ctx.send(embed=embed)
            elif post.url.endswith(('.gif', '.gifv', '.mp4')):
                await ctx.send(post.url)
            else:
                await ctx.send(f"{post.title}\n{post.url}")
        except asyncpraw.exceptions.PRAWException as e:
            await ctx.send(f"An error occurred: {e}")
        except asyncpraw.exceptions.Redirect as e:
            await ctx.send(f"An error occurred: {e}")
        except asyncpraw.exceptions.APIException as e:
            await ctx.send(f"An error occurred: {e}")
        except asyncpraw.exceptions.ClientException as e:
            await ctx.send(f"An error occurred: {e}")
        except Exception as e:
            await ctx.send(f"An unknown error occurred: {e}")

anyone now why this isnt working. the bot is just ignoring my my command.

velvet compass
#

!ban 1076934063136448708 Implying you will DOX another user is entirely inappropriate behavior.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @feral lava permanently.

slate swan
#

Oh that's nice

#

thanks for taking care 👍

slate swan
#

hello, im currently doing a jail command, when wanting to jail or unjail the user it loops through all channels and creates overrides for the user, i am using asyncio to make this faster, however it is a bit too fast now. Will there be problems if multiple users call the same command

sullen shoal
vocal snow
#

Otherwise should be fine

#

Might want to check out the price of a Pi Zero

#

Although afaik raspi prices are pretty damn inflated rn

maiden fable
#

Just sign up for Astro Pi and u get a Rasp Pi free iirc

slate swan
sullen shoal
vocal snow
slate swan
#

but if channels are in no categories then itll be problematic

sullen shoal
#

You can cache these channels and handle the NotFound, HTTPException, and Forbidden errors respectively while looping through the cache

#

you then can handle the related events to append your cache

vivid axle
#

does making bot with class or not better?

sullen shoal
#

depends on the library you'd use

vivid axle
sullen shoal
#

then object orientation is far better

vivid axle
#

ok

#

whats the difference?

sullen shoal
#

"classes" by itself isn't too comprehensive in this context, so there is a probabillity that there is no difference at all; maybe elaborate more on that

vivid axle
#

ok

#

well thanks

vocal snow
#

Because discord.ext.commands.Bot is a class, so you will be using a class either way

vivid axle
#

idk if that right

vocal snow
#

Right, the first one is called subclassing

vivid axle
#

o

vocal snow
#

It's a part of Object Oriented programming called Inheritance

vivid axle
#

ok

vocal snow
#

As to whether you should use it or not depends on what you're trying to do; if you want to modify any of its methods then yes, you should

#

For a basic use case, you won't require it

vivid axle
#

ok

#

thank you zeffo

slate swan
#

https://paste.pythondiscord.com/kiwacuvuji

so i have this code which is meant to remove every overwrite for a certain user in all channels, now when i want to add a delay between looping through the channels or adding a delay when setting the permissions it "ignores" the delay and its still the same. And when i put asyncio.sleep... in the loop the bot stops for 2-3 seconds and then still is remoevs the permissions very fast

sullen shoal
whole shoal
#
class Prot_(discord.ui.Select):
    def __init__(self) ->None:
        super().__init__(
            max_values=1,
            placeholder="Choose your action",
            options=[
                discord.SelectOption(label="N/A", description="Do Nothing", default=True),
                discord.SelectOption(label="Protecc", description="Use Protecc")
            ]
        )

how do i pass a list to this class

sullen shoal
whole shoal
#

hm what

sullen shoal
#

?

slate swan
#

like in less than a second there are more than 20 channel overrides changed

slate swan
sullen shoal
#

rate limits are automatically handled by Discord.py. And nobody knows the rate-limit, so even if there is an one minute delay, it can cause rate limits

#

it is not constant when it happens and for whom, it is dynamic

slate swan
#

hmm okay, then ill leave it like that

vocal snow
#

Just set overwrites for a Role and add/remove it from the user

slate swan
maiden fable
#

What

drifting arrow
#

@slate swan what are you trying to achieve by removing perms and roles? Lol

#

Roles on discord are hierarchical. So usually the top lost role takes priority.

drifting arrow
#

Maybe I didn’t follow the convo well enough. On phone. Lemme re read lol

#

Oh. Okay. Wouldn’t it be better that instead of modifying many channels you just assign a role to a user

#

Say you want them to be unable to view all channels give them the timeout role

#

Or something

vocal snow
drifting arrow
#

Good role management is good lol

slate swan
slate swan
#

i mean it's not too too complicated but i'm just lazy

drifting arrow
#

No you’re making it too complicated lol

#

I help manage large servers and we have about a handful of roles that actually do anything at all. Mostly admin mod stuff the rest are cosmetic. The few roles that give you perms to certain areas you can easily remove and add back again using a few lines of code.

#

You shouldn’t need a database at all to manage these roles unless you are a crazy person and are constantly adding and removing roles

whole shoal
#

ypeError: Select.append_option() got an unexpected keyword argument 'label'

class No_prot_pot(discord.ui.Select):
    def __init__(self, users:list):
        super().__init__(
            max_values=1,
            placeholder="Choose your action",
            options=[
                discord.SelectOption(label="N/A", description="Do Nothing", default=True),
            ])
        for user in users:
            self.add_option(label=f"Shoot {user[0].name}", description={user[0].nick})```
naive briar
#

!d discord.ui.Select.append_option

unkempt canyonBOT
naive briar
#

You are supposed to pass a discord.SelectOption instance in it

drifting arrow
#

@slate swan depending on what it is you might be able to just update an entire category and have it sync instead. Again it really depends on what you are trying to achieve and why

slate swan
#

but you're right, i could really do that with the roles

#

im thinking to do this

drifting arrow
#

Json file or hard code

#

Basically the same thing lol

whole shoal
#

`Traceback (most recent call last):
File "C:\Users\V\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 851, in _do_call
return await self.callback(interaction, **params) # type: ignore
File "e:\spikey\spikey.py", line 609, in gungame
await gamestart(ctx,user_list,protecc,random_turn,potions)
File "e:\spikey\spikey.py", line 789, in gamestart
await ctx.followup.send(embed=embed102, view=selector_list)
File "C:\Users\V\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\async
.py", line 1698, in send
raise TypeError(f'expected view parameter to be of type View not {view.class!r}')
TypeError: expected view parameter to be of type View not <class 'main.Prot'>

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

Traceback (most recent call last):
File "C:\Users\V\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 1240, in _call
await command._invoke_with_namespace(interaction, namespace)
File "C:\Users\V\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 876, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
File "C:\Users\V\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 865, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'gungame' raised an exception: TypeError: expected view parameter to be of type View not <class 'main.Prot'>`

whole shoal
#

i accidently used append instead of add

slate swan
#

json too bad, the bot should be used for multiple servers and i already use a db so i don't think i'll use json

drifting arrow
#

Then you should consider mongodb

slate swan
#

im using mongodb

drifting arrow
#

Brilliant

whole shoal
#

anyone knows that

drifting arrow
naive briar
#

Decode what

whole shoal
#

:pain:

slate swan
whole shoal
#

TypeError: expected view parameter to be of type View not <class '__main__.Prot'>

maiden fable
whole shoal
#
class Prot(discord.ui.Select):
    def __init__(self, users:list):
        super().__init__(
            max_values=1,
            placeholder="Choose your action",
            options=[
                discord.SelectOption(label="N/A", description="Do Nothing", default=True),
                discord.SelectOption(label="Protecc", description="Use Protecc")
            ])
        for user in users:
            self.add_option(label=f"Shoot {user[0].name}", description={user[0].nick})
        

selector_list=Prot(player_list)
await ctx.followup.send(embed=embed102, view=selector_list)

#

last two lnes are in anohter func

vale wing
naive briar
#

!d discord.Webhook.send

unkempt canyonBOT
#
await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

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 "discord.File") object.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.11)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects to send.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.11)") instead of `InvalidArgument`.
naive briar
#

The view argument should be a discord.ui.View object

vale wing
naive briar
#

Who would have thought 🥱

vale wing
#

Joe

whole shoal
#

💀

#

then how do i take a list as arg

vale wing
#
view = discord.ui.View()
view.add_item(Prot(...))
await send(view=view)
whole shoal
#

didnt understand

#

do i need to create a view then add the select class to it?

maiden fable
vale wing
#

Ofc russia is not there

drifting arrow
#

Why the fuck we discussing this here?

vivid axle
#

lol

#

anyone know how to send a message as the only you can see this message thing on discordpy

#

😦

sick birch
unkempt canyonBOT
#

await send_message(content=None, *, embed=..., embeds=..., file=..., files=..., view=..., tts=False, ephemeral=False, allowed_mentions=..., suppress_embeds=False, silent=False, delete_after=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Responds to this interaction by sending a message.
vivid axle
#

thank

#

you

slate swan
tulip frigate
#

time = discord.utils.utcnow() + datetime.timedelta(seconds=10) discord.utils.format_dt(time , "R")
how does this return "4 mins ago"?

sullen shoal
#

just do int(time.time() + 10)?

tulip frigate
naive briar
#

Just format it yourself

#

!d discord.utils.utcnow

unkempt canyonBOT
#

discord.utils.utcnow()```
A helper function to return an aware UTC datetime representing the current time.

This should be preferred to [`datetime.datetime.utcnow()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow "(in Python v3.11)") since it is an aware datetime, compared to the naive datetime in the standard library.

New in version 2.0.
naive briar
#

Or that

tulip frigate
#

thats what i use

naive briar
#

🥴

tulip frigate
#

?

naive briar
#

My bad, I thought that was datetime.datetime.utcnow

sullen shoal
tulip frigate
#

but, how can you encrypt the 1618953630?

sullen shoal
#

encrypt?

#

it's a unix timestamp

tulip frigate
#

decipher i mean

#

ah

sullen shoal
#

Unix time is a date and time representation widely used in computing. It measures time by the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, the beginning of the Unix epoch, without adjustments made due to leap seconds.Unix time originated as the system time of Unix operating systems. It has come to be widely used in o...

tulip frigate
#

so its basically how many seconds from january first 1970

sullen shoal
#

yes

#

discord does the timezone stuff

tulip frigate
#

any python lib which does handle this?

sullen shoal
#

handle what?

tulip frigate
#

converting timestamps

sullen shoal
#

time.time() returns a float
!eval import time; print(time.time())

#

!eval import time; print(time.time())

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your 3.11 eval job has completed with return code 0.

1681402301.1570907
sullen shoal
#

this is the current epoch

#

just add 10

#

!eval

import time
e = int(time.time())
print(f"<t:{e + 10}>")```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your 3.11 eval job has completed with return code 0.

<t:1681402403>
tulip frigate
#

<t:1681402403>

#

ah okay

#

thank you very much @sullen shoal

sullen shoal
tulip frigate
#

thanks 👍🏼

austere crescent
#

Hi

#

I also want to cotribute

#

I have interest in AI and skills in Python

slate swan
#

I have a question, I want to send an embed message which exceed character limit even with add_field. So I have 2 options. The first one I know it is doable it's to add 2 reactions ➡️ ⬅️ and if the member clicks on arrow right it shows the second part of the embed and if it clicks right it shows the first part of the embed message. My second option was to create 2 embed inside the same command. One embed=discord.Embed() and a second one : embed2=discord.Embed() and then send both embed with await ctx.send(embed=embed, embed=embed2). What do you think about the 2 options

terse coyote
#

can i add localization to discord.ui.Modal title, ui.TextInput exc.? or get user's discord interface language?

slate swan
#

I don't think so

#

how can i make that this specific role can use this command?

#

!d discord.ext.commands.has_role

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")...
vivid axle
#

does the bot have to have admin and be above people to ban them

#

or ban_members

slate swan
#

it needs to be above them, and it needs ban_members (but Administrator also has ban_members ofc)

vivid axle
#

ok

slate swan
# unkempt canyon

allowed_role_id = [] # replace with the ID of the allowed role

@bot.event
async def on_ready():
print(f'Logged in as {bot.user} (ID: {bot.user.id})')

@bot.command(name='sendmessage')
@discord.ext.commands.has_role(allowed_role_id)

is this correct?

#

no

#

has_role only works with one role, not a sequence of roles

#

yeah im tryna make it one role

#

Then don't put it in a list

#

Also you should do some error handling

#

If the person doesn't have that role, it will raise an error

#

Which you should handle

thin raft
ivory cave
#

how can i reply to an interaction? for example if i type /repeat something 2 (repeat "something" 2 times) i want each one of those repeats of "something" to be a direct reply to the command initiating it

#

i am aware that i can just do

await interaction.response.send_message("yippee")
#

but i can only do that a single time

#

if i try to do the .response.send_message command twice it gives me an error "this interaction has already been replied to" or smth along those lines

#

my goal here is to respond to an interaction multiple times

naive briar
unkempt canyonBOT
ivory cave
#

i can do that but that doesnt specifically reply to the message

#

it just sends something in the channel

#

i want it to work like

ivory cave
naive briar
#

Reply to what message

#

And I know what replying is, thanks

ivory cave
#

the message that initiated the command :/

#

like, lets say i do some command /somecommand
i want the bot to reply to that "/somecommand" the user sent multiple times

naive briar
#

Then reply to the interaction's first response

#

!d discord.Interaction.original_response

unkempt canyonBOT
#

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

Fetches the original interaction response message associated with the interaction.

If the interaction response was a newly created message (i.e. through [`InteractionResponse.send_message()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionResponse.send_message "discord.InteractionResponse.send_message") or [`InteractionResponse.defer()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionResponse.defer "discord.InteractionResponse.defer"), where `thinking` is `True`) then this returns the message that was sent using that response. Otherwise, this returns the message that triggered the interaction (i.e. through a component).

Repeated calls to this will return a cached value.
ivory cave
#

how would i reply with that though ?

#

i dont get it ; ;

naive briar
#

!d discord.InteractionMessage - the original_response method returns this type as the response's message

unkempt canyonBOT
#

class discord.InteractionMessage```
Represents the original interaction response message.

This allows you to edit or delete the message associated with the interaction response. To retrieve this object see [`Interaction.original_response()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.original_response "discord.Interaction.original_response").

This inherits from [`discord.Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") with changes to [`edit()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") and [`delete()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.delete "discord.InteractionMessage.delete") to work.

New in version 2.0.
naive briar
#

!d discord.InteractionMessage.reply - then reply to it with this method

unkempt canyonBOT
#

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

A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message").

New in version 1.6.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.11)") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.11)") instead of `InvalidArgument`.
naive briar
#

Read the docs

slate swan
thin raft
#

you can make your own check

slate swan
#

I ain't looking for help bro

#

I wasn't the one who asked

thin raft
#

mb then

slate swan
#

is await edit_role_positions the only method to edit a role position? how come there is none when wanting to create a role

vocal snow
#

that method is for bulk editing the positions; you can use Role.edit for an individual role

coarse pebble
#

Hey guys, do you have an idea how to make a quiz bot which stores state of answers of a current user and current question? It calls state machine, i guess.
For example:
Bot: What's you name?
User: Müller
Bot: How old are you?
User: 19

vocal snow
#

and yeah it's weird that create_role doesn't have it, I suppose it's akin to manually making a role, where it's automatically put at the bottom

unkempt canyonBOT
#
No way, José.

No documentation found for the requested symbol.

stable siren
slate swan
smoky sinew
slate swan
smoky sinew
#

nevermind i see

hushed galleon
hushed galleon
#

oh i thought you meant "highest possible" as in literally the highest position, rather than the highest permissions will allow

tall temple
#

guys

#
@bot.slash_command(name="calculate", description="Calculates simple equations")
async def ping(ctx, first : discord.Option(float, "1st term", required = True),sign : discord.Option(str, "Addition / Substraction / Division / Multiplication", required = True), second : discord.Option(float, "2nd term", required = True)):
    if sign = multiplication or sign = Multiplication :
        return await ctx.respond(embed = discord.Embed(title = "", description = f"**{first}** × **{second}**  =  {first * second}", color = 0x000000))
#

i receive this error with this code :/

#

for ```py
if sign = multiplication or sign = Multiplication :

smoky sinew
#

it's == for comparison

tall temple
smoky sinew
#

read what it says

tall temple
smoky sinew
#

NameError: name 'multiplication' is not defined

#

you are trying to access a variable named multiplication and it doesn't exist

tall temple
#

how can i define it ?

#

ohh yeaah

#

i forgot the " my bad

#

yeah thanks

slate swan
#
   @welcome.command(name='test')
    @commands.cooldown(1, 3, commands.BucketType.user)
    async def test(self, interaction: discord.Interaction):
        await self.on_member_join(interaction.user)```
#

hey guys I got a problem, so I need it to be like** /welcome test user:**

#

but its not working for some reason interaction.user is supposed to play the role as ctx.author but thats not working out so far

#
   async def on_member_join(self, interaction: discord.Interaction, member: discord.Member):
        if not (find:=welcome_db.find_one({"_id": str(member.guild.id)})):
            return

        channel = interaction.channel_id(find['channel']) or await self.fetch_channel(find['channel'])
        message = welcome_formatter(find['message'], member)
        if channel:
            embed = discord.Embed(text="Welcome!", description=message, color=0x2A2D30)
            await interaction.response.send_message(embed=embed)```
#

please ping me when u solve!

slate swan
smoky sinew
#

where are you passing the interaction argument

vivid axle
#

im trying to make a bot that downloads a song from spotify and sends it as a video, i have got as far as downloading an mp3 of the song, anyone know how i can make a blank video with the song over it

smoky sinew
#

you can just get a black image and then overlay the audio using it

vivid axle
#

how to 😢

smoky sinew
#

do you have the ffmpeg executable installed? and is it in PATH?

#

do that first of all

vivid axle
#

yes

smoky sinew
vivid axle
#

im on mac btw

#

ok

#

i sent there

smoky sinew
#

or just look up how to combine image and audio into video using ffmpeg

vivid axle
#

ok thanks

slate swan
#

@cedar smelt do u know ab discord ui stuff? like adding buttons or select

slate swan
#

im adding btns but each time i do so i have to create a whole new class, i just wanted to see a example how it's done in short cut

smoky sinew
#

no

#

just use a decorator in your view class

#

!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/latest/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/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/latest/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
#

im using pycord, is it the same

smoky sinew
#

probably not

slate swan
#

it is, lol

#

for the buttons atleast, dunno what pycord did for select menus

smoky sinew
#

there are some slight differences

#

like how the item is passed before the interaction and modals are completely different

#

but i will never care about pycord

slate swan
vocal snow
#

pagination but with ui buttons instead of reactions

whole shoal
#

Does anyone have an example of a select drop down menu where you add items dynamically from an external list?

whole shoal
#

??

whole shoal
#

???

naive briar
#

Is being patient that hard? Just wait until someone answers

slate swan
#

should i use tasks.loop to check if a duration has passed, or is there a smarter way to check

vocal snow
#

You could also store and compare datetimes

slate swan
#

guys how to make

interaction give role?

slate swan
#

so e.g ill do tasks.loop and check every 10 seconds and compare the datetimes

#

but it would be kinda bad to always call the database every 10s

vocal snow
#

Why do you need to check every 10 seconds

slate swan
#

when then

#

i cant do it with asyncio.sleep or something because its not persistent after bot restarts

vocal snow
#

Just have a coroutine that sleeps till a mute expires and then unmutes the user

#

And run a bunch of those for every record in the db

vocal snow
vale wing
slate swan
#

guys how to make bot
interaction give role? using slash commands

tired kernel
#

heu guys can somone help me?

this is what i did this should make different variabiles to evrey server
will it work?

intents = discord.Intents.default()
intents.members = True
intents.message_content = True
intents.messages = True
bot = commands.Bot(command_prefix='?', intents=intents)
report_channel = server_vars['server1_id']['report_channel'] #1096070050814898286
Welcomgoodbyes_channel = server_vars['server1_id']['Welcomgoodbyes_channel'] #1079799925363187752
Human_Role = ['server1_id']['Human_Role'] #1079800896411668560

and this to add the server to the dictionary

@bot.event
async def on_guild_join(guild):
    server_vars[guild.id] = {'report_channel': '1096070050814898286', 'Human_Role': '1079800896411668560', 'Welcomgoodbyes_channel' : '1079799925363187752'}
vivid axle
#

This isn’t really a python question but how can I change the name of the bot’s role?

slate swan
hushed galleon
slate swan
#

guys how to make bot give roles using a slash commands?

slate swan
#

if u want an advice first do the command as normal (with prefix) and then change all u need to change to make a slash command

hushed galleon
#

speaking of paginators, i just uploaded the one that's part of my bot as a standalone package

#

@cloud dawn ^

#

its been like 6 months since i said i would do it

solar quail
#
import discord

intents = discord.Intents.default()
client = discord.Client(intents=intents)

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

@client.event
async def on_message(message):
    if message.content == 'hello':
        await message.channel.send('Hello world!')
#

when i say hello simply nothing happens

unkempt canyonBOT
#

examples/basic_bot.py lines 12 to 16

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

bot = commands.Bot(command_prefix='?', description=description, intents=intents)```
solar quail
#

im not sure which version this is i just installed the latest i think

#

im very new to python

#

i fixed it thank you!

#

i added intents.message_content = True and it errored, which showed me i forgot to enable intents on dev portal

#

not entirely sure which part fixed it, but it works now

hushed galleon
#

well if there's one place to learn discord.py its their documentation as most third-party resources have been outdated given how many times discord.py has gotten sweeping changes, barring a few guides

python has an official tutorial if you haven't gone through that https://docs.python.org/3/tutorial/index.html
but unlike dpy there's plenty of relevant materials from other sources, e.g. Corey Schafer

here's a list of things you should learn as you work with dpy, especially object oriented programming which you've already encountered using discord.Intents and discord.Client https://gist.github.com/scragly/095b5278a354d46e86f02d643fc3d64b

solar quail
#

thank you i appreciate the resources

#

ive been learning python for like a week and finally made the step up to packages like discord.py

tall temple
#

what's the slash commands options syntax pls ?

cloud dawn
#

Thanks for remembering

young dagger
#

What is going on with my bot?

0|blitzcra | [2023-04-13 19:43:40] [WARNING ] discord.gateway: Can't keep up, shard ID None websocket is 11.1s behind.
0|blitzcra | [2023-04-14 05:52:21] [WARNING ] discord.gateway: Can't keep up, shard ID None websocket is 37.9s behind.
0|blitzcra | [2023-04-14 05:53:02] [WARNING ] discord.gateway: Can't keep up, shard ID None websocket is 37.4s behind.
0|blitzcra | [2023-04-14 05:55:38] [WARNING ] discord.state: Somehow timed out waiting for chunks for guild ID 710232065718616104.```
meager chasm
#

Maybe you have some blocking code

young dagger
#

Thank you sir

#

Doubt it, but I will double check later

hushed galleon
#

if your cpu usage is high id look into that

young dagger
smoky sinew
#

!d discord.ext.tasks.loop if you're referring to this

unkempt canyonBOT
#

@discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
hushed galleon
#

the same way i showed you before

#

if you dont write any arguments in loop() nor set a time afterwards with .change_interval(), it runs as fast as possible instead

tall temple
#

EH

smoky sinew
#

message is an object so you can't get documentation for it directly

tall temple
#

shiiit

#

if i want to display the command author, what do i have to use ?

#

@smoky sinew

sick birch
unkempt canyonBOT
tall temple
sick birch
#

ctx.author.discriminator

#

Though str(ctx.author) returns both in the format of name#discrim

tall temple
#

lemme check :D

tall temple
sick birch
#

That is what you referred to by "tag", yes?

#

Or did I misunderstand you

tall temple
#

like me Medra#6937

sick birch
#

Ah, sorry
It's just {ctx.author} if it's inside an f-string

slate swan
tall temple
#

thank you so much mate 🫂

prisma prism
#

Hi guys!

#

I'm working on a discord bot

#

the code I am using is:

#
            print(message.reactions)
            if message.reactions == "✅" or message.reactions == "☑":
                print("3")
#

but it doesn't seem to work

#

the reactions print at the top just shows an empty list

#

and it doesn't print 3

#

this is the message

#

Please could someone help me?

young dagger
# hushed galleon if you dont write any arguments in loop() nor set a time afterwards with .change...

So this is not the correct way to do it?

class MyClient(commands.Bot):
    async def setup_hook(self):
        update_elo_ratings.start()
    async def on_ready(self):
        print('Bot is ready!')

@tasks.loop(hours=24 * 3)
async def update_elo_ratings():
    ... Code here

@update_elo_ratings.before_loop
async def before_update_elo_ratings():
    # Calculate the number of seconds until 4 AM on the next due date
    now = datetime.datetime.now()
    next_due_date = now.replace(hour=4, minute=0, second=0, microsecond=0)
    if next_due_date <= now:
        next_due_date += datetime.timedelta(hours=24)
    seconds_until_4am = (next_due_date - now).total_seconds()

    # Wait until 4 AM on the next due date
    await asyncio.sleep(seconds_until_4am)```
smoky sinew
unkempt canyonBOT
smoky sinew
#

look at what it is, it's a list of Reaction objects

#

you can't compare the list to a string

slate swan
#

mudkip

prisma prism
#

the list prints empty anyway though

hushed galleon
slate swan
#

any chance u know stuff about / commands

prisma prism
smoky sinew
#

do something like ```py
if "emoji" in [reaction.emoji for reaction in message.reactions]:

smoky sinew
prisma prism
#

yeah

smoky sinew
#

are you sure the message has a reaction by the time you're reading it

young dagger
prisma prism
hushed galleon
prisma prism
#

I added time.sleep for 10 seconds

#

just to test it

#

it didn't help

smoky sinew
young dagger
slate swan
smoky sinew
hushed galleon
prisma prism
smoky sinew
#

!intents

unkempt canyonBOT
#
Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

smoky sinew
#

if you're using Intents.default() it should already be enabled

hushed galleon
prisma prism
#
@bot.event
async def on_message(message):
    print("Message send")
    if message.guild.id == 989634034713907251:
        print("1")
        if message.author.id != 452151115316723725:
            time.sleep(10)
            print("2")
            print(message.reactions)
            if message.reactions == "✅" or message.reactions == "☑":
                print("3")
                text = message.content
                print(text)
                text = int(text) + 1
                list1 = str(text).split()
                for num in list1:
                    keyboard.press("num")
                    keyboard.release("num")
                keyboard.press("enter")
                keyboard.release("enter")

    else:
        print("4")
        pass
smoky sinew
#

time.sleep(10) abyss

prisma prism
#

just to see if it was slow in catching the reaction

hushed galleon
#

btw time.sleep() is blocking, i would suspect that prevented your bot from being able to receive the reaction event

slate swan
smoky sinew
slate swan
smoky sinew
#

!d discord.app_commands.CommandTree.sync

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.
smoky sinew
#

run this in a message command preferably

prisma prism
#

I tried it without sleep it didn't work

hushed galleon
#

have you used await asyncio.sleep()?

slate swan
#

what about the guild=none

#

is that just adding it to all of them that the bots in?

smoky sinew
smoky sinew
#

that's the default behavior though you don't have to include it

#

@prisma prism you're using != on the author id instead of == i'm guessing that's not what you want?

hushed galleon
prisma prism
hushed galleon
#

so have you tried asyncio.sleep or bot.wait_for?

prisma prism
#

oh I need that

#

sorry, I didn't see your before message

smoky sinew
#
@bot.event
async def on_message(message):
    def reaction_check(reaction, user):
        return reaction.message == message
    
    if message.guild.id in ALLOWED_GUILDS and message.author.id not in DISALLOWED_USERS:
        try:
            await bot.wait_for("reaction_add", check=reaction_check, timeout=60)
        except asyncio.TimeoutError:
            await message.reply("Timed out.")
        else:
            print(message.reactions)
    
    await bot.process_commands(message)

@prisma prism try this

prisma prism
#

ok will do

smoky sinew
#

updated it to use else

hushed galleon
#

btw reaction_check should be check, and that function should take (reaction, user)

smoky sinew
#

i see

prisma prism
#

I tried this code:

@bot.event
async def on_message(message):
    def reaction_check(reaction, user):
        return reaction.message == message

    if message.guild.id == "989634034713907251" and message.author.id != "452151115316723725":
        print("1")
        try:
            await bot.wait_for("reaction_add", check=reaction_check, timeout=60)
        except asyncio.TimeoutError:
            await message.reply("Timed out.")
        else:
            print(message.reactions)

    await bot.process_commands(message)

it didn't do anything

#

it didn't print 1 even

smoky sinew
#

because ids are not strings

#
ALLOWED_GUILDS = (989634034713907251,)
DISALLOWED_USERS = (452151115316723725,)
#

use this for ALLOWED_GUILDS and DISALLOWED_USERS

prisma prism
#

ahhh I see

smoky sinew
#

or just remove the quotes whichever one you prefer

prisma prism
#

thank you!

#

it printed this:

[<Reaction emoji=':ballot_box_with_check:' me=False count=1>]
#

do you know how I can do an if statement for this? to check the reaction?

slate swan
smoky sinew
#

what error?

#

that doesn't help really

smoky sinew
#

use this code, keep in mind that the emoji can either be a string if it's a unicode emoji, partialemoji, or emoji

prisma prism
#

Thank you!!!

slate swan
#
 File "main.py", line 21
    await sync(* , guild=None)
                 ^
SyntaxError: invalid syntax```
smoky sinew
#

actually @prisma prism maybe do this inside the check instead, then have your custom code run in the else part

smoky sinew
#
await bot.tree.sync()

this is more what you need

slate swan
#
Traceback (most recent call last):
  File "/home/runner/Bot/venv/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 21, in on_ready
    await bot.tree.sync()
NameError: name 'bot' is not defined```
smoky sinew
#

it's a variable name

#

if you're using commands.Bot you should name your bot bot, not tree

#

the bot tree would be bot.tree

slate swan
#
intents = Intents.default()
intents.message_content = True
tree = commands.Bot(command_prefix="b", intents=intents)


@tree.event
async def on_ready():
  print(f'Logged in as {tree.user} (ID: {tree.user.id})')
  await Bot.tree.sync()```
smoky sinew
#
api_url = f"https://discord.com/api/v8/applications/{client_id}/guilds/{guild_id}/commands"
  headers = {
    "Authorization": f"Bot {token}",
    "Content-Type": "application/json"
  }
  response = requests.post(api_url, headers=headers, json=slash_command)
  print(response.status_code)
  print(response.text)

also this does not make any sense

smoky sinew
slate swan
#

doigng await tree.tree.sync() didnt give an error

#

but the / command still doesnt show

smoky sinew
#

you are just misleading yourself

slate swan
#

ty mudkip

#

mudkip

#

the commands dont show

smoky sinew
#

?

#

did you run bsync @slate swan

slate swan
#

yeah

#

@smoky sinew

smoky sinew
#

invite me to your repl

#

nice everybody can see your token now

#

oh you changed it to remove @app_commands.command that's why it broke

slate swan
#

no

#

i didnt i copied the command and made a prefix version of the command

smoky sinew
#

see dms

tall temple
#

hey

#

i want to mean by ctx.server.id the server where the command will be executed

#

i know that this code is wrong, so could you help me to correct it :D

    ctx.server.id = {"PMName" : PMName , "info" : info , "fee" : fee}
    with open(f'users_data\{ctx.server.id}') as users_data :
        json.dump(ctx.server.id, users_data)
        return await ctx.respond(embed = discord.Embed(title = f"Nice", description = f"", color = 0x45b557))
#

@sick birch you will be my python coach pepe_heureux

smoky sinew
#

!d discord.ext.commands.Context.guild

unkempt canyonBOT
tall temple
#

oh ok

sick birch
tall temple
sick birch
#

You can't call a dict

tall temple
#

huh ?

sick birch
#

You call functions and classes, not dicts

tall temple
#

like that i mean

sick birch
#

You're creating a dict

#

But when you do ctx.server.id you're overwriting the guild ID

#

Create a new variable, call it my_dict or something more descriptive

tall temple
#

i want to attribute automatically the guild id as the dict name @sick birch

sick birch
#

You don't need to here

#
my_dict = {
  "PMName": PMName, 
  ...
}

json.dump(my_dict, ...)
tall temple
#

like

{#the id of the guild where the command is user} = {"PMName" : PMName , "info" : info , "fee" : fee}
sick birch
#

What happens if the guild has a space in it?

#

Python variables can't have spaces

tall temple
#

because, i want to find it after this

tall temple
sick birch
#

What's wrong with just giving it a name?

tall temple
#

it's just an explain example

tall temple
sick birch
#

Why not?

tall temple
#

to find it after this with another command

sick birch
#

Is the other command fetching it from the JSON?

tall temple
sick birch
#

So you want your JSON file to look something like this:

{
  "guild_id1": {
    "PMName": "pmname",
    "info": "info",
    "fee": "fee",
  }

  "guild_id2": {
    "PMName": "pmname",
    "info": "info",
    "fee": "fee",
  }
}

is that correct?

tall temple
sick birch
#

Yeah you'd just do my_json["guild_id1"]["info"]

tall temple
#

@sick birch explain more pls

sick birch
#

On?

tall temple
#

(i'm python new learner soo)

sick birch
#

Can you be more specific?

tall temple
#

i want to save the payment method name - payment method address - custom extra fee in a dict called as the guild id / user id

smoky sinew
#

🤨

tall temple
sick birch
#

You want to store financial banking information in... JSON?

tall temple
#

i just want to create a public bot for sellers to practice and let it be certified bot @sick birch

smoky sinew
#

you know what discord's verification rules are

tall temple
#

?

smoky sinew
#

it goes something like "if users would be surprised by the data you're collecting, you probably shouldn't do it"

tall temple
#

wym

smoky sinew
#

you should not store financial information in json

sick birch
#

I don't see any reason to be storing financial banking information TBH

#

Handle it via something like Stripe

tall temple
#

lemme explain to you

#

I want to create a bot who helps sellers to calculate orders total with the fees that they require and display their payment methods (that they 100% choose)

#

i don't steal infos or idk

sick birch
#

Probably should still be done via something like stripe

tall temple
#

they volontary set up the extra fees / payment methods etc

tall temple
smoky sinew
#

display what exactly

tall temple
#

the payment method info

smoky sinew
#

like credit card number?

tall temple
#

LIKE i want to display my ltc address with fees etc, i use the cmd /litecoin and it shows something like that :

tall temple
#

just like if i execute the cmd for paypal, it displays the paypal.me link

#

@smoky sinew @sick birch do you understand ?

smoky sinew
#

ok

tall temple
smoky sinew
#

why not use sqlite with aiosqlite

#

but you're assigning that to the id right now

#

you should be doing my_json[ctx.guild.id]["payment_method"] = ...

tall temple
smoky sinew
#

i recommend looking into aiosqlite

slate swan
tall temple
smoky sinew
#

it's a full SQL database accessed using a single file

tall temple
#

@smoky sinew like that ?

smoky sinew
#

like what

tall temple
smoky sinew
#

no

tall temple
#

hm ?

smoky sinew
#
import aiosqlite
# ...

class DatabaseBot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.database = None

    async def setup_hook(self):
        self.database = await aiosqlite.connect("database.db")
    
    async def close(self):
        if self.database:
            await self.database.commit()
            await self.database.close()
        
      await super().close()
#

an example of using aiosqlite

#

you should use bot.database.execute to execute any queries

tall temple
#

a

smoky sinew
tall temple
#

okay

smoky sinew
#

but it looks like my_json is not defined

#

consider using sqlite

tall temple
smoky sinew
#

it was just an example

tall temple
#

?

green cedar
#

guys what is better libs for developer bots in tibia

#

for localize image in game?

tall temple
#

how can define my_json hm ?

smoky sinew
green cedar
smoky sinew
#

i don't know what localize means

green cedar
#

find

smoky sinew
#

is this still a discord bot

#

i think you're in the wrong channel

green cedar
#

oh i think that here can talk about bots

#

in general

#

what knowledge is needed to build great systems?

#

the base

smoky sinew
green cedar
#

tks

weary gale
#

how would i go about listing the number of bots in an embed

#
@client.command(aliases=['si'])
async def serverinfo(ctx):
  roles=len(ctx.guild.roles)```
#

example as for how i did it with roles

naive briar
#

You'd probably have to use utils.find or generator comp to find them

#

!d discord.Guild.members from this

unkempt canyonBOT
tepid dagger
#

why do my slash commands always get "the application did not respond"

#

i tried all the stuff i could find like changing ctx.send() to ctx.reply etc but nothing happened

naive briar
#

Why do you have a context (ctx) in a slash command callback

#

Shouldn't it be a discord.Interaction object

tepid dagger
#

idk

#

whats the difference

smoky sinew
tepid dagger
#

oh ill figure it out later i think

smoky sinew
#

that's fine

shrewd thistle
#

Does any1 know how to make my discord bot create and new discord text channel IN A SPECIFIC CATEGORY and then changes the permissions that have access to it?

smoky sinew
#

!d discord.CategoryChannel.create_text_channel

unkempt canyonBOT
#

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

A shortcut method to [`Guild.create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") to create a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") in the category.
shrewd thistle
smoky sinew
#

A shortcut method to Guild.create_text_channel() to create a TextChannel in the category.
did you read this part

#

in the category

drifting arrow
#

Lessee. whats up in the ol' python discord..

static holly
#

hello, can i create a class in command?

vocal snow
#

why do you need to create it inside a command?

fierce karma
#

hello i can help u if u need it

#

cuz i am chatgpt

#

just ping me

slate swan
#

he doesnt know

tall temple
#

how to restrict a slash command only to owner (crown)

slate swan
#

write your own check

young dagger
#

Should I keep the on_ready part here?

class MyClient(commands.Bot):
    async def setup_hook(self):
        update_elo_ratings.start()
    async def on_ready(self):
        print('Bot is ready!')
whole shoal
#

how do i dynamically add users to selection list

class No_prot_pot(discord.ui.View):
    response1=None
    def __init__(self, users:list):
        super().__init__(timeout=10)

    @discord.ui.select(
        max_values=1,
        placeholder="Choose your action",
        options=[
                discord.SelectOption(label="N/A", description="Do Nothing", default=True),
                discord.SelectOption(label="Protecc", description="Use Protecc"),
                discord.SelectOption(label="Potion", description="Use a Random Potion")
            ])
    async def selected(self, interaction:discord.Interaction, selected:discord.ui.Select):
        self.response1=selected.values

that is code and
i wanna add

for user in users:
        self.add_option(label=f"Shoot {user[0].name}", description={user[0].nick})

but im not sure where should i add that

slate swan
#

list comprehension

whole shoal
#

?

slate swan
#

options=[discord.SelectOption(label=item, description=item) for item in mylist]

vale wing
tall temple
#

guys, could you help to correct this code ?

#
  ctx.server.id = ctx.server.id
    with open(f'users_data\{ctx.server.id}.json', "w") as users_data :
        json.dump(test, users_data)```
slate swan
unkempt canyonBOT
#

@discord.app_commands.check(predicate)```
A decorator that adds a check to an application command.

These checks should be predicates that take in a single parameter taking a [`Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction"). If the check returns a `False`-like value then during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CheckFailure "discord.app_commands.CheckFailure") exception is raised and sent to the appropriate error handlers.

These checks can be either a coroutine or not.

Examples

Creating a basic check to see if the command invoker is you...
tall temple
#

hm ?

slate swan
#

there is an example when you go to the docs

tall temple
#

oh ok

tall temple
static holly
# vocal snow what do you mean by that?

because i have a random.choice in my class, and if i place the class before the command, the rondom.choice only executes 1 time when the bot is started and not every time the command is executed

tall temple
#

how can i create a check to see if the executor of a slash command is the crown holder

vocal snow
#

Why don't you just make it a method?

#

Or use a property

tall temple
#

rah we le francaisss

static holly
tall temple
#

"poisson" " poids" "nom"

static holly
#

yes, and?

tall temple
#

wsh calme toi c juste un constat wtf

static holly
#

ha t'es français aussi, je comprennais pas ^^

#

sorry ^^

tall temple
#

pas de soucis

#

@static holly sinon, t'es bien calé en python ?

static holly
static holly
tall temple
static holly
#

okay! mee too

tall temple
#

🫂

whole shoal
tall temple
#

how can i appoint my file as the guild id ?

tall temple
dim cosmos
slate swan
hushed galleon
#

how far should one go with the usage of cogs/extensions? ive had the idea of putting shared data classes in them, e.g. simple classes or sqlalchemy models, but my concern there is potential memory leaks/inconsistent code from having multiple versions of the same file running at once
cross-cog usage in general feels a bit too icky to me given the unusual and implicit caveats

smoky sinew
#

why not just create a separate file for it and import it?

hushed galleon
#

attempting to have the benefit of hot-reloading

smoky sinew
#

won't it re-import if you reload the extension?

hushed galleon
#

sure, but that doesnt automatically refresh all references to the old module

smoky sinew
#

can you have special behavior to clean the old module up when the cog or extension is being unloaded

hushed galleon
#

the only way to do that is to get rid of all references, but in practicality that demands very restrictive code practices - no persistent variables pointing to the cog, no collections containing objects defined by the old module, always using a function/property to access those classes, etc.

#

well i assume this is what you have to deal with, and is what i tried handling in one of my now-dead pet projects, but im curious if it can be more cleanly handled

#

i guess the answer id give to my question now is "only use extensions for code that isn't depended upon by other modules"

fading egret
#
self.message = await interaction.response.send_message(view=self)
await self.message.edit(embed=self.create_embed("data"), view=self)

is it different to edit an message in slash commands?
i tried to make it like in normals but it just throws the error that the message is none..

discord.app_commands.errors.CommandInvokeError: Command 'list' raised an exception: AttributeError: 'NoneType' object has no attribute 'edit'

zealous jay
#

Hi

#

Is there a way to have an hyperlink on an embed without it having to start with https/http?

#

because if I use https://eco://connect/etc it deletes the : between eco: and //connect when it opens that tab on the browser

hushed galleon
zealous jay
#

I think followup responses do return a message

hushed galleon
#

mhm

fiery salmon
#

Hi, how could I make my bot do something at 00:00 and 12:00?
I am trying to give users $ interest at those times, but I don't want to have it just sleep() in case bot needs restart or server goes down.

hushed galleon
zealous jay
#

yeah but I wanted to avoid having a long url