#discord-bots

1 messages ยท Page 143 of 1

sick birch
#

!or-gotcha

unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

# Incorrect...
if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
cinder tulip
sick birch
#
if 'praying' or 'pray' in message.content:
  ...

is interpreted to be

if ('praying') or ('pray' in message.content):
  ...

which is interpreted to be

if True or ?:
  ...

where ? is True or false. Whatever it is, it's always true

sick birch
sick birch
# cinder tulip ???

Though you could just do if pray in message.content because pray is in praying

cinder tulip
#

oh really

glad cradle
#

if message.content in (..., ...) would be the best solution

sick birch
#

!e print("pray" in "praying for you")

unkempt canyonBOT
#

@sick birch :white_check_mark: Your 3.11 eval job has completed with return code 0.

True
glad cradle
sick birch
#

Doesn't work if you want to just compare words

unkempt canyonBOT
#

Hey @sharp nest!

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

cinder tulip
#

hmmm

sick birch
#

If you want to compare if one of multiple words is in a message:

words_list = ["hello", "world", "word", "other", ...]
if any(word in message.content for word in words_list):
  ...
cinder tulip
#

cocacolastic

glad cradle
#

bump

cinder tulip
#

do i have to add that if message.author
etc. etc.

sick birch
#

Or better yet, extract into function:

import typing as t

def has_word(words: t.Sequence[str], sentence: str) -> bool:
  return any(word in sentence for word in words)
cinder tulip
#

ahhh

sick birch
cinder tulip
#

i feel so dumb rn lol

turbid shale
#

can anyone host my bot

sick birch
#

Not a good idea

cinder tulip
#

NOW IT WORKS

#

sorry if i dragged this much the problem AA_Gab_Bow

vale wing
turbid shale
#

pretty sure u can stop running it once i do the slash command

vale wing
#

Just run it on your PC?

sharp nest
turbid shale
#

having 2 many problems

#

also why ask "depends" if ur just going to tell me to do it myself

vale wing
#

I thought you would host it long-term

maiden fable
#

dO i SeE rObIn AbUsInG FlExInG rEaCtIoN pErMiSsIoNs ๐Ÿ‘€

vale wing
#

Host != Run

cinder tulip
turbid shale
cinder tulip
#

just fix those problems and run the py file
how's that hard

turbid shale
vale wing
cinder tulip
turbid shale
#

if i ask anyone for a favor and u dont want to do the favor why type

turbid shale
vale wing
#

That's easily done on any machine

cinder tulip
#

client.run('yourtoken')

vale wing
#

What problems do you have

cinder tulip
#

and then click this thing

turbid shale
# vale wing What problems do you have

Ignoring exception in on_connect
Traceback (most recent call last):
File "/home/runner/QuixoticConfusedModem/venv/lib/python3.8/site-packages/discord/client.py", line 377, in _run_event
await coro(*args, **kwargs)
File "/home/runner/QuixoticConfusedModem/venv/lib/python3.8/site-packages/discord/bot.py", line 1164, in on_connect
await self.sync_commands()
File "/home/runner/QuixoticConfusedModem/venv/lib/python3.8/site-packages/discord/bot.py", line 738, in sync_commands
app_cmds = await self.register_commands(
File "/home/runner/QuixoticConfusedModem/venv/lib/python3.8/site-packages/discord/bot.py", line 531, in register_commands
prefetched_commands = await self._bot.http.get_guild_commands(
File "/home/runner/QuixoticConfusedModem/venv/lib/python3.8/site-packages/discord/http.py", line 366, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In guild_id: Value "Ellipsis" is not snowflake.

vale wing
#

Da heck is this

#

Could you show your code please

turbid shale
#

This example requires the 'members' privileged intent to use the Member converter.

import discord

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

bot = discord.Bot(
debug_guilds=[...],
description="An example to showcase how to extract info about users.",
intents=intents,
)

@bot.slash_command(name="userinfo", description="Gets info about a user.")
async def info(ctx: discord.ApplicationContext, user: discord.Member = None):
user = (
user or ctx.author
) # If no user is provided it'll use the author of the message
embed = discord.Embed(
fields=[
discord.EmbedField(name="ID", value=str(user.id), inline=False), # User ID
discord.EmbedField(
name="Created",
value=discord.utils.format_dt(user.created_at, "F"),
inline=False,
), # When the user's account was created
],
)
embed.set_author(name=user.name)
embed.set_thumbnail(url=user.display_avatar.url)

if user.colour.value:  # If user has a role with a color
    embed.colour = user.colour

if isinstance(user, discord.User):  # Checks if the user in the server
    embed.set_footer(text="This user is not in this server.")
else:  # We end up here if the user is a discord.Member object
    embed.add_field(
        name="Joined",
        value=discord.utils.format_dt(user.joined_at, "F"),
        inline=False,
    )  # When the user joined the server

await ctx.respond(embeds=[embed])  # Sends the embed
vale wing
#

debug_guilds=[...] you need to put actual server IDs to there or remove this kwarg at all

cinder tulip
#

yeah

primal token
slate swan
#

u need to pass ids

#

not whatever elipsisisisisi is

cinder tulip
#

bot = discord.Bot(
debug_guilds=[yourServersID],
description="An example to showcase how to extract info about users.",
intents=intents,
)

slate swan
#

or make sure elipissisiis is an actual INT

cinder tulip
#

if you wanna get your server's id you just need to right click on the icon and click the button that says copy id @turbid shale

primal token
unkempt canyonBOT
#

@primal token :white_check_mark: Your 3.11 eval job has completed with return code 0.

<class 'ellipsis'>
sharp nest
#

pls help me

slate swan
#

get the channel and channel.send

turbid shale
#

i have my id where do i put it in the code

cinder tulip
#

and you delete those "..." and paste the ID

vale wing
#

That's a meaningful construction in python

maiden fable
#

Gotta love tutorials

vale wing
#

Can anyone tell me if we are allowed to track amount of online users on servers and their statuses (online/idle/dnd/offline)

maiden fable
#

why won't we allowed to do so?

vale wing
#

I heard somewhere that it's not

slate swan
#

there's literally an event for it lol

maiden fable
#

Well many bots make graph of yr status, so I am betting on u can

vale wing
#

K good

maiden fable
#

And... if some day u get an error saying Discord banned your bot from accessing their API or a DM from Discord, you know that its not allowed

vale wing
maiden fable
#

LMAO

vale wing
#

Well I googled it

turbid shale
#

Next, designate your official server for your app (for example, your App Support Server, App Community Server or App Development Server).

#

how do i do this?

slate swan
#

huh

vale wing
maiden fable
slate swan
turbid shale
turbid shale
vale wing
#

๐Ÿ’€

slate swan
#

make a server enable community set ur support server to that server

#

then wait 24 hrs

turbid shale
slate swan
#

its not with the bot lol

turbid shale
slate swan
#

u need to enable community in one of your servers

vale wing
#

Wish discord made "verified bot developer" badge so it's deserved

maiden fable
#

Wait what server badge are we talking about?

turbid shale
slate swan
#

its been mentioned by them multiple times

turbid shale
vale wing
#

Is this one limited?

slate swan
#

nope

vale wing
#

Well why would the verified bot developer badge be limited

#

Just give it to all people who have verified bots ๐Ÿ˜‰

slate swan
#

huh?

#

nah thats still considered limited

turbid shale
#

bro

slate swan
#

and would cause issues

turbid shale
#

does aznyone see my messages

slate swan
#

with ppl spamming bots with fake servers

vale wing
#

They have a protection against that

slate swan
#

its trash lmfao

turbid shale
#

bro

vale wing
#

If you read an article about bot verification

vale wing
turbid shale
#

duyde does no one see my msgs

vale wing
maiden fable
#

Lmao its already hard to get yr bot verified by making sure it isn't in any bot farms/ghost servers how harder do u want it to be?

maiden fable
turbid shale
slate swan
maiden fable
#

Well yea, but then due to them genuine bots either get delayed verification or are denied verification (has happened with me)

slate swan
vale wing
#

I should probably verify my antispam bot but I am too lazy ๐Ÿฅฑ

turbid shale
slate swan
#

i applied once, and got verified within a day lmao. i got lucky with timing

turbid shale
#
  • i didnt ask u
maiden fable
maiden fable
#

Lmao it was literally a day before their winter holidays start that my bot got verified

slate swan
#

sheesh

slate swan
turbid shale
slate swan
#

is that not what you are doing????????????????

turbid shale
maiden fable
#

Lmao

slate swan
#

you choose the support server from that page itself, just enable community for the server that you are planning to choose

turbid shale
#

and theres no link for that on any of their sites

slate swan
#

he dont listen

maiden fable
#

Maybe sarth will be able to explain in a better way lmao

turbid shale
slate swan
#

and don't be lazy enough to not reload your page after enabling community on discord

turbid shale
#

im asking how do i setup my server support for my bot

slate swan
#

u dont have any bots with slash commands

turbid shale
#

no link to that page has been sent

turbid shale
maiden fable
#

not with a global slash command

slate swan
#

then u need to wait for them to register

maiden fable
#

maybe the slash command has the guild_ids kwarg set

slate swan
#

or that

turbid shale
maiden fable
#

remove that kwarg

slate swan
#

show ur cmd

cinder tulip
#

@turbid shale does your bot has application commands or normal commands

#

well app commands or tree commands or how you call them

turbid shale
#

This example requires the 'members' privileged intent to use the Member converter.

import discord

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

bot = discord.Bot(
debug_guilds=[1046119225170874499],
description="An example to showcase how to extract info about users.",
intents=intents,
)

@bot.slash_command(name="userinfo", description="Gets info about a user.")
async def info(ctx: discord.ApplicationContext, user: discord.Member = None):
user = (
user or ctx.author
) # If no user is provided it'll use the author of the message
embed = discord.Embed(
fields=[
discord.EmbedField(name="ID", value=str(user.id), inline=False), # User ID
discord.EmbedField(
name="Created",
value=discord.utils.format_dt(user.created_at, "F"),
inline=False,
), # When the user's account was created
],
)
embed.set_author(name=user.name)
embed.set_thumbnail(url=user.display_avatar.url)

if user.colour.value:  # If user has a role with a color
    embed.colour = user.colour

if isinstance(user, discord.User):  # Checks if the user in the server
    embed.set_footer(text="This user is not in this server.")
else:  # We end up here if the user is a discord.Member object
    embed.add_field(
        name="Joined",
        value=discord.utils.format_dt(user.joined_at, "F"),
        inline=False,
    )  # When the user joined the server

await ctx.respond(embeds=[embed])  # Sends the embed
slate swan
#

what is debug_guilds? literally nothing in docs ab that lol

#

oh pycord

#

so yeah remove debug_guilds because that makes ur cmds NOT global

#

ฯ€๐Ÿ”Œ

turbid shale
slate swan
#

yup

dry kelp
turbid shale
# slate swan yup

Traceback (most recent call last):
File "main.py", line 11, in <module>
@bot.slash_command(name="userinfo", description="Gets info about a user.")
NameError: name 'bot' is not defined

#

removed it and got an error

slate swan
#

bro i said remove debug_guilds

turbid shale
slate swan
#

u literally remove the entire bot definition lol

#

hence why bot isn't defined

#

and if u fixed it then u just need to wait a couple mins then refresh the page

faint mural
#

How do two optional arguments works?

Idea:
` - command arg1 Optional[arg2] Optional[arg3]

  • command arg1 arg3
  • command arg1 arg2 arg3`

I cant figure out how i can allow arg3 being passed without using it as arg2 LorbWsadspoonOwO

slate swan
#

wdym

short pulsar
#

when i do the kick command in a slash command = raise TypeError(f'parameter {parameter.name!r} is missing a type annotation in callback {func.qualname!r}')
TypeError: parameter 'reason' is missing a type annotation in callback 'kick'
๎บง

#

what does this mean

short pulsar
#

tried the easiest lol

#

@client.tree.command(name="kick", description="Kicks a member")
async def kick(interaction: discord.Interaction, member: discord.Member, *, reason=None):
await interaction.member.kick(reason=reason)

thats the kick command lol

slate swan
#

u set to none

short pulsar
#

ah

faint mural
short pulsar
slate swan
short pulsar
#

alr

slate swan
#

if none .kick()
else .kick(reason=reason)

naive briar
short pulsar
#

๐Ÿ’€

#

alr fixed

naive briar
short pulsar
#

interaction didnt have .member inside of the thing

#

wait

#

permissions arent working wth

dry kelp
short pulsar
#

@commands.has_permissions(kick_members=True)

#

How do i add that to my line of code

#

does it go under async or like

dry kelp
#

No... That stays before async

short pulsar
#

oh alr

dry kelp
#
@stuff
@commands.has_permissions(kick_members=True)
async def test():
slate swan
short pulsar
#

yuh

dry kelp
slate swan
#

BUTTONS ARE NOT APPCMDINTERACTIONS

dry kelp
#

Oh

#

sent old ones... yes changed that

#

i know.. but the things the guy from disnake didn't make me understand

slate swan
#

im the guy from disnake bro lmao

dry kelp
#

Yes but this will send me the same shit man

slate swan
#

bro thats not what i sent u

#

interaction.message

dry kelp
#

we weren't talking about the same things.. the callback u sent me was not what i wanted

slate swan
#

original_message() does not exist because u never sent a message using the button

dry kelp
#

maybe my mistake i didn't send the entire code

slate swan
#

read docs

dry kelp
#

This is why im using self.message

dry kelp
#

Also this worked like 2-3 weeks ago

#

so i suppose changes happened to disnake when it comes about this

slate swan
#

no way that worked

dry kelp
#

im telling you it did

slate swan
#

no it did not you never sent a response for clicking the button so there is no way an original_response/message exist

dry kelp
#

@slate swan

#

i didn't change the code since then and it always worked.. i've noticed this recently

dry kelp
#

but i thought it's because of the response.. that's why i came up with defer

#
async def callback(self, interaction: disnake.MessageInteraction):
        message = interaction.message

this u told me

#

why do u think i have self.message in the def

slate swan
#

holy bro. it is an example showing u how to properly get the message attached to the button

dry kelp
#

i told you.. the way i was doing it worked that's why im so confused and i can't understand

slate swan
#

not possible.

dry kelp
slate swan
#

idk why u dont just read docs

#

when u click the button.

#

you are trying to edit the message right?

dry kelp
#

well yes it edits the button as disabled

slate swan
#

yes

dry kelp
#

and more things like color bla bla

slate swan
#

so you need to use interaction.message

#

because original_message is used for fetching the RESPONSE message

#

which you have yet to send a RESPONSE message so it does not exist

dry kelp
#

oh

#

1 sec

#

u mean self.message = interaction.message ?

slate swan
#

yup

dry kelp
#

OH

#

sorry i didn't understand that at first

ember nest
#

Hey @slate swan

#

I made a slash poll command but it got a little problem can you help me to fix it?

slate swan
#

sup

ember nest
#

Hello

#

Lemme show you

dry kelp
#

1 sec lemme run docker again

slate swan
#

u never changed it lol

dry kelp
slate swan
#

look at ur error

dry kelp
#

Bro im not that dumb rn ik how to save the code

slate swan
#

you are dumb

dry kelp
#

Yes that's why im confused ๐Ÿคฃ

ember nest
#

So I made this poll command

dry kelp
#

Bro im telling you i changed it

#

saved it

slate swan
#

impossible

ember nest
dry kelp
#

want me to sharescreen rn?

slate swan
#

your error is smarter than u

dry kelp
#

this just makes me look stupid

#

๐Ÿ˜‚

#

Bro i changed it

ember nest
slate swan
#

show code

#

if option is none dont add to embed

dry kelp
ember nest
#

So how to make if option is none don't add to embed here

#

@slate swan

slate swan
#

no idea i aint that smart

#

for idx, option in enumerate(options) if option not None i giess idk

ember nest
#

Lemme try

#

That worked but 1 problem emojes is still 10 @slate swan

slate swan
#

where ur code go

#

i dont remember it

#

show code again

ember nest
#

@slate swan

slate swan
#

same thing

#

if not none

ember nest
#

How

#

Tried didn't work

slate swan
#

why u keep deleting code bruh i dont have photographic memory

ember nest
#

Lol sorry

#

I tried do same for reaction didn't work

#

Can u show how to @slate swan

slate swan
#

try

for emoji in numbers[:len(options)]:
      for option in options:
            if option != None:
                aawait message.add_reaction(emoji)
#

i am certain there is prob a better way but i aint that advanced lmao

ember nest
#

Lol it's okay

#

Just wanna it work

errant coral
#

Anyone know what @application_checks.has_permissions(manage_messages=True) is but for cogs?

fallow mauve
#

I haven't coded in months, when my bit is ratelimited what do I send in the console, kill 1?

#

*bot

ember nest
#

It didn't worked all happend that it started to put reactions slowly but still 10 @slate swan

errant coral
#

he had 2 a on await

ember nest
#

Yes I made only 1 a

errant coral
#

what the error?

ember nest
#

No error but it still add all 10 number reactions

#

While I only putted 3 options

errant coral
#

is that the hole code or just one part of it?

merry sail
fallow mauve
#

No it just has a lot of code running 24/7

ember nest
errant coral
fallow mauve
#

Nothing's wrong or against tos, my bot has been around for a long time, never been abusing anything, just running 8 cog files and a ton of code in main.py all the time

#

@merry sail

primal token
ember nest
#

If u r good on slash commands I can show you full code if you can help me tho @errant coral

fallow mauve
merry sail
#

there's so many things that can cause rate limits when used improperly i don't even know where to begin

fallow mauve
primal token
#

Well, thats why lol

errant coral
fallow mauve
#

Why

primal token
errant coral
ember nest
primal token
#

Depends

errant coral
ember nest
#

Oh

primal token
#

what

errant coral
#

i used to code dpy but not now

fallow mauve
primal token
ember nest
fallow mauve
slate swan
#

hey im trying to make a drop down menu and i keep getting AttributeError: 'Interaction' object has no attribute 'disabled', dont know what i did wrong been doing this for the past 10 minutes

class selectm(View):

    @discord.ui.select(
        placeholder = "Select Category",
        options = [
            discord.SelectOption(label="Utility", value = "1", description = "Utility Commands", emoji="![icons_bulb](https://cdn.discordapp.com/emojis/1046135074640375888.webp?size=128 "icons_bulb")")
        ]
    )

    async def select_callback(self, select, interaction: discord.Interaction):
        select.disabled = True
        if select.values[0] == "1":
            await interaction.response.edit_message(embed=discord.Embed(
                description = "hi"
            ))

@bot.command()
async def help(ctx):
    view = selectm()
    await ctx.reply(mention_author=False, embed=discord.Embed(
        title = "Enemy Help Menu",
        description = "a rich discord bot designed at your needs.",
        color = color
    ).add_field(
        name = "Need Help?",
        value = "use the dropdown menu below to view all the commands."
    ).set_footer(
        text = "20 commands"
    ), view=view)```
primal token
slate swan
ember nest
primal token
errant coral
slate swan
ember nest
primal token
errant coral
#

or the one that use nextcord if they are same speed.

#

not sure

#

i think its less code for a nextcord command

fallow mauve
fallow mauve
ember nest
#

Anyway r u good on slash commands at dpy? @primal token so u can fix my problem

primal token
errant coral
fallow mauve
errant coral
ember nest
primal token
errant coral
primal token
slate swan
#

I host my bot off of my own device lol

slate swan
ember nest
fallow mauve
ember nest
slate swan
errant coral
primal token
sick birch
#

@ember nest can you paste your code

slate swan
ember nest
#

@sick birch

fallow mauve
slate swan
errant coral
#

ill send dm

ember nest
sick birch
#

send your code

ember nest
#
fields = [("Options", "\n".join([f"{numbers[idx]} {option}" for idx, option in enumerate(options) if option != None]), False),
                      ("Instructions", "React to cast a vote!", False)]
        
        
        for name, value, inline in fields:
            embed.add_field(name=name, value=value, inline=inline)
        
        message = await channel.send(embed=embed)
        
        
        for emoji in numbers[:len(options)]:
                    await message.add_reaction(emoji)
                
ember nest
slate swan
#

I'd argue buttons are usually superior to reactions for this type of thing

sick birch
#

or a select menu

ember nest
#

I am not that professional yet

#

Lmao

#

So how to make the reactions add same as the options that not None ? @sick birch

sick birch
#

Where do you define options

ember nest
#

Uh lemme send full code again then lol

sick birch
#

Yes please

#

So loop through each option in options using enumerate, and add that number to the reactions from numbers

ember nest
#

Yeah

sick birch
#

I'd also probably filter options so you can use it in both your list comp and here

#
filtered_options = filter(lambda x: x is not None, options)
...
fields = [for idx, option in enumerate(filtered_options)]
#

And the later on

for i, option in enumerate(filtered_options):
  await message.add_reaction(numbers[i])
ember nest
#

Oh

#

That's smart lol

sick birch
#

just a thought of course not 100% sure if it'll work

ember nest
#

Lemme try

pliant gulch
ember nest
#

Reactions didn't even add @sick birch

pliant gulch
#

Nice, ghostping

sick birch
sick birch
ember nest
#

Hmm?

#

I didn't understand tbh what's the difference

pliant gulch
#

And did you mean to make an empty list here? ```py
fields = [for idx, option in enumerate(filtered_options)]

#

Actually, wouldn't this be a SyntaxError

ember nest
#

Yall got me confused fr xD

#

@sick birch

#

@pliant gulch help please?

#

Bruh I got confused and yall gone lol

fading marlin
#

what's this supposed to do?

ember nest
#

Add reaction (numbers) to the same len(options) is not None

fading marlin
#

so if I've got 6 options, it should add 6 reactions from numbers 1-6?

ember nest
#

Yes

#

There is 10 options 2 is required and other 8 in None

#

option1: str, option2: str, option3: str = None, 3, 4, 5, ........

#

And numbers is 1๏ธโƒฃ 2๏ธโƒฃ 3๏ธโƒฃ etc

#

Emojes

fading marlin
#

why're you using filter?

ember nest
#

To get the options that is not None

fading marlin
#

can't you just directly check that in your list comp?

#

oh, no, nvm

#

is it sending the message? any errors?

ember nest
#

Send the message but doesn't add any reactions

ember nest
signal breach
#

Hello, I'm trying to authorize my bot (app) but it's not working. I click on authorize, but it does nothing (it doesn't come to the list of authorized bots), it just redirects me to the web. (ping me if you know what it might be)

slate swan
#

not sure if this is related to dpy. I am trying to run an asynchronous function outside by using asyncio but I am getting event loop errors. Is there a way to do this through dpy? only needs to be run once

slate swan
slate swan
#

hopefully that explains it

#

it runs inside my __init__ function

#

the db query is an asynchronous function cos of the library btw

#

just use the setup_hook

#

!d discord.Client.setup_hook

unkempt canyonBOT
#

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

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

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

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

Warning

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

this coro is triggered before the bot runs, only once in runtime

#

this will be ran while the bot is running tho

#

no, before it is running

#

sorry can you give me a use case, im a little confused

slate swan
slate swan
#

or is this discord related?

#

by adding the bot

signal breach
#

discord related

slate swan
#

try clearing your browser cache

signal breach
#

I try it in app discord and my friend try it too

cloud dawn
#

Most likely the wrong settings.

signal breach
#

what wrong settings?

#

can you specify?

cloud dawn
#

Don't know what you are doing.

signal breach
#

just app that get their name

cloud dawn
#

You can send images, could you show what permissions and scopes you selected?

signal breach
#

Isn't there a 24-hour limit?

cloud dawn
#

So only identify?

signal breach
#

yes

#

then I select redirect url

cloud dawn
#

But you also need bot for a bot application.

signal breach
#

and copy the link

cloud dawn
signal breach
#

wait a minute

cloud dawn
#

I can't read 25% of the error.

signal breach
#

Yes I have

#

I just created bot then I add random redirect then create url with identify and it dont work.

cloud dawn
#

What doesn't work? And what do you expect it to do?

signal breach
#

bot is not added to the list of authorized bots in settings

cloud dawn
signal breach
#

yes

#

Do you have any idea why its doesnt work

cloud dawn
#

How are you handling the redirect?

signal breach
#

I must?

cloud dawn
#

Since you need Oauth and process it.

#

Yeah you can't have an empty redirect.

signal breach
cloud dawn
#

That won't work.

signal breach
#

Can you show me explain?

cloud dawn
#

Well you need to use Oauth to handle the payload.

#

Why would you want identify if you aren't going to use it anyways?

signal breach
#

Im only trying something new to make

elfin glen
#

Nice, someone else is also making a bot with the ability to spam. I have a question for you - do you have some sort of โ€œ!deactivateโ€ command coded into your bot to stop the spamming? I donโ€™t want my bot to spam forever, but Iโ€™m struggling to code a counter feature for it.

cloud dawn
elfin glen
sick birch
sick birch
cloud dawn
#

Robin.. so innocent still..

sick birch
#

firThump just tryna look on the positive side

elfin glen
#

Even I was trying to make a raid bot, the while loop has a huge delay on it. It isnโ€™t a constant spam, the bot spits out like 4 messages and then pauses for 5 seconds.

sick birch
#

ok i changed my mind

#

yeah that is malicious

elfin glen
#

LMAO

sick birch
#

Put in place for exactly that reason

cloud dawn
#

For sure, I'd make the most overengineered raid bot there is.

sick birch
#

rate limits your mortal enemy

cloud dawn
#

Iterate over guild id's and invite urls.

#

It'd be a massacre.

sick birch
#

devious indeed

cloud dawn
#

hypothetically speaking of course.

#

I have no such intentions.

sick birch
#

no of course not

#

such a cute panda like you would never do something like that

primal token
#

๐Ÿคจ ๐Ÿ“ธ

elfin glen
cloud dawn
#

I did made an alt for Discord really quick to join a server and to my surprise if you join 4/6 servers in 10 minutes or so I already needed to verify a phone number since it thought I was self botting.

primal token
sick birch
#

one could easily stumble upon that just joining a few new servers

cloud dawn
#

Or dm'ing too many users.

#

Without 2fa it cuts of at 3 or 4

elfin glen
#

print(โ€œHello Worldโ€)

primal token
#

funny quotes

sick birch
#

found the mobile user

elfin glen
#

๐Ÿ’€๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ™๐Ÿ˜ญ๐Ÿ’€๐Ÿ’€๐Ÿ˜‚๐Ÿค”

cloud dawn
#

@sick birch Remember the time we had like 3/4 people a week asking how to set a mobile status for the bot using raw requests lol

sick birch
#

what goin on in ohio

primal token
#

๐Ÿ˜ญ

pliant gulch
#

You know you've seen it all when instead of grimacing when looking at raid bot you instead look at all the places you could make it more efficient

cloud dawn
#

My country fits 2 times in Ohio

primal token
#

๐Ÿ‘€

cloud dawn
#

Then you know you are a true coder.

elfin glen
cloud dawn
primal token
#

๐Ÿฆ–

pliant gulch
#

possible btw, tested when writing my discord API wrapper

ember nest
#

@sick birch

pliant gulch
#

Although deleting messages is funky

cinder tulip
ember nest
#

@pliant gulch please help bro

cloud dawn
#

Format your answer question before pinging.

ember nest
#
filtered_options = filter(lambda x: x, options)
        
        fields = [("Options", "\n".join([f"{numbers[idx]} {option}" for idx, option in enumerate(filtered_options)]), False),
                      ("Instructions", "React to cast a vote!", False)]
        
        
        for name, value, inline in fields:
            embed.add_field(name=name, value=value, inline=inline)
            
        message = await channel.send(embed=embed)
        
        for i, option in enumerate(filtered_options):
                await message.add_reaction(numbers[i])

The reactions are not showing

cloud dawn
#

Evolution ๐ŸคŒ

elfin glen
#

Wait if I hosted my bot to an online server, which would run it constantly (so it stays online). If I had sys.exit() in my code, and all the conditions were met to execute that, would it technically not even work? Because the code would just rerun and the bot would come back online

ember nest
#

There is up to 10 options

cloud dawn
#

Select menu with submit button is pretty clean.

sick birch
sick birch
ember nest
#

Idk how to do that though

#

I never watched a video or learned how to make buttons

#

That's why I am using reactions

cloud dawn
#

May be the reason I suck at coding.

#

;-;

ember nest
#

Lol

#

So can u just help me to fix this reaction not adding? @sick birch

cloud dawn
#

Robin is good with raw reaction payload.

#

He helped me once and provided bunch of code too.

sick birch
#

no wait dont make it worse

#

raw payloads are a pain to work with

ember nest
#

I just want to fix my code thats it's not showing reaction

cloud dawn
ember nest
#

And I will be done with this command

sick birch
#

See what it prints out

ember nest
#

Doesn't print anything I think lol

#

Or I used the command on a wrong line

sick birch
ember nest
#

Nothing at all

sick birch
#

wait nvm

#

that's odd it should at least print "filtered options"

ember nest
#

Lol

#

So how to fix the reactions?

sick birch
#

Unless whatever hosting provider you're using is consuming stdout for whatever reason

primal token
sick birch
#

sorry brain dont work

primal token
#

When does it ever

ember nest
sick birch
#

facts

primal token
#

๐Ÿฆฆ

ember nest
#

Bruh I don't know why I came to slash command this commad was working well as prefix command lmao

#

anyway so you don't know how to fix it? @sick birch

glad cradle
#

hi

sick birch
#

Might want to see if you can get that fixed

ember nest
#

Wdym

#

Actually I am just typing and doing codes on mobile but hosting it online on pc

ember nest
#

I just need this command be done before tomorrow

#

To use on my server

glad cradle
# ember nest

what's the problem here, are you getting an error?

ember nest
glad cradle
#

show numbers

#

I think that the problem are the emojis that you're using in numbers

ember nest
#

Nah it was working well before as prefix command

glad cradle
#

try to use unicode values

#

or discord emoji names

ember nest
ember nest
#
  • numbers showed on options
#

Dude it's been like 3-4 hours I am on this channel and none can fix it I give up I going to sleep lmao

glad cradle
#

how can someone help you if you delete all the code

ember nest
#

I kept sending the code for 3-4 hours none helped tho

ember nest
glad cradle
#

gn

slate swan
#

If anyone is good at discord bots can they dm me need small project done $โ‚ฌ$

unkempt canyonBOT
#

6. Do not post unapproved advertising.

9. Do not offer or ask for paid work of any kind.

slate swan
hard trail
#

Is it possible to program a discord bot that converts youtube urls into mp3s?

sick birch
lyric sandal
#

when using discordpy, the Message.add_reaction(...) method appears to be hanging forever?? Any help?

fading marlin
#

code? traceback?

lyric sandal
#

no traceback unfortunately...

fading marlin
#

ctx.send is a coroutine

lyric sandal
#

ok so i need to await that

#

but presumably that wont stop add_reaction from running

fading marlin
#

nope

lyric sandal
#

there is no output after this

#

after adding this print statement:

#

the reactions passed are these:

fading marlin
#

what is embed anyway?

lyric sandal
#

its a type of message

kindred jetty
#

hey guys

fading marlin
#

Embed doesn't have an add_reaction method

kindred jetty
#

the message probably does

#

embed is a type of message, not the message itself (is what I would think the issue is)

lyric sandal
#

ah sorry I then set embed to the value return from ctx.send

#

and i believe after that embed should have an add_reaction method

kindred jetty
#

anybody know how you can set a server for a discord bot so that you can make a developer channel?

#

im having trouble setting a support server in the dev portal because i cant figure out how

fading marlin
# lyric sandal

you should iterate through reactions.values, not just reactions, otherwise you're iterating through its keys

fading marlin
cinder tulip
fading marlin
#

"version" is missing a comma

cinder tulip
#

HOW DID I NOT EVEN NOTICE THAT

#

thanks bro, you just resolved 4 errors in once

lyric sandal
kindred jetty
#

what

#

when did they add this thing

fading marlin
fading marlin
kindred jetty
#

i just want to make a dev channel for a bot im working on

fading marlin
#

idk how that works, sorry

lyric sandal
short pulsar
#

!rule 1 2

unkempt canyonBOT
short pulsar
#

noice

cinder tulip
#

about this, i think it's because i have to import settings
but what i did was doing from python_settings import settings
right?
if that's the case then how do i import settings, cause i dont know what's the library that i would have to download

#

nvm i fixed

loud junco
#

just make a github repo and link it

slate swan
#

yea oracle cloud has insane free tier

mighty pilot
#

That's what I use

slate swan
#

i can't have a cc yet sadly

mighty pilot
#

Is there a way to pass the message itself into a view? I've got a tricky situation and I can't quite figure it out. A person sends a message (message) then the bot reacts await botchannel.send('I like pie', view=view(message))
This works to pass the original person's message into the view to pull stuff like guild and channels and whatnot. But I want to edit that message that's sent with botchannel.send with a new view. I've tried a few different things but can't get it to work

slate swan
#

view = View()
msg = await send()
view.message = msg

mighty pilot
#

That's just a thing by default? I can just view.message.edit(view=self) after disabling buttons?

slate swan
#

you could just interaction.response.edit_message as well

mighty pilot
#

It's not a response to an interaction though. The interaction is a message, which there's no response to because the message is sent in a different channel

mighty pilot
#

Alright I'll give that a try. Thanks

slate swan
#

you're basically just setting an attribute
depends on what you want it to be lol

#

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

orchid ledge
#
@bot.event
async def status_task():
    while True:
        await bot.change_presence(activity=discord.Game(name=f"mit {len(bot.users)} membern | /help"))
        await asyncio.sleep(30)

It does count only 0 member/s ...
Want my bot to count all members in all guilds.

#

cant find the error bc I dont get one xd

mighty pilot
#

Does it update after running for a while?

orchid ledge
#

nope

#

its not working at all

sick birch
orchid ledge
#

u mean intents.member=True? or in dev

mighty pilot
orchid ledge
#

did it

#

intents = discord.Intents.default() do I need to put the intents members in here ? bc I got it under it ๐Ÿ˜„

orchid ledge
sick birch
#

Is it enabled in your developer portal?

orchid ledge
#

Yes it is

sick birch
#

Also do you have a custom event you're dispatching?

orchid ledge
#

do I need intents.all() or .default() ?

sick birch
#

I don't remember status_task to be a discord.py event

orchid ledge
#

my mate got the same and it works with his sh

#

but he got .all

mighty pilot
#

Change it to all and make sure you have all 3 toggles flipped in dev portal

sick birch
orchid ledge
#

manually

#

na custo m

#

If I understand the question xd

sick birch
#

Can I see where you're dispatching the event?

orchid ledge
#

I dont get the question.

sick birch
#

So you must be calling it yourself somehow, I'm just wondering how you're doing that

orchid ledge
#

it works now I just had to change Intents.default to .all

#

can I make this invisible so no one sees it ? I want a anonymous text

mighty pilot
#

You want ephemeral=True for a message only that person can see? Or are you asking about just sending a message instead of a response

orchid ledge
#

wait Ill show everything

#

thats what it looks like and I want the "SyntaxAki....." to not be shown

sick birch
#

!d discord.InteractionResponse.defer

unkempt canyonBOT
#

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

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

This is only supported with the following interaction types...
mighty pilot
#

Or send an ephemeral message to avoid error followed by an interaction.channel.send

#

I do a lot of stuff across channels so I always prefer ephemeral stuff lol

orchid ledge
sick birch
orchid ledge
#
@bot.slash_command(name="beichten")
async def beichten(interaction: discord.Interaction, beichte: str):
    embed = discord.Embed(title=f" :mute: Beichte")
    embed.add_field(name=f"Beichte von {interaction.user}", value=beichte)
    await interaction.response.send_message(embed=embed)
    await defer(*, ephemeral=False, thinking=False)```
#

do not think I get smth atm its 4.27 am here rn

sick birch
#

You also need to flip the order

orchid ledge
#

huh

sick birch
#

Actually I take it back it wasn't good lol

#

First you should await interaction.defer()

#

Then you can send it like usual from interaction.channel.send

orchid ledge
#

-.-

#

wth did I miss the last one and a half years...

mighty pilot
#

Lots of fun new stuff like slash commands buttons and modals

orchid ledge
#

Ic.... so the "await interaction.defer()" need to be infront of the embed sh

mighty pilot
#

Just needs to be before the interaction.channel.send()

orchid ledge
#
@bot.slash_command(name="beichten")
async def beichten(interaction: discord.Interaction, beichte: str):
    embed = discord.Embed(title=f" :mute: Beichte")
    embed.add_field(name=f"Beichte von {interaction.user}", value=beichte)
    await interaction.defer()
    await interaction.channel.send(embed=embed)

So like that?

#

bc it doesnt work. No errors :]

#

need to eat some.

mighty pilot
orchid ledge
#

Thinking for a while then doesnโ€™t reply

mighty pilot
#

I'm not familiar with reading lines from a file, I'm sure someone here is

shrewd apex
#

use aiofiles and do readlines then use a for loop to make embeds add the lines in the desc if the content is huge split it up between multiple embeds

slate swan
#

google yo best friend and youtube

shrewd apex
#

sorry bit busy rn need to go have breakfast

#

just woke up pithink

slate swan
#

<insert hi Asher gif here>

maiden fable
#

Nice

orchid ledge
#

ah wait

#

na nvm doesnt work

half turret
#

when i try start my bot come this message

mighty pilot
orchid ledge
#

await interaction.defer(ephemeral = False, thinking = false) u mean like that?

mighty pilot
#

Yea but False, not false

orchid ledge
#

yeah yeah wait

#

still same problem and same error

orchid ledge
mighty pilot
#

Alright I give on the deferred message. Haven't done enough with it myself. Try this. Comment out that line and put in a await interaction.response.send('test', ephemeral = True) and see if that at least sends the embed under it how you want it to

orchid ledge
#

it does send on my old method too...
I just want to get rid of who used the command.
It should be a anonymous command thats my prob

#

I dont want others to see who used the command

#

@sick birch sorry for the tag, do u maybe know why?

mighty pilot
#

Show me what your code looks like now then. If it shows who used it then you have an interaction.response somewhere

orchid ledge
#
@bot.slash_command(name="beichten")
async def beichten(interaction: discord.Interaction, beichte: str):
    embed = discord.Embed(title=f" :mute: Beichte")
    embed.add_field(name=f"Beichte von {interaction.user}", value=beichte)
    await interaction.defer(ephemeral = False, thinking = False)
    await interaction.channel.send(embed=embed)
slate swan
#

why you defering for a simple command that sends a message

#

you can simply use interaction.response.send_message

mighty pilot
#

He doesn't want it to show the person who used the command

half turret
#

my bot canยดt start i have a error code but idk why

orchid ledge
slate swan
#

the defer response will still show who used the command, kinda against the cause?

orchid ledge
slate swan
#

set ephemeral to True in there

orchid ledge
#

and take the thinking = false out there?

slate swan
#

yep

orchid ledge
#

u made it work man, but its still thinking all the time

slate swan
#

an easier workaround will simply be ```py
await interaction.response.send_message("your message has been posted!", ephemeral=True)
await interaction.channel.send(...)

mighty pilot
#

Should only be in an ephemeral message though which you can dismiss

slate swan
#

solves all your issues

orchid ledge
#

ahhhh

mighty pilot
#

Deferring is weird. I don't like that lol

orchid ledge
#

gimme a sec

slate swan
#

same, but Discordโ„ข๏ธ

orchid ledge
#

bro ur the best, haha thank you ๐Ÿ™‚

mighty pilot
half turret
#

my bot canยดt start i have a error code but idk why has someone a idea

sick birch
# orchid ledge u made it work man, but its still thinking all the time

thinking (bool) โ€“ Indicates whether the deferred type should be InteractionResponseType.deferred_channel_message instead of the default InteractionResponseType.deferred_message_update if both are valid. In UI terms, this is represented as if the bot is thinking of a response. It is your responsibility to eventually send a followup message via Interaction.followup to make this thinking state go away. Application commands (AKA Slash commands) cannot use InteractionResponseType.deferred_message_update.

#

But yeah it looks like it's solved

orchid ledge
#

it is , thank you anyway hahah. Sorry for the mention again.

half turret
#

pycord

slate swan
sick birch
slate swan
#

uninstall discord.py / any other lib that uses discord namespace
and then install py-cord

sick birch
orchid ledge
half turret
slate swan
#

is bot a commands.Bot there, or discord.Bot?

half turret
#

commands.Bot

sick birch
half turret
#

i try this

#

i become a other error

slate swan
#

you have multiple versions of python installed

#

be specific to the version that has py-cord installed while running the code

half turret
#

i had 3.9 uninstalled and 3.10 installed

slate swan
#

type python in terminal and press tab, you'll know

sick birch
#

python --version too

shrewd apex
half turret
half turret
shrewd apex
#

u created a venv? or working on global

half turret
#

i created a new venv

slate swan
#

python -V basically shows tue version registered with python namespace
the tab will list all commands starting with python including all other versions too 3KSFdance

slate swan
half turret
#

?

shrewd apex
slate swan
#

!venv the command, and stop ?

unkempt canyonBOT
#
Virtual Environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
half turret
#

I didnยดt understand this ๐Ÿ™‚

#

Do I have to do this in the folder where the bot is inside or it doesn't matter

slate swan
#

you do that wherever your venv is located

half turret
#

i try this is doesnยดt work ๐Ÿ™‚

amber ether
#

Does anyone know how im getting this error? Please helpppp

#

just how the fu im so fkin g confused

somber sky
#

how do I make it where the link part has to start with "https://"

slate swan
somber sky
#

so the "link" part is a message variable, so I want it to only go through if the link starts with https://

slate swan
#

you could just use an if statement

#
if 'https://' in link:
    # do something
#

if it is in the link it'll return True

#

if it's not in the link it'll return False

flint isle
#

i want to create a task that changes the bots status between multiple pre programmed ones after a set amount of time. how exactly would i go about that

somber sky
slate swan
somber sky
#
@slash.slash(description='Start a pickup')
@commands.has_any_role('Captain')
async def pickups(ctx, host: discord.Member, type: discord.Message, link: discord.Message):
 
 channel = bot.get_channel(1046308765609230396)
 await channel.msg.send(f'**Link:**`{link}`\n**Type:** `{type}`\n**Host:** {host.mention}`{host}`\n\n <@&1044437889599156264>')

 if 'https://' in link:
   await channel.msg.send()

 else: 
   await channel.msg.delete()
   await ctx.send('Your link is not valid.')```
tepid radish
#

Hello, i have a question. I'm new in this thing. How to make slash command?

naive briar
#

Second message in the pins

tepid radish
#

Thanks

somber sky
#

what that mean, im new lol

slate swan
# somber sky ```py @slash.slash(description='Start a pickup') @commands.has_any_role('Captain...
@slash.slash(description='Start a pickup')
@commands.has_any_role('Captain')
async def pickups(ctx, host: discord.Member, type: discord.Message, link: discord.Message):
    if 'https://' in link: # it's in the link, so send the rest of the message
        channel = bot.get_channel(1046308765609230396)
        await channel.msg.send(f'**Link:**`{link}`\n**Type:** `{type}`\n**Host:** {host.mention}`{host}`\n\n <@&1044437889599156264>')
    
    else: # https:// was not in link
        await ctx.send('Your link is not valid.')
#

something like that I'd say

somber sky
somber sky
#

onjobject has no attribute to 'msg'

sick birch
#

It's just channel.send

slate swan
#

Yeah

somber sky
#

i just did await ctx.channel.send and it worked

slate swan
#

sweet

#

have fun

somber sky
#

thanks

#

thanks for the help

errant coral
#

Question do anyone know what the permission code is but when i code in cogs? ( i use nextcord)

somber sky
# slate swan sweet
@bot.event
async def on_command_error(ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    await ctx.send(f"{round(error.retry_after, 2)} seconds left")

@slash.slash(description='Start a pickup')
@commands.has_any_role('Captain')
@commands.cooldown(1, 600, commands.BucketType.user)
async def pickups(ctx, host: discord.Member, type: discord.Message, link: discord.Message):
    if 'https://' in link: # it's in the link, so send the rest of the message
        channel = bot.get_channel(1046308765609230396)
        await ctx.channel.send(f'**Link:** {link}\n**Type:** `{type}`\n**Host:** {host.mention} `{host}`\n\n <@&1044437889599156264>')
    
    else: # https:// was not in link
        await ctx.send('Your link is not valid.',hidden=True)```

sorry to bother, just wanna ask do you know why this doesn't work? The cooldown message doesn't send, the command works though its just the cooldown
#

the cooldown works, it just doesn't send the message saying theres one

somber sky
#

its supposed to send the cooldown time

slate swan
#

so for example, @mighty ledgeckups.error

somber sky
#

ohh

#

lol that was easy, sorry for wasting your time but thanks

amber ether
#

Uhmm guys? anyone have ideas

somber sky
#

why cant i install app commands

slate swan
slate swan
somber sky
#

what should i use then

slate swan
#

any of these are good

#

pretty cheap too, like $5 a month

slate swan
#

or library incompatibility

slate swan
naive briar
unkempt canyonBOT
#

@naive briar :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 9, in <module>
003 |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
004 |     return runner.run(main)
005 |            ^^^^^^^^^^^^^^^^
006 |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
007 |     return self._loop.run_until_complete(task)
008 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
009 |   File "/usr/local/lib/python3.11/asyncio/base_events.py", line 650, in run_until_complete
010 |     return future.result()
011 |            ^^^^^^^^^^^^^^^
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/kewewuyoco.txt?noredirect

naive briar
#

You can't await a tuple

#

And you should use asyncio.sleep instead of time.sleep

potent light
#

Is there a way to get the emoji string of the numbers on Discord? like 1๏ธโƒฃ 2๏ธโƒฃ etc.
I try \:one: but it doesn't work unlike \:smile: and others.

potent light
glad cradle
#

1๏ธโƒฃ

potent light
naive briar
#

One line code block

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

potent light
potent light
slate swan
#
:one: 
#

\1๏ธโƒฃ

#

:one:

#

1๏ธโƒฃ

#

\1๏ธโƒฃ

slate swan
#

1๏ธโƒฃ

#

Oh nvm

shrewd apex
#

1๏ธโƒฃ

bitter jewel
#

how to edit the bot answer from a slash command

#
    await inter.response.send_message("Connecting to ssh...")
    await inter.response.edit_message(":white_check_mark: Connected !")
#

tried like that but i dont think thats how it works

vocal snow
#

!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.
bitter jewel
#

!d discord.Message.edit

unkempt canyonBOT
#

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

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.11)") instead of `InvalidArgument`.
bitter jewel
#
async def login(inter):
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    await inter.response.send_message("Connecting to ssh...")
    await inter.response.edit_message(content = ":white_check_mark: Connected !")

error
Application Command raised an exception: InteractionResponded: This interaction has already been responded to before

#

how i gotta update the thing with this function... tell me someone please

naive briar
#

!d discord.Interaction.edit_original_response

unkempt canyonBOT
#

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

Edits the original interaction response message.

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

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

Bruh

potent spear
#

can you show me the whole command + how you call it?

slate swan
#

How it can be totally different?

potent spear
#

chances are, it's called something different OR you forgot to resync

slate swan
#

This code is not for this embed

bitter jewel
#

can anyone give me an example how i can use original_response and edit_original_response? i just dont get it

slate swan
#

It says new giveaway but as far as i see, i cant able to find the world "new giveaway"

wispy flare
#

not for this emb

slate swan
#

!d discord.Message.edit

unkempt canyonBOT
#

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

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

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

@bitter jewel here is the stuffs

#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

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

hash(x) Returns the messageโ€™s hash.
bitter jewel
#

Application Command raised an exception: AttributeError: 'ApplicationContext' object has no attribute 'original_response'

slate swan
#

Which Library bu r using?

bitter jewel
#

discord py

slate swan
#

Can u show ur code kindly?

bitter jewel
#
@client.slash_command()
async def login(inter):
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    await inter.response.send_message("Connecting to ssh...")
    msg = await inter.original_response()
    print(msg)
    ssh.connect(hostname=hostname, username=username, password=password, port=port)
    try:
        stdin, stdout, stderr = ssh.exec_command('ls')
        output = stdout.read()
        #await inter.response.send_message("[:white_check_mark:] Connected !")
    except:
        pass
        #await inter.response.send_message("[:x:] Failed !")

slate swan
bitter jewel
#
import discord, os, paramiko
from discord.ext import commands
from data import *
slate swan
#

Good

bitter jewel
#

how to remove that thing

slate swan
#

Wdym?

slate swan
bitter jewel
#

is any way to edit the original message on pycord?

slate swan
#

Idk lol

slate swan
#

!tag discord.Interaction

#

Ah

bitter jewel
slate swan
#

Wait

bitter jewel
#

i think there is

#

i gotta use followup

#

i just fucked it up

slate swan
#

Xd

bitter jewel
#

i removed discord after installing it

#
  File "D:\etc\devv\discord.py\bot.py", line 15, in <module>
    @client.slash_command()
AttributeError: 'Bot' object has no attribute 'slash_command'. Did you mean: 'add_command'?
PS D:\etc\devv\discord.py> ```
slate swan
bitter jewel
#

yes

slate swan
#

...

bitter jewel
#

then removed it

#

and not im getting this

slate swan
#

AHHHHHHH

#

U removed pycord??

bitter jewel
#

no

slate swan
#

Ohk

bitter jewel
#

fixed it...

slate swan
#

Oh good

bitter jewel
#

bcs the same name and i had to reinstall pycord

slate swan
#

Xd

bitter jewel
#

i was really thinking when i was looking at examples

slate swan
bitter jewel
#

why they do the things diff than me

slate swan
#

i have this error

bitter jewel
#

add intents

slate swan
#

in python

bitter jewel
#
intents = discord.Intents.default()
intents.message_content = True

client = commands.Bot(command_prefix=prefix, intents=intents)
#

i think that will work

#

u prolly gotta add intents on dev portal too