#discord-bots

1 messages · Page 166 of 1

cloud dawn
#

damn

ivory shadow
#

it says “Please enter a redirect uri”

cloud dawn
#

Well you needed to go to URL generator not General

ivory shadow
#

yeah i’m in the url generator

cloud dawn
#

Eh?

#

Ss?

ivory shadow
#

oh nevermind

#

it somehow got fixed after reloading

#

which scopes should i select

fading marlin
#

bot & applications.commands

ivory shadow
#

awesome ty

#

i'm on 2.0.0 so why is this appearing?

fading marlin
#

apparently you're not

#

don't use replit either

ivory shadow
ivory shadow
fading marlin
#

it's never too late

ivory shadow
#

but i'm used to it now

fading marlin
#

you should update it, and you don't realistically need to use the repo url, stable version is on 2.0.1

python3 -m pip install -U discord.py
ivory shadow
#

alright that fixed it but now i'm hit with this error again 😭

fading marlin
#

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

ivory shadow
#

i have this in my code, or is that i need privelged intents

fading marlin
#

you're not passing any intents to the abot class

ivory shadow
#

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

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

class abot(discord.Client):
  def _init_(self):
    super()._init_(intents=discord.Intents.default)
    self.synced = False

    async def on_ready(self):
      await tree.synced(guild=discord.Object(id=________))
      self.synced = True
      print("Bot is Online")
      

bot = abot()
tree = app_commands.CommandTree(bot)
fading marlin
#

Intents.default**()**. It's called sync, not synced, don't sync in on ready. Why are you instantiating multiple bots?

ivory shadow
#

oh my gosh I didn't even realize I had two things on the top, also i'll fix the intents thing now

#

so is it something more like:


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

class abot(discord.Client):
  def _init_(self):
    super()._init_(intents=discord.Intents.default())
    self.sync = False

    async def on_ready(self):
      await tree.sync(guild=discord.Object(id=1057792247556493343))
      self.sync = True
      print("Bot is Online")
ember nest
#

How can do check permissions for discord.Member

fading marlin
fading marlin
naive briar
unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
slate swan
#
await ctx.get_channel(1057816634036850739.send(embed=embed))```
#

How can I send a embed in a certain channel?

#

I've tried this way but idk

naive briar
#

No

#

Syntax error

#

And why are you calling get channel from ctx

slate swan
#

get_channel is a method of a Guild object, not ctx

primal token
#

It's also a method of Bot

#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
slate swan
#

Oh yeah :P

glossy edge
#

Can webhooks be used to listen to messages?

elfin glen
#

Sniping basically pulls up the last deleted message and who said it. Here is my code. ```
client.sniped_messages = {}
@client.event
async def on_message_delete(message):
if message.attachments:
client.sniped_messages[message.guild.id] = (message.content, message.author, message.channel.name, message.created_at, message.attachments[0].proxy_url)
else:
client.sniped_messages[message.guild.id] = (message.content, message.author, message.channel.name, message.created_at)

@client.command()
async def snipe(ctx):
try:
is_img = None
try:
content, author, channel, created_at, img_url = client.sniped_messages[ctx.guild.id]
is_img = True
except:
content, author, channel, created_at = client.sniped_messages[ctx.guild.id]
if author.id != client.user.id:
embed = discord.Embed(description=content, color=discord.Color.teal(), timestamp=created_at)
if is_img:
embed.set_image(url=img_url)
embed.set_author(name=f"{author.name}", icon_url=author.avatar.url)
embed.set_footer(text=f"#{channel}")
await ctx.send(embed=embed)
except KeyError:
await ctx.send("Nothing to snipe.")This works perfectly fine, except for the fact that if the most recently deleted message was like four days ago, it would still pull that message up. I want it to say "Nothing to Snipe" after about 5ish minutes or so of the message being deleted. A time frame would simply reaffirm that it snipes *recently* deleted messages. I know I have to usepy
await asyncio.sleep(300)``` I am not sure how, or where to add this in the code. I have been trying for awhile now. Could someone help out?

vocal snow
#

!d discord.Message.created_at

unkempt canyonBOT
slate swan
#

why do i keep getting the error requirements already satisfied

naive briar
#

That's not an error

shrewd fjord
#

Wassup guyz

shrewd fjord
vague zephyr
slate swan
#

Hello, anyone know how i can add text freely in an embed using interactions.py ?

kindred epoch
#

Huh

slate swan
vague zephyr
#

the whole point to add a field is to put a title AND a value

slate swan
vague zephyr
#

tu peux faire \n

#

dans le string

slate swan
vague zephyr
#
embed = discord.Embed(
      title="lol",
      description="amongus\n\nok\n\nA"
)
await Interaction.response.send_message(embed=embed)
```?
vague zephyr
slate swan
#

🔁⚠ cogs

Traceback (most recent call last):
  File "/home/runner/Sputnik-src-1/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 934, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/runner/Sputnik-src-1/cogs/__init__.py", line 22, in <module>
    from .commands.ignore import ignore
  File "/home/runner/Sputnik-src-1/cogs/commands/ignore.py", line 1
    @commands.group(name="ignore", help="let's you to ignore me a channel ", aliases=["igc"])
    ^
IndentationError: unexpected indent

#

Can anyone help me pls

vague zephyr
#

read the error

slate swan
vague zephyr
#

yes

#

and? can you not fix it?

slate swan
#

Nah i can't

#

🥺 it took me 1hr to try

kindred epoch
#

So that means you need to learn python ig

vague zephyr
#

and fix the indentation

#

you prob put a space or something

vague zephyr
slate swan
vague zephyr
#

because some IDEs put tabs some others put spaces

vague zephyr
slate swan
#

Shall i paste the code here ?

vague zephyr
#

ok

#

put it in code format

slate swan
vague zephyr
#

nvm

slate swan
vague zephyr
#

there's no problem with it?

slate swan
vague zephyr
#

yes

#

restart your bot or reload the cog

shrewd apex
#

when people look at async code with json and say no problem joe_salute

slate swan
naive briar
#

JSON isn't asynchronous

shrewd apex
#

also wdym there is no problem

naive briar
#

So it's blocking when you're loading the file

vague zephyr
#

you have some spaces before the @commands....

#

remove them

naive briar
#

Also it's not a db ducky_regal

slate swan
shrewd apex
slate swan
shrewd apex
slate swan
shrewd apex
#

sure

calm jacinth
#

cna someone tell me how can I get hypixel api key ?

#

I need it for my bot ;-;

slate swan
#

@shrewd apex

naive briar
#

I just said show full code

#

But it looks like that line isn't in a class

slate swan
ember nest
#

So I have an auto delete message and mute if someone sends a link on my bot but I want it to just return (or don't delete/mute) if the message.author has (attach files permission) how can I do that?

naive briar
#

Since it's in the 1st line of the file for some odd reason

slate swan
#

🥺

naive briar
unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
naive briar
#

!d discord.Permissions.attach_files

unkempt canyonBOT
slate swan
naive briar
vague zephyr
#

where are you gonna put the class

#

if it's on line 1

ember nest
#

@naive briar should be like that?

user = msg.author
if user.guild_permissions.attach_files:
    return

?

naive briar
#

user.guild_permissions.attach_files

ember nest
#

Oh it's property

naive briar
#

Or attribute, whatever

ember nest
#

@naive briar should be like that?

user = msg.author
if user.guild_permissions.attach_files:
    return

?

slate swan
#

@naive briar help me pls

ember nest
#

Sorry for pinging again lol

ember nest
#

Lemme see

slate swan
#

🥺

shrewd apex
ember nest
# naive briar Try it 🤷
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "<string>", line 80, in on_message
AttributeError: 'ClientUser' object has no attribute 'guild'```
#

I got that error

unkempt canyonBOT
slate swan
shrewd apex
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

naive briar
#

Not related to that code

#

Show the on_message event

#

!d discord.ClientUser

unkempt canyonBOT
#

class discord.ClientUser```
Represents your Discord user.

x == y Checks if two users are equal.

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

hash(x) Return the user’s hash.

str(x) Returns the user’s name with discriminator.
shrewd apex
#

bruh where is the cog class the imports etc?

#

if this is your current code indentation should be the last thing you need to worry about

ember nest
#

@naive briar

2022-12-29 11:37:19 ERROR    discord.client Ignoring exception in on_message
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "<string>", line 92, in on_message
AttributeError: 'property' object has no attribute 'attach_files'
tawdry grail
#

i just got rate-limited

vague zephyr
#

rip

ember nest
ember nest
#

Already tried

naive briar
#

Can you stop pinging me in every message

vague zephyr
#

@naive briar hello

ember nest
naive briar
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

naive briar
#

Show its code

ember nest
#
if discord.Member.guild_permissions.attach_files:
            return
naive briar
#

You need an instance

ember nest
#

Like?

naive briar
#

Say that you're joking

ember nest
#

Not the user thing

#

Should I make it user?

naive briar
#

Then do it

ember nest
#

Lemme try

#
AttributeError: 'ClientUser' object has no attribute 'guild'
naive briar
#

That is your bot's message that was sent

ember nest
#
@bot.event
async def on_message(message):
    user = message.author
    if user.guild_permissions.attach_files:
        return
naive briar
#

And?

ember nest
#

It doesn't show any error but message not delete as well

#

Iike all commands under that now working

ember nest
naive briar
#

Because it is returned, nothing will be executed after that statement

#

!d return

unkempt canyonBOT
#

7.6. The return statement


return_stmt ::=  "return" [expression_list]
``` [`return`](https://docs.python.org/3/reference/simple_stmts.html#return) may only occur syntactically nested in a function definition, not within a nested class definition.

If an expression list is present, it is evaluated, else `None` is substituted.

[`return`](https://docs.python.org/3/reference/simple_stmts.html#return) leaves the current function call with the expression list (or `None`) as return value...
ember nest
#

But like

#
@bot.event
async def on_message(message):
    user = message.author
    if user.guild_permissions.attach_files:
        return
    else:
        await message.delete()
#

This message.delete() not working

naive briar
#

Because the message author has attach files permission

ember nest
#

It's not

naive briar
#

Print it

ember nest
#

print what exactly

naive briar
#

If it's false the message will be deleted

ember nest
#

print(user.guild_permissions.attach_files)

#

?

naive briar
#

Then do it, why do you have to ask

ember nest
#

As u can see I can't send the file down left

naive briar
#

And?

ember nest
#

The message not deleted

naive briar
#

What does it print

ember nest
#

Lemme try

#

print it out of the if statement right?

#

It keeps print True but the other members don't have the permission

naive briar
#

It prints true because they do have it

#

!d discord.Member.guild_permissions

unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
ember nest
naive briar
#

For 100% accurate permission calculation, please use abc.GuildChannel.permissions_for

#

!d discord.TextChannel.permissions_for

unkempt canyonBOT
#

permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role").

This function takes into consideration the following cases...
patent lodge
#

having a hard time trying to figure out how to make the bot NOT wait for a message response as im only editing original response with embed and view

    async def callback(self, view):
        self.label = f"{self.label} ({self.buttoncount + 1})"
        self.style = discord.ButtonStyle.green
        for button in self.vview.children:
            button.disabled = True
        embed = discord.Embed(
            title=f"❓{self.question} \n\n `📢 Total votes: {self.totalcount + 1}`",
            colour=0x00B0F4,
            timestamp=self.currdatetime,
        )
        embed.set_author(name=f"Poll created by {self.interaction.user.name}")
        embed.set_footer(text="Created")
        await self.interaction.edit_original_response(embed=embed, view=self.vview)

i cannot use defer here as i understand? how can i stop the bot from awaiting a message response (so i dont get that annoying This interaction failed)

ember nest
naive briar
#

Guild permissions are the permissions they have in general

ember nest
#

Oh

naive briar
#

Not including channel specific permissions

ember nest
#
discord.Member.discord.TextChannel.permissions_for(attach_files)
#

Like that?

#

Or without member?

#

I think without lol

slate swan
#

Why Wrong already install the package

naive briar
#

There's an example in channel's pins

slate swan
ember nest
naive briar
#

Search for what

slate swan
#

oh ok

ember nest
#

I think it takes member and role

#
if discord.TextChannel.permissions_for(user, "attach_files"):
            return

And gives error

2022-12-29 12:10:15 ERROR    discord.client Ignoring exception in on_message
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "<string>", line 92, in on_message
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/channel.py", line 229, in permissions_for
    base = super().permissions_for(obj)
TypeError: super(type, obj): obj must be an instance or subtype of type
upbeat gust
naive briar
#

I'm so done

ember nest
upbeat gust
#

How

ember nest
#

I don't understand the mean of instance

#

What does instance mean?

upbeat gust
#

I highly recommend learning python, specifically oop, before dpy

ember nest
#

I learn python well bro but in Arabic

#

English isn't my first language

upbeat gust
#

well ok then I'm not wasting my time teaching basic python

ember nest
#

Bruh whatever bye

slate swan
#

how do i add a timeout to this view

#

@upbeat gust

glad cradle
calm jacinth
#
import aiohttp

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

HYPIXEL_API_KEY = 'api_key_here'

async def get_player_data(player_name):
    async with aiohttp.ClientSession() as session:
        async with session.get(f'https://api.hypixel.net/skyblock/profile?key={HYPIXEL_API_KEY}&profile={player_name}') as resp:
            player_data = await resp.json()
            return player_data

@client.event
async def on_message(message):
    if not message.content.startswith('/'):
        return
    
    command, *args = message.content.split()
    
    if command == '/skyblock':
        player_name = ' '.join(args)
        player_data = await get_player_data(player_name)
        
        if 'success' not in player_data:
            await message.channel.send('An error occurred while trying to retrieve player data.')
            return
        
        player_stats = player_data['profile']['members'][player_name]
        
        embed = discord.Embed(title=f'{player_name} Skyblock Stats', color=discord.Color.blue())
        embed.add_field(name='Coins', value=player_stats['coins'])
        embed.add_field(name='Average Skill', value=player_stats['skillAverage'])
        embed.add_field(name='Active Memberships', value=player_stats['memberships'])
        
        await message.channel.send(embed=embed)

client.run('token')

can someone tell me what am i doing wrong here ?
it shows error everytime
and if i remove Client.run('token')
it doesnt work

#

:C

patent lodge
#
    async def callback(self, view):
        self.label = f"{self.label} ({self.buttoncount + 1})"
        self.style = discord.ButtonStyle.green
        for button in self.vview.children:
            button.disabled = True
        embed = discord.Embed(
            title=f"❓{self.question} \n\n `📢 Total votes: {self.totalcount + 1}`",
            colour=0x00B0F4,
            timestamp=self.currdatetime,
        )
        embed.set_author(name=f"Poll created by {self.interaction.user.name}")
        embed.set_footer(text="Created")
        await self.interaction.edit_original_response(embed=embed, view=self.vview)
        await self.interaction.followup.send("Thanks for voting!")

why do i still get the This interaction failed? :S

calm jacinth
white citrus
#
async def get_admin_role(guild_id):

    async with aiosqlite.connect("maja.db") as db:

        async with db.cursor() as cursor:

            await cursor.execute("SELECT admin_role FROM setup WHERE guild_id = ?", (guild_id,))

            role = await cursor.fetchone()

            return role[0]

        

async def get_moderator_role(guild_id):

    async with aiosqlite.connect("maja.db") as db:

        async with db.cursor() as cursor:

            await cursor.execute("SELECT moderator_role FROM setup WHERE guild_id = ?", (guild_id,))

            role = await cursor.fetchone()

            return role[0]

            

        

def user_has_administrator_or_moderator_role():

    async def extended_check(inter: nc.Interaction):

        admin_role_id = await get_admin_role(inter.guild.id)

        moderator_role_id = await get_moderator_role(inter.guild.id)


        error_output = nc.Embed(

            title="",

            description="",

            colour=c.red

        )


        # Check if user has either the administrator or moderator role

        if inter.user.get_role(admin_role_id) or inter.user.get_role(moderator_role_id):

            return True


        # If no roles are defined, send the error message

        if (admin_role_id or moderator_role_id) is None:

            await inter.response.send_message(embed=error_output, ephemeral=True)

            return False


        # If the user does not have either role, send the error message

        cancel_error_png_a = nc.File("pictures\\cancel_and_error_maja.png", filename="cancel_and_error_maja.png")

        error_perms = nc.Embed(title="Lack of permission", description=f"", colour=c.red)

        error_perms.set_thumbnail(url="attachment://cancel_and_error_maja.png")

        await inter.response.send_message(embed=error_perms, file=cancel_error_png_a, ephemeral=True)                            

        return False


    return application_checks.check(extended_check)

#
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 489, in _run_event
    await coro(*args, **kwargs)
  File "c:\Discord\Maja Projekt\MajaSystem_Test\bot.py", line 174, in on_application_command_error
    raise error
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 870, in invoke_callback_with_hooks
    can_run = await self.can_run(interaction)
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 839, in can_run
    check_result = await maybe_coroutine(check, interaction)  # type: ignore
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\utils.py", line 544, in maybe_coroutine
    return await value
  File "c:\Discord\Maja Projekt\MajaSystem_Test\modules\setup_v2\command_check.py", line 96, in extended_check
    if inter.user.get_role(admin_role_id) or inter.user.get_role(moderator_role_id):
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\member.py", line 1008, in get_role
    return self.guild.get_role(role_id) if self._roles.has(role_id) else None
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\utils.py", line 664, in has
    i = bisect_left(self, element)
TypeError: '<' not supported between instances of 'int' and 'NoneType'
naive briar
#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

calm jacinth
#

@naive briar help mee?

naive briar
#

Read the error

calm jacinth
#

I tried [] but same issue ;c

naive briar
#

!e

dictionary = {"cat": "meow", "dog": "bark"}
print(dictionary["cat"])
unkempt canyonBOT
#

@naive briar :white_check_mark: Your 3.11 eval job has completed with return code 0.

meow
sullen kelp
#

Hi, is anyone for hire?

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

slate swan
#

nvm

slate swan
white citrus
#

command_check.py

        if admin_role_id is not None:
            if moderator_role_id is not None:
                if inter.user.get_role(admin_role_id): 
                    return True
                elif inter.user.get_role(moderator_role_id):
                    return True
                else:
                    raise command_check__missing_permission ```


command_error.py
```py
class command_check__missing_permission:
    pass```

How can I send the error message now
upbeat otter
upbeat otter
#

hm...cool

#

then

#

you can just send a message using inter.response.send_message like you normally would

white citrus
upbeat otter
#

is that a decorator?

white citrus
#

Yeah

quick gust
#

why not use has_permissions or has_role

sharp pawn
#

i want someone to to run a discord python code that i just generated from the ai, anyone?

white citrus
shrewd apex
naive briar
#

Outdated

white citrus
sharp pawn
patent lodge
#
        userlist = []
        result = userlist.count(interaction.user.id)
        if result > 0:
            print("User was already in the list")
            return
        else:
            userlist.append(interaction.user.id)
            print("User was added to the list")
            print(userlist)

i always get User was added to the list everytime :S why?

potent light
#

How do we pass multiple discord.Attachement as an argument within a slash command?
async def report(self, interaction: discord.Interaction, user: discord.Member, proof: discord.Attachments): but the user can input many images in proof?

upbeat otter
maiden fable
#

just use

if interaction.user.id in userlist:
    . . .
#

And yea, since the list is inside the function, a new empty list is being generated everytime the function runs, thus always the else is trigerred

patent lodge
#

yea! i just noticed that one myself, happens alot! 😛

maiden fable
#

Indeed

patent lodge
#

anyway i need to scrap the idea anyway -.- erh

#

it does not work for what i have in mind

maiden fable
#

maybe someone here can help

patent lodge
# maiden fable maybe someone here can help

im creating a poll command where i create a poll embed with the question and then a button for each arg sep by comma so
./poll "what is the point of this" "i dont know", "that is a good question", "duuuh"

this would give 3 buttons that the user can press, but i wanna make sure that the user can only vote/press 1 button out of the 3

this is the button callback in the subclass i made

    async def callback(self, interaction: discord.Interaction):
        self.label = f"{self.label} ({self.buttoncount + 1})"
        self.style = discord.ButtonStyle.green
        embed = discord.Embed(
            title=f"❓{self.question} \n\n `📢 Total votes: {self.totalcount + 1}`",
            colour=0x00B0F4,
            timestamp=self.currdatetime,
        )
        embed.set_author(name=f"Poll created by {interaction.user.name}")
        embed.set_footer(text="Created")
        await interaction.response.edit_message(embed=embed, view=self.vview)
maiden fable
#

First of all, it would be better for you to use a Modal to get the button text
And second, just make a dictionary variable when yr bot starts up, make it a botvar where the key is the poll id (which will be unique and created whenever the poll create command is ran), and the value will be a list of dicts with keys as the button texts and values with a list of user IDs who have boted for that option. Then, just append to the list and get the number of vote simply by doing len(self.bot.giveaways[id][button_text])

patent lodge
#

giveaway what now? 😅

maiden fable
#

poll* sorry

#

Uh lemme edit my message

#

Yea sorry I was doing some other work and didn't realize I wrote stuff about a giveaway command lol

upbeat otter
maiden fable
#

¯_(ツ)_/¯

potent light
maiden fable
shrewd apex
potent light
upbeat otter
shrewd apex
maiden fable
#

I think u need to typehint it to list[discord.Attachment] or smth but I ain't much familiar with slash commands

potent light
upbeat otter
#

do what Hunie Bunnie says

shrewd apex
potent light
maiden fable
#

then try only discord.Attachment

potent light
carmine crane
#

hey there i'm running into this issue:

AttributeError: module 'discord.ui' has no attribute 'ButtonStyle' ```
maiden fable
#

And isn't it like the type of option is decided by using the deco instead of the typehints in slash commands?

shrewd apex
#

nope list[] or any iterable typehints dont work as of now due to api limitation

#

its given even in the docs

upbeat otter
maiden fable
#

Oh hm

#

My bad

shrewd apex
unkempt canyonBOT
maiden fable
#

Oh hm, its a class in the main lib

shrewd apex
#

replace blurple with red

upbeat otter
shrewd apex
#

hunnie would know ofc he is just low-key

maiden fable
#

Uh don't start that here lol

carmine crane
maiden fable
#

Anyways from tomorrow I won't hear anything except that from anyone irl so

shrewd apex
carmine crane
#

i mean not the color itself

shrewd apex
#

imagine being called that in front of classmates

carmine crane
maiden fable
#

"that"

upbeat otter
maiden fable
shrewd apex
unkempt canyonBOT
potent light
shrewd apex
shrewd apex
maiden fable
#

Discord + IRL Friends = Disaster
not that I have any irl friends but eh, I have tried combining the two and ahem

carmine crane
maiden fable
#

Where tf are the docs for slash commands argument types smh

upbeat otter
maiden fable
maiden fable
upbeat otter
upbeat otter
maiden fable
shrewd apex
#

wait sending one by one

maiden fable
#

ISTG Discord Docs are confusing

carmine crane
upbeat otter
maiden fable
#

Who says I am even coding nowadays

upbeat otter
#

How am I supposed to know

carmine crane
maiden fable
#

Don't start

potent light
maiden fable
carmine crane
#

wait i'm fucking dumb 💀

shrewd apex
potent light
maiden fable
#

Can u point me to the page where it shows all the types slash commands suppose as args?

carmine crane
quick gust
maiden fable
# quick gust 💀

istg some people are the total opposite
Lmao many would be offended by the "Yes" but I totally love those people who take it lightly (like the person here)

shrewd apex
carmine crane
#

it's discord.ButtonStyleand not discord.ui.ButtonStyle

#

💀

upbeat otter
#

💀 we know

carmine crane
maiden fable
#

@shrewd apex cries in a corner

upbeat otter
#

I didn't even know what was happening here so I went back to adding letters on my notebook 💀

#

and yeah Asher did a good job already

#

even though idk what was happening

shrewd apex
shrewd apex
maiden fable
#

Thanks!

shrewd apex
#

np

upbeat otter
shrewd apex
maiden fable
#

Coding in Kota
Nice

#

Okay I'mma go before mods kill me

shrewd apex
upbeat otter
shrewd apex
upbeat otter
maiden fable
#

take it to an ot

#

ofc

shrewd apex
#

nah ot graveyard

upbeat otter
maiden fable
#

This will also become one, if a mod comes by

shrewd apex
#

not at this intensity level

#

our prime/heydey was much higher

upbeat otter
shrewd apex
upbeat otter
#

Hunny Bunnie's also Indian uwu

maiden fable
#

I am no one

upbeat otter
#

why tf is everyone here Indian 💀

shrewd apex
upbeat otter
#

understandable

#

Imagine being Indian

slate swan
#

can't imagine

shrewd apex
#

jee and neet ducky_cheese

maiden fable
#

Here comes the Kota Man

upbeat otter
#

sarthy

shrewd apex
#

all of us are living the life

maiden fable
#

ofc

upbeat otter
slate swan
#

exactly

shrewd apex
shrewd apex
upbeat otter
shrewd apex
upbeat otter
maiden fable
#

2 weeks for me

shrewd apex
#

studying is supposed to be finished a year ago according to toppers

upbeat otter
maiden fable
#

only if u knew

slate swan
#

i didnt start studying yet, talk about finishing

upbeat otter
#

average topper cap

#

Imagine taking JEE 💀

maiden fable
#

!ot

unkempt canyonBOT
upbeat otter
#

no

slate swan
upbeat otter
#

Everything aside
don't tell me Hunnie Bunnie's a guy 💀

fading marlin
upbeat otter
#

tf

slate swan
slate swan
upbeat otter
quick gust
#

Did u just assume their pronouns? In almost 2023?! ?! ?! ?! ?! ?!

primal token
#

What is going on

maiden fable
quick gust
#

!ot

primal token
#

That is so

unkempt canyonBOT
quick gust
#

Before I get OT'd

maiden fable
#

Good idea

timid spade
#

if i put discord.Member in arguments
will it take @ mentions too?

upbeat otter
#

yeah

primal token
#

It can take mentions and IDs

maiden fable
#

and names too

slate swan
#

and nicknames too

white citrus
#
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 489, in _run_event
    await coro(*args, **kwargs)
  File "c:\Discord\Maja Projekt\MajaSystem_Test\bot.py", line 226, in on_application_command_error
    raise error
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 870, in invoke_callback_with_hooks
    can_run = await self.can_run(interaction)
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 839, in can_run
    check_result = await maybe_coroutine(check, interaction)  # type: ignore
  File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\utils.py", line 544, in maybe_coroutine
    return await value
  File "c:\Discord\Maja Projekt\MajaSystem_Test\modules\setup_v2\command_check.py", line 103, in extended_check
    raise command_check__no_admin_role_found
TypeError: exceptions must derive from BaseException```
maiden fable
#

Well the error is clear bro

#

You never derived the exception from BaseException

#

Show your custom exceptions

#

depends on yr question

arctic kindle
#

Idk why but in the first pfp.show() there is a circled image and when i paste it to the background there is a normal member avatar without mask can someone explain me why?
data = BytesIO(await member.display_avatar.read())
pfp = Image.open(data)

mask = Image.new('L', pfp.size, 0)
draw = ImageDraw.Draw(mask)
draw.ellipse((0, 0) + pfp.size, fill=255)
pfp.putalpha(mask)
pfp.show()
bgp.show()
bgp.paste(pfp, (pbx, pby))
bgp.show()
oblique fern
#

hey, trying to move from . commands to / commands. any idea how i can get a context like pass_context works with dot commands?

maiden fable
#

pass_context isn't even used anymore
It was removed years ago

upbeat otter
#

what did it even do

oblique fern
#

ok, so i'm assuming i shall just use the new provided methods on the interaction obj

maiden fable
#

No idea why one would want that but it is what it is

upbeat otter
maiden fable
#

For you, yea
But for people who have been deving since that age, they are used to it

slate swan
#

i mean there were easier methods like client.say etc, so as long as you don't need data related to invocation it wasnt needed 🤔

maiden fable
#

Yea

unkempt canyonBOT
#

examples/basic_bot.py lines 9 to 21

bot = commands.Bot(command_prefix='?', description=description)

@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')

@bot.command()
async def add(left : int, right : int):
    """Adds two numbers together."""
    await bot.say(left + right)```
slate swan
#

discord.py do be doing some weird stuff internally for the bot.say part

maiden fable
#

Hm

#

Uh yea I won't want to hear about those

unkempt canyonBOT
#

discord/ext/commands/bot.py lines 41 to 53

def _get_variable(name):
    stack = inspect.stack()
    try:
        for frames in stack:
            try:
                frame = frames[0]
                current_locals = frame.f_locals
                if name in current_locals:
                    return current_locals[name]
            finally:
                del frame
    finally:
        del stack```
primal token
maiden fable
#

thanks for a nightmare

#

?

timid spade
slate swan
#

you use a typehint, not set a value

#

its :, not =

timid spade
#

OH

#

man

#

thanks

south palm
#

so i am making a discord chat bot but running into a lot of errors can anyone help me ?

slate swan
#

Post the code and errors here and we'll do our best

south palm
#

this is the error code: Traceback (most recent call last):
File "C:\Users\tstur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "c:\scripts\Chat Bot Trainer.py", line 123, in on_message
collect_data("test", "label_1")
File "c:\scripts\Chat Bot Trainer.py", line 80, in collect_data
if one_hot_encoded_str.shape[0] != x_train.shape[0]:
AttributeError: 'str' object has no attribute 'shape'

#

now this is the discord chat bot and i belive it is getting a wrong array i couldnt figure out the trainer to actually store one-hot encoded 3d numpy array into the y_train.npy and it also just stops after you send only one message so for example i send in a discord one message it stores it but when i type again it does not store it

south palm
slate swan
#

hello I need help with my discord bot

#

could any help me?

south palm
#

put it in chatgpt

#

it should tell you whats wrong

#

also give it the code that the error is on

bright wedge
#

Why you are creating 2 embeds there?

atomic quest
south palm
south palm
slate swan
#

chatgpt is not really suggested, it gives wrong solutions most of the time

south palm
#

i mean it worked for me it was not its fault that i f*cked up the code my self now i cant explain it to it exacly

#

never could exxplain to it cuz i am bad at explaining

hushed galleon
slate swan
#

a guild is a server and you dont need it to make a slash cmd

#

atleast a global one

hushed galleon
#

what library and version are you using?

#

so presumably discord.py v2.0+, in that case the library provides a discord.ui.Button and discord.ui.View classes that you can use for creating your link button

#

there's examples of them in the repository, but link buttons in particular are simpler to write - no subclassing involved, you just combine the two classes i named and then send them alongside your message ```py

The view contains the button/select menus that you'll be adding to your message

view = discord.ui.View()

Adding a button link

button = discord.ui.Button(url="your url here")
view.add_item(button)

Sending your view

await channel.send(..., view=view)```

#

oh i forgot you need a label= argument for your button too

#

well you still need to send some message alongside your message components

#

discord doesnt allow you to send just the buttons

#

sure

cursive vine
#

You have any commands that aren't app-commands with user interactions yet ?@frozen ice

hushed galleon
#

discord made link buttons their own style, so you cant apply any colouring to them

buoyant quail
#

you can

#

example - i had blue button with emoji

#

no

#

link button can be only gray

compact ruin
#
File "e:\Python Files\ACER\SMP\Smp.py", line 97, in on_command_error
    raise error

Anyone know why i keep getting this error.

I had no issues before when i used to run my code i have no touched it in several months but i can no longer get it to run

buoyant quail
#

well.. it seems that you are throwing this error with raise error
show error handler's code

slate swan
#

no

#

!d discord.ui.Button.callback

unkempt canyonBOT
#

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

The callback associated with this UI item.

This can be overridden by subclasses.
slate swan
#

you'll have to subclass button

#

or use a proper View

unkempt canyonBOT
#

examples/views/confirm.py lines 21 to 33

class Confirm(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    # When the confirm button is pressed, set the inner value to `​True`​ and
    # stop the View from listening to more input.
    # We also send the user an ephemeral message that we're confirming their choice.
    @discord.ui.button(label='Confirm', style=discord.ButtonStyle.green)
    async def confirm(self, interaction: discord.Interaction, button: discord.ui.Button):
        await interaction.response.send_message('Confirming', ephemeral=True)
        self.value = True
        self.stop()```
compact ruin
# buoyant quail well.. it seems that you are throwing this error with `raise error` show error h...
ERROR    discord.client Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\Sultan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "e:\Python Files\ACER\SMP\SMP.py", line 97, in on_command_error
    raise error
discord.ext.commands.errors.CommandNotFound: Command "info" is not found
#

There is an info command btw

#

This code was working fine when i last left it several months ago now i tried to run it again after months and i keep gettin this error

worthy wagon
#

Anyone know how I could use channel IDs in an on_message event so I could have specific messages deleted out of X channel?

primal token
#

Nope

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @rapid oracle until <t:1672364075:f> (10 minutes) (reason: duplicates rule: sent 4 duplicated messages in 10s).

The <@&831776746206265384> have been alerted for review.

sick birch
#

Ironic

alpine cove
sick birch
#

The name

fading marlin
#

sick bypass ducky_sphere

slate swan
#

wait @unkempt canyon still uses role based mutes instead of timeouts? 🤔

fading marlin
#

doesn't pretty much every bot still use that?

slate swan
#

maybe

alpine cove
#

lmao

slate swan
hushed galleon
#

link buttons cant have a callback attached to them, so discord.py disallows you from setting their url when using the decorator form

fading marlin
#

I've always wondered what would happen if I tried adding a callback to a link button. Could I somehow tell when someone clicks on the button? Can I disallow certain users from using the link?... Now I know ducky_australia

primal token
fading marlin
#

I initially thought you could have callbacks

primal token
#

In disnake you can actually

fading marlin
#

ehhh disnake is disnake

hushed galleon
#

although since it gets turned into a Button object, you can still set the url afterwards during init: ```py
class MyView(discord.ui.View):
def init(self):
super().init()
self.my_button.url = "https://www.google.com/"
# discord.py auto-generates a custom ID but discord's API
# won't allow both url and custom_id at the same time
self.my_button.custom_id = None

@discord.ui.button(label="Click me", style=discord.ButtonStyle.link)
async def my_button(self, interaction, button): ...```
#

guess you might find that handy if you have a bunch of other decorators and want to place the link on a specific column

slate swan
#

how to fix

#

@hushed galleon

hushed galleon
#

use the style= parameter and set it to ButtonStyle.red or danger

slate swan
#

nvm

faint ferry
#
ERROR:discord.client:Ignoring exception in on_command_error
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/container/cogs/Create.py", line 67, in setembed
    await ctx.send(content = str(txt),view = DropdownTicketOptionsView(self.bot))
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/context.py", line 842, in send
    return await super().send(
  File "/home/container/.local/lib/python3.9/site-packages/discord/abc.py", line 1540, in send
    data = await state.http.send_message(channel.id, params=params)
  File "/home/container/.local/lib/python3.9/site-packages/discord/http.py", line 744, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.1.description: Must be 100 or fewer in length.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/home/container/main.py", line 54, in on_command_error
    raise error
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.1.description: Must be 100 or fewer in length.```
#

getting this error within my ticket bot

#

I have it working in one discord but when I try set the embed for my new discord it prints out this error

#

like I said this error does get thrown if I try re-set it up in the one that's currently working but other then that works fine

#

running python 3.9+

hushed galleon
#

the error's saying the first second option of your first component has a description exceeding 100 characters in length

#

dont really know how your code's generated a description that long but its got something to do within your DropdownTicketOptionsView class

faint ferry
#

I guess I'll look into it, doesn't really make sense

#

looks fine to me why

hushed galleon
#

:shrug:

slate swan
#

whats the issue for this?

white perch
#

Any error?

slate swan
#

doesn't even give me an error

ionic garden
#

so even if a repo is private

#

should the token still be in a private .env file?

white perch
#

Other commands work?

slate swan
slate swan
white perch
slate swan
white perch
#

Does the bot come online

slate swan
#

do you have message content intent enabled

slate swan
slate swan
slate swan
#

ok let me check it out

faint ferry
#

okay previous problem seems to be fixed, onto the next!

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.9/site-packages/discord/ui/view.py", line 425, in _scheduled_task
    await item.callback(interaction)
  File "/home/container/cogs/Create.py", line 23, in callback
    await Creation.build_ticket(self,interaction,interaction.guild,interaction.user,self.values[0])
  File "/home/container/cogs/Create.py", line 87, in build_ticket
    ticket = await self.bot.tickets.find_by_custom({"member_id":member.id,"tstatus":1,"category":ticket_type})
  File "/home/container/utils/mongo.py", line 36, in find_by_custom
    return await self.document.find_one(filter_dict)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/collection.py", line 1459, in find_one
    for result in cursor.limit(-1):
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/cursor.py", line 1248, in next
    if len(self.__data) or self._refresh():
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/cursor.py", line 1139, in _refresh
    self.__session = self.__collection.database.client._ensure_session()
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1740, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1685, in __start_session
    self._topology._check_implicit_session_support()
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/topology.py", line 538, in _check_implicit_session_support
    self._check_session_support()
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/topology.py", line 554, in _check_session_support
    self._select_servers_loop(
  File "/home/container/.local/lib/python3.9/site-packages/pymongo/topology.py", line 238, in _select_servers_loop
    raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: ac-dhuv6b6-shard-00-02.n7z9b5d.mongodb.net:27017: connection closed,ac-dhuv6b6-shard-00-01.n7z9b5d.mongodb.net:27017: connection closed,ac-dhuv6b6-shard-00-00.n7z9b5d.mongodb.net:27017: connection closed, Timeout: 30s, Topology Description: <TopologyDescription id: 63ae7bdc98769f970a740d7c, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-dhuv6b6-shard-00-00.n7z9b5d.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-dhuv6b6-shard-00-00.n7z9b5d.mongodb.net:27017: connection closed')>, <ServerDescription ('ac-dhuv6b6-shard-00-01.n7z9b5d.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-dhuv6b6-shard-00-01.n7z9b5d.mongodb.net:27017: connection closed')>, <ServerDescription ('ac-dhuv6b6-shard-00-02.n7z9b5d.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-dhuv6b6-shard-00-02.n7z9b5d.mongodb.net:27017: connection closed')>]>```
#

@hushed galleon pleading

shrewd apex
faint ferry
shrewd apex
slate swan
#

I activate a form and send a message with it and this happens, is there anyway to stop the bot from thinking like this

naive briar
#

You're sending the command

#

The bot haven't received it yet

#

At least that's what I'm seeing

slate swan
#

Well it stops after the form is submitted but if you cancel the form and dont submit it , it stays spinning forever

naive briar
shrewd fjord
#

completely avoid this problem

slate swan
#

discord.app_commands.errors.CommandInvokeError: Command 'purge' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

fast lotus
#

on which free hosting i can put my bot?

naive briar
slate swan
#
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 425, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\user\Desktop\Other\Winter Scripts\Bots\System\bot.py", line 97, in create_menu
    await interacta.response.send_message("**Ticket opened <#"+str(chnl.id)+">**", ephemeral=True)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 718, in send_message
    await adapter.create_interaction_response(
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
#

please help

#
            value = select.values[0]
            if value == "Support" :
                roles = [1057655121049309234,1043603526619762710,1057654847383552060]
                chnl = await interacta.guild.create_text_channel(name="ticket "+interacta.user.name)
                for role in roles :
                    trole = interacta.guild.get_role(role)
                    await chnl.set_permissions(trole, view_channel=False)
                supporters = interacta.guild.get_role(1057653777999614003)
                await chnl.set_permissions(supporters, view_channel=True, send_messages=True)
                close = Button(label="Close", emoji=":lock:", style=ButtonStyle.gray)
                await interacta.response.send_message("**Ticket opened <#"+str(chnl.id)+">**", ephemeral=True)

                async def close_callback(interactii):
                    if supporters in interactii.user.roles or interactii.user.guild_permissions.administrator == True:
                        await interactii.response.send_message("**The ticket will be closed in 5 seconds.**")
                        time.sleep(5)
                        await chnl.delete()

                close.callback = close_callback
                myview = View()
                myview.add_item(close)
                msg = await chnl.send("**Welcome " + interacta.user.mention + " in your support ticket.**", view=myview)```
#

that's the code 🙂

shrewd fjord
#

maybe timeouted

#

who knows

#

code is completely ok i think

#

unless u hide something xd

#

ayo

#

sync def create_menu(self, interacta, select):

#

seems like u r using normal command not class for view

#

so there is no way u can put self

#

xd

bright wedge
#
Code:

engine = create_async_engine("sqlite+aiosqlite:///:memory:")

the greenlet library is required to use this function. DLL load failed while importing _greenlet: The specified module could not be found.

shrewd fjord
#

💀

brisk pagoda
#

Hii

#

So im trying to us the discord UI Modals

#

im getting input from TextInput function, but i cant seem to be able to turn it into an int value

slate swan
#

Can you elaborate further? Post your code and any errors you are getting

south palm
#

yo delliott mind helping me ?

patent lodge
#

i cannot find the message back -.- so im just gonna ask again!

i made a poll system that when slash command is ran
./poll This is a cool question right? yea,no,maybe,what?
it puts the first line in an embed and then makes a button for each arg sep by comma so here i would have 4 buttons "yea" - "no" - "maybe" - "what?"

what my problem is that i dont see a way to make sure that a user can only vote/click one button! i would LOVE to disable all buttons after a user clicks a button BUT it does so for EVERYONE... so that is not an option sadly 😦

brisk pagoda
#
TypeError: unsupported operand type(s) for +: 'TextInput' and 'int'
slate swan
#

Seems like you just need to convert the input in your on_submit function using int(...)

#

And probably use a try except statement to handle any ValueError's

brisk pagoda
#

theres no input in my on submit

#
class Clearance(ui.Modal, title="Clear Messages"):
    amount = ui.TextInput(label="Number of messages to delete", placeholder="10", required=True)

    async def on_submit(self, interaction: discord.Interaction):
        await interaction.response.send_message(f"{self.amount} messages were wiped out from existence. _poof_",
                                                ephemeral=True)
        await interaction.channel.purge(limit=self.amount + 1)
slate swan
slate swan
brisk pagoda
#

i cannot

#

it doesnt let me, says int does not accept such type

#

i tried turning it into string first, i tried putting it in a string as a format

#

which didnt work also

shrewd fjord
slate swan
#

self.amount.value, my mistake.

shrewd fjord
#

self.amount returns modal or some sort of other objects

#

u need to convert it to string

#

self.amount doesnt return string

south palm
#

provided the link everything

shrewd fjord
scenic plaza
#

Hey, My Discord Bot Says it doesnt have permissions While it actually does, any help?

@commands.has_permissions(kick_members=True)
async def kick(ctx, member:discord.Member, *, reason=None):
    if commands.has_permissions(kick_members=False) or commands.has_permissions(administrator=False):
        await ctx.send('I Do Not Have Kick Permissions.')
    else:
        await ctx.send('Kicking User..')
    if reason == None:
         reason="No Reason Provided"
    if commands.has_permissions(kick_members=True):
        await ctx.guild.kick(member)
        await ctx.send(f'User {member.mention} has been kicked for {reason}.') ```
slate swan
scenic plaza
#

kick command btw

shrewd fjord
#

value and amount both will work

#

value returns string while amount returns some sort of other obj

#

just need to convert it

naive briar
#

It returns TextInput object

shrewd fjord
#

yea

#

forgor 💀

naive briar
#

Wait

shrewd fjord
#

if commands.has_permissions(kick_members=True):
await ctx.guild.kick(member)
await ctx.send(f'User {member.mention} has been kicked for {reason}.')

#

just why?

naive briar
#

!d discord.TextInput.value

unkempt canyonBOT
shrewd fjord
#
@commands.has_permissions(kick_members=True)
#

you already have check func

shrewd fjord
naive briar
#

You can set its default value

slate swan
shrewd fjord
naive briar
#

!d discord.TextInput

shrewd fjord
#

;-;

naive briar
#

🍕

shrewd fjord
brisk pagoda
shrewd fjord
#

🐟 take 💀

brisk pagoda
#

so how th do i turn it into INTEGER

slate swan
shrewd fjord
#

you cant make the user to force input integer

#

use slash command instead 🤷

brisk pagoda
#

no bro

shrewd fjord
#

oh

brisk pagoda
#

you dont understnad, i turned it into a string

shrewd fjord
#

i c
int = int(self.amount)

brisk pagoda
#

but it doesnt work

#

ill show you

shrewd fjord
#

ig u r trying to tell this?

brisk pagoda
#

no i want help

#

user enters 10

#

i want to + 1 to the 10 i nthe code but i cant seem to do that

shrewd fjord
#

and do whatever u want

#

not whatever 💀

brisk pagoda
#

bro

#

wait

naive briar
unkempt canyonBOT
#

@naive briar :white_check_mark: Your 3.11 eval job has completed with return code 0.

<class 'int'> 2020
brisk pagoda
#

OH HELL YEAH THIS WORLS

#

what i was trying to do was

shrewd fjord
#

💀

brisk pagoda
#

amount = int(str(amount))

shrewd fjord
#

i am saying this for too ling

#

long

brisk pagoda
#

bro your way doesnt work

#

relax let me say it

#

amount = int(amount) gives an error

shrewd fjord
brisk pagoda
#

it doesnt work

shrewd fjord
#

like dat xd

brisk pagoda
#

ill show u

naive briar
#

You can't convert TextInput object to Integer 🤷

brisk pagoda
#

yes i realizd

shrewd fjord
brisk pagoda
#

yes i did so

#

i did amount = int(str(amount))

shrewd fjord
#

then convert it to int xd

brisk pagoda
#

still didnt work

slate swan
shrewd fjord
brisk pagoda
shrewd fjord
brisk pagoda
#

cannot turn "" into integer base 10

#

so then i realized instead of using both methods at once

#

ill turn it into a str first, then use int when they submit it

shrewd fjord
#

💀

brisk pagoda
#

bc i mguessing it was trying to turn an empty variable

shrewd fjord
#

wth u r trying to do xd

brisk pagoda
#

im not sure how that is happening

shrewd fjord
#

give code lol

brisk pagoda
#
class Clearance(ui.Modal, title="Clear Messages"):
    amount = ui.TextInput(label="Number of messages to delete", placeholder="10", required=True)
    amount = str(amount)


    async def on_submit(self, interaction: discord.Interaction):
        await interaction.response.send_message(f"{self.amount} messages were wiped out from existence. _poof_",
                                                ephemeral=True)
        await interaction.channel.purge(limit=int(self.amount) + 1)
naive briar
#

What what

#

Why is it in init

shrewd fjord
#

amount = ui.TextInput(label="Number of messages to delete", placeholder="10", required=True)
amount = str(amount)

#

bro is trying to convert it to str before submitting the modal 💀

brisk pagoda
#

that works

shrewd fjord
#

how th that works xd

#

listen

brisk pagoda
#

a tyype doesnt need a value to turn into a string

shrewd fjord
#

sigh

#

idk i give up

brisk pagoda
#

but it's a value when turning into an integer type because it has to check for base 10 first

shrewd fjord
#

xd

slate swan
#
try:
  amount_int = int(self.amount.value)
except ValueError:
  #  do something else
brisk pagoda
slate swan
brisk pagoda
#

I FIXED IT

#

SO WHY YOU SAYING IT DOESNT WORK BRO

#

😭

shrewd fjord
brisk pagoda
shrewd fjord
#

amount = str(amount)

brisk pagoda
shrewd fjord
#

why bruh

brisk pagoda
#

but i found a way around it

brisk pagoda
shrewd fjord
brisk pagoda
brisk pagoda
shrewd fjord
brisk pagoda
#

if i remove it code wont run

naive briar
#

There's no

shrewd fjord
brisk pagoda
#

wanna see?

naive briar
#

You're not getting the submitted value

shrewd fjord
naive briar
#

You're getting the default value

brisk pagoda
#

nevermind

naive briar
#

Do it in the callback, not init

brisk pagoda
#

yall are correct

#

i admit defeat in this one

shrewd fjord
#

yep u r getting the default value None probably since the placeholder doesnt set a default "value"

shrewd fjord
brisk pagoda
#

first time working with it, didnt realize the concept

#

thank you for clearing it off

#

your efforts had a certain amount of success

shrewd fjord
#

💀

#

hope you'll do more big brain plays on future ;]

brisk pagoda
#

bro cmon

#

dont do that ITS A ONE TIME THING

#

ITS MYY FIRST TIME

shrewd fjord
#

big brain stuffs actually helps lol

brisk pagoda
#

the name

#

sure suits it perfectly true and well

shrewd fjord
#

hehe

brisk pagoda
#

i was actually trynna make a command to make the bot send embed messages

brisk pagoda
#

then i told my friend to try it, and shes like "So it's the same thing as Mimu embed command, but made by moth"?

scenic plaza
brisk pagoda
#

and im like wot, and i check it and i see it uses this new thing i didnt know existed 😭

shrewd fjord
scenic plaza
brisk pagoda
shrewd fjord
#

what the.....
well
on_command_error

brisk pagoda
#
  @commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, TimeoutError) or isinstance(error, commands.CommandNotFound):
            return
        elif isinstance(error, commands.MissingRole) or isinstance(error, commands.MissingAnyRole):
            return await ctx.reply("L (You lack the required permission)")
        elif isinstance(error, commands.MissingRequiredArgument):
            command = self.command_details[ctx.command.name]

            command_embed = self.client.create_embed(
                "Dreamworld Help Page",
                "The command you just ran was used incorrectly.",
                config.embed_error_color
            )
brisk pagoda
#

thats what i use

#

¯_(ツ)_/¯

shrewd fjord
#

works xd

brisk pagoda
#

im still depressed, mimu's so much better 😭

#

i mean i can make the same thing but still HAHAHAHA

shrewd fjord
brisk pagoda
shrewd fjord
#

those commands are so cheap (well i felt this after i learnt the database thing) 💀

scenic plaza
shrewd fjord
#

or me belike AYO HOW TH HE MADE WELCOME MESSAGE FOR DIFFERENT SERVERS????? AYOOO

brisk pagoda
shrewd fjord
#

xd

scenic plaza
brisk pagoda
#

LMAO

shrewd fjord
brisk pagoda
scenic plaza
brisk pagoda
shrewd fjord
brisk pagoda
#

you wanna see my godly embed command fr?

shrewd fjord
#

nah xd

#

ik database now so this stuffs are too ez

brisk pagoda
#

well sorry bro im sending it anyways

#
@app_commands.command(
        name="sendembed",
        description="Sends an embed in a specified channel."
    )
    @app_commands.default_permissions(manage_messages=True)
    @app_commands.describe(
        channel="Select a channel. Example #general",
        content="Content of the message outside of the embed.",
        title="Title of the embed (Located at the inner-top of the embed).",
        description="Description of the embed (Located directly under the Title).",
        image="Put an image in the embed. Located at the inner-bottom of the index. (Use discord attachment link)",
        footer="Text at the bottom of the embed in much smaller size.",
        footer_icon="An icon at the start of the footer. (Use discord attachment link)",
        title_hyperlink="Make the title an Hyperlink. (Input a url)",
        author="Adds a small name above the title. Usually to put the name of the Message Writer."
    )
    async def sendembed(self,
                        ctx: discord.Interaction,
                        channel: str,
                        title: str,
                        description: str,
                        content: str = None,
                        image: str = None,
                        footer: str = None,
                        footer_icon: str = None,
                        title_hyperlink: str = None,
                        author: str = None
                        ):
        channel = channel[2:-1]
        msg_embed = Embed(title=title, description=description, color=0xa22aaf, url=title_hyperlink)
        if footer is not None:
            msg_embed.set_footer(text=footer, icon_url=footer_icon)
        if image is not None:
            msg_embed.set_image(url=image)
        if author is not None:
            msg_embed.set_author(name=author)

        msg_channel = self.client.get_channel(int(channel))
        await msg_channel.send(content, embed=msg_embed)
        await ctx.response.send_message(f"Message has been successfully sent to <#{channel}>.")
shrewd fjord
brisk pagoda
#

im not saying its difficult

shrewd fjord
#

💀

brisk pagoda
#

it was very easy

brisk pagoda
brisk pagoda
shrewd fjord
#

channel: str,

#

bro just why 🤷‍♂️

solid orbit
#

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

shrewd fjord
#

when u can just do channel: discord.TextChannel

#

like y bro+++

brisk pagoda
#

OH I WAS LOOKING FOR THAT

#

i did discord.channel but couldnt find anything

shrewd fjord
#

💀

brisk pagoda
#

for i was like this works

#

anything else looks stupid

shrewd fjord
brisk pagoda
#

im here to learn so do critizise it all you want

#

doing so rn dw

shrewd fjord
#

!d discord.TextChannel

unkempt canyonBOT
#

class discord.TextChannel```
Represents a Discord guild text channel.

x == y Checks if two channels are equal.

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

hash(x) Returns the channel’s hash.

str(x) Returns the channel’s name.
shrewd fjord
#

xd
also the footer icon and other stuff ur bot will cry if they doesnt provide link xd

#

instead of providing some random stuff lol

brisk pagoda
#

fair no detection

#

hmm

shrewd fjord
south palm
shrewd fjord
#

check if the value has https or not

brisk pagoda
#

thank you very much

#
@app_commands.command(
        name="sendembed",
        description="Sends an embed in a specified channel."
    )
    @app_commands.default_permissions(manage_messages=True)
    @app_commands.describe(
        channel="Select a channel. Example #general",
        content="Content of the message outside of the embed.",
        title="Title of the embed (Located at the inner-top of the embed).",
        description="Description of the embed (Located directly under the Title).",
        image="Put an image in the embed. Located at the inner-bottom of the index. (Use discord attachment link)",
        footer="Text at the bottom of the embed in much smaller size.",
        footer_icon="An icon at the start of the footer. (Use discord attachment link)",
        title_hyperlink="Make the title an Hyperlink. (Input a url)",
        author="Adds a small name above the title. Usually to put the name of the Message Writer."
    )
    async def sendembed(self,
                        ctx: discord.Interaction,
                        channel: discord.TextChannel,
                        title: str,
                        description: str,
                        content: str = None,
                        image: str = None,
                        footer: str = None,
                        footer_icon: str = None,
                        title_hyperlink: str = None,
                        author: str = None
                        ):
        msg_embed = Embed(title=title, description=description, color=0xa22aaf, url=title_hyperlink)
        if footer is not None:
            msg_embed.set_footer(text=footer, icon_url=footer_icon)
        if image is not None:
            msg_embed.set_image(url=image)
        if author is not None:
            msg_embed.set_author(name=author)

        await channel.send(content, embed=msg_embed)
        await ctx.response.send_message(f"Message has been successfully sent to {channel.mention}.")

#

detectiom

#

@shrewd fjord whjat u think is a good way

#

oh

brisk pagoda
brisk pagoda
#

is there a way to check the availability of a link?

shrewd fjord
brisk pagoda
#

hmm

#

okay

shrewd fjord
#

try:
#add icon_url and stuff here
except:
#it will handle all possible errors

brisk pagoda
#

yup

shrewd fjord
#

and u can do await interaction.response.send_message("Invalid input) or whatever xd

glad cradle
#

(don't use bare except)

shrewd fjord
#

u can first manually check what error raises if u dont use link

#

then do except "The raised error":

#

i think HTTPException is better in all case

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

x == y Checks if two embeds are equal.

New in version 2.0...
brisk pagoda
#

@shrewd fjord enlighten me boss

#

so uh

#

apparently it doesnt tthrow an error

#

until the embed is actually being sent

#

so if i use try and except on that, it wont be able to differentiate between different icons for diff thingd

shrewd fjord
#

!e
x = 2
y = 2
print(x == y)

unkempt canyonBOT
#

@shrewd fjord :white_check_mark: Your 3.11 eval job has completed with return code 0.

True
shrewd fjord
#

0.o

solid orbit
#

why can't i import this?

upbeat gust
#

What do you expect..?

solid orbit
#

i am new to coding btw

upbeat gust
#

what is import bot supposed to do?

solid orbit
slate swan
#

what do u have in ur bot's file

solid orbit
#

let me send

shrewd fjord
#

idk xd

upbeat gust
solid orbit
upbeat gust
#

Would've been nice if that was explained

solid orbit
upbeat gust
# solid orbit

didn't I tell you like yesterday to use the commands extension in the dpy server?

upbeat gust
solid orbit
#

yes (i understand most parts) but can't do it by myself yet

upbeat gust
#

Can I get a link to that

#

It's really really bad god damn

solid orbit
#

i can't send links in this chat

#

Create Your Own Discord Bot in Python 3.10 Tutorial (2022 Edition)

upbeat gust
solid orbit
#

lol now i can

upbeat gust
#

I highly recommend you stop watching that tutorial

solid orbit
#

i already did

#

can you send a better one?

upbeat gust
meager chasm
#

Society when PPL learn python and write their own code instead of copying from tutorial:

slate swan
meager chasm
#

I was gonna do that but too lazy

slate swan
# solid orbit can you send a better one?

YouTube tutorials for Discord bots tend to be bad in general and include a lot of bad habits. Official docs, StackOverflow and Discord are all much better sources of help.

solid orbit
#

okay ty

meager chasm
#

And if u need resources for python you can check !resources

solid orbit
#

now its just this:

#

because whatever code i typ its now just saying: hi, pycharm

upbeat gust
#

its ok if you know some and wanna try dpy, but you should really at least know some

solid orbit
#

yes i am watching videos of codecamp

upbeat gust
#

sure

random obsidian
#

Hello
I Can't Enter Than 10 Line Of Message In Respond Of Slash Command
When I Enter 11th Line , Bot Says Application Did Not Respond

#

Slash Command Won't Support Respond Message More Than 10 Lines?

rare echo
#

looks like a lot of work

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

random obsidian
#

my problem is my bot and business
not my language 😊

random obsidian
# unkempt canyon
discord.app_commands.errors.CommandInvokeError: Command 'order' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
#
Traceback (most recent call last):
  File "D:\Python\Python311\Lib\site-packages\discord\app_commands\tree.py", line 1242, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "D:\Python\Python311\Lib\site-packages\discord\app_commands\commands.py", line 887, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\Python311\Lib\site-packages\discord\app_commands\commands.py", line 880, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'order' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
#

full trace back

#
await ctx.response.send_message(
    ":white_check_mark:" + " " + "سفارش شما ثبت شد!" + ""
    "\n:art:" + " " + "سفارش شما" + " " + ":" + " " + order_type + ""
    "\n:paintbrush:" + " " + "سرویس سفارش شما" + " " + ":" + " " + order_service + ""
    "\n:video_camera:" + " " + "موضوع ویدیو شما" + " " + ":" + " " + order_subject + ""
    "\n:alarm_clock:" + " " + "زمان آپلود ویدیو شما" + " " + ":" + " " + order_uploadtime + ""
    "\n:notepad_spiral:" + " " + "توضیحات اضافه سفارشتون" + " " + ":" + " " + order_description + ""
    "\n:heavy_minus_sign:"
    "\n:bust_in_silhouette:" + " " + "<@" + user_id + ">" + " " + "عزیز"
    "\nاز سفارشتون بسیار متشکریم!"
    "\nتا دقایق دیگر ، یکی از طراحان تیم ، کار شما رو به عهده خواهد گرفت!" + ""
    "\nلطفا در همین چنل ، منتظر حضور طراح باشید!" + "" # <--- When I Enter This , It Give Me `Application Did Not Respond`
    )
#

yeah

#

hey
its correct for 10 lines
for 11th line , it give not respond message

rare echo
#

you should just
“””
message1
message2
“””
but i’ll look at it on pc in about an hour if nobody helps you

random obsidian
#

@oblique sorrel@rare echo In 10 Line Of Bot Response

#
    await ctx.response.send_message(
    ":white_check_mark:" + " " + "سفارش شما ثبت شد!" + ""
    "\n:art:" + " " + "سفارش شما" + " " + ":" + " " + order_type + ""
    "\n:paintbrush:" + " " + "سرویس سفارش شما" + " " + ":" + " " + order_service + ""
    "\n:video_camera:" + " " + "موضوع ویدیو شما" + " " + ":" + " " + order_subject + ""
    "\n:alarm_clock:" + " " + "زمان آپلود ویدیو شما" + " " + ":" + " " + order_uploadtime + ""
    "\n:notepad_spiral:" + " " + "توضیحات اضافه سفارشتون" + " " + ":" + " " + order_description + ""
    "\n:heavy_minus_sign:"
    "\n:bust_in_silhouette:" + " " + "<@" + user_id + ">" + " " + "عزیز"
    "\nاز سفارشتون بسیار متشکریم!"
    "\nتا دقایق دیگر ، یکی از طراحان تیم ، کار شما رو به عهده خواهد گرفت!" + ""
#

exactly , like code

rare echo
#

might just be a discord limit then, you tried embed?

random obsidian
#

aha

#

sure
wait 😁

rare echo
#

yeah i would say try an embed, or split the message into 2, one containing
:emoji: 1: blah blah blah messages
then 2nd message with the
@(user) message

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

random obsidian
#

but
its good idea for testing embed

shrewd apex
#

defer and then edit the response

random obsidian
rare echo
#

defer

shrewd apex
#

bro read the docs

random obsidian
random obsidian
shrewd apex
#

also why are u naming a interaction object as ctx naming convention where

rare echo
random obsidian
rare echo
#

lmao

#

well that still is an inter