#discord-bots

1 messages · Page 774 of 1

slate swan
#

yep

#

@slate swan

slate swan
#

oh

#

how do i check what version is installed?

#

for disnake ?

#

disnake.__version__

#
>>> import disnake
>>> disnake.__version__
'2.2.1'```
#

looks good to me

#

Update to 2.3.0 maybe?

unkempt canyonBOT
#

disnake/abc.py lines 1370 to 1372

channel = await self._get_channel()
state = self._state
content = str(content) if content is not None else None```
slate swan
#

line 1372 in disnake's abc.Messageable.send

#

its different than yours

slate swan
#

@slate swan Hey uh about multiple Nones in the input

I remember now.

    async def addtrigger(self, ctx, trigger: str, title: str, description: str, color: discord.Color = None,
                         allowed_roles: commands.Greedy[discord.Role] = None,
                         channels: commands.Greedy[discord.TextChannel] = None):

Now that I think of it, you cant have more than 1 None right? Because how would it know which one is None.. How would I do this?

#

When I run it, if color is none the roles and channels might not be none

#

Idk how to explain it better

#

here , trigger , title , description and color become required args , the allowed_roles is optional and continues until it is able to convert roles

#

after that if its a channel , its fine , else an error would be raised

#

Right, so I cant have Roles as none but channels as certain channels right?

#

you can either have both None , or role exist but channel not

#

is this okay?

#

Cant I have role not exist but channel exist?

#

Is there an alternative way to do this?

#

role + channel : AxE_yes_tick
role : AxE_yes_tick
no role + no channel = AxE_yes_tick
no role + channel : Animated_Cross

tawdry perch
#

The syntax of hikari just seems weird

slate swan
#

Thanks

slate swan
#

also its around 2 times faster than generic dpy

#

Also, how do I save the discord.Color to my database since I get the error
InvalidDocument: cannot encode object: <Colour value=0>, of type: <class 'discord.colour.Colour'>

tawdry perch
#

what does it mean to be better typed?

slate swan
#

typehintings and other related things

tawdry perch
#

hmm

slate swan
#

!d discord.ext.commands.Context.bot

unkempt canyonBOT
slate swan
#

this says it returns the bot object , but the return type isnt even typehinted

#

is typehinted as BotT instead

#

another things which makes hikari different from others is full/most acess to the cache and its settings

tawdry perch
#

luckily I don't understand anything about the cache

slate swan
#

unluckily dpy is a library highly dependent over cache

grim oar
slate swan
#

i noticed it later ^

grim oar
#

that's not it's use case either tho ¯\_(ツ)_/¯

slate swan
#

its actually defined in the __init__ of context object , excpected it to be a property function

#

still get this after updating

grim oar
#

why a property

slate swan
grim oar
#

:loading:

slate swan
#

edits

grim oar
#

But why tho, that's a design "limitation" (Which it clearly ain't), but how will you get access to your Bot object instead of creating new one

slate swan
slate swan
grim oar
#

context.bot in events? sure py_guido

slate swan
#

mehh i have a single events cog

#

youre' making a discord.Embed in disnake

#

change discord to disnake

#

ohh

hoary cargo
#

Why you have both disnake and discord in the same file yaesmug
If you really want to use the discord name just import disnake as discord

grim oar
#

Shiki ryougiiiiii

slate swan
#

@slate swan thanks!!!!

hoary cargo
grim oar
#

😳

slate swan
#

lol

hoary cargo
grim oar
#

Best waifu

pine crown
#

how to create url button? can i have the code(for disnake)

slate swan
#

again

hoary cargo
slate swan
#

i literally wrote it for you

slate swan
#

understand ¯_(ツ)_/¯

hoary cargo
slate swan
#

its wrong.

#

they used url kwarg , but not the style kwarg , so it raises an error

pine crown
slate swan
#

!d disnake.ui.button it is

#

¯_(ツ)_/¯

pine crown
#

mens

slate swan
#

use a Button

slate swan
slate swan
unkempt canyonBOT
#

examples/views/button/link.py line 28

self.add_item(disnake.ui.Button(label="Click Here", url=url))```
pine crown
#

ok

slate swan
#

this is wrong too

#

its Button ;-;

hoary cargo
pine crown
slate swan
slate swan
#

but in the examples they didnt provide it

slate swan
grim oar
slate swan
#

My My, I want to ask something now

#

welp

#

whats the difference between a url button and a normal button, lmao

hoary cargo
#

Url buttons can have urls
Normal ones no as far as I know

slate swan
#

and cannot have a callback as well :3

hoary cargo
#

Imagine how dumb would be to have interaction error to a link

slate swan
#

what if I add a fishy link

slate swan
#
slate swan
hoary cargo
#

Many people don't even read the link

#

How do you think so many getting scammed with free nitro

slate swan
slate swan
slate swan
slate swan
#

and popouts have buttons

#

atleast they didnt try to "install discord mod apk with nitro"

hoary cargo
slate swan
#

something close enough is bluecord

#

cof cof

#

!ot

#

but we dont talk about it here

#

ok so now im done with saving data about reaction roles , time for the events

pine crown
pine crown
slate swan
#

yes or an one liner instance

pine crown
slate swan
#

no

pine crown
#

ok

slate swan
#

the button variable is already a button

pine crown
#

ok

hoary cargo
#

You can use the init and super for kwargs

slate swan
#

😔 and again , i said dont copy paste it
gonna ruin u

pine crown
#

ok

slate swan
#

just ```py
view = disnake.ui.View()
view.add_item(button)
await send(... , view=view)

pine crown
#

so dont need class?

slate swan
#

no

#

i want a ticket bot

pine crown
hoary cargo
# slate swan no

but it's kinda recommended to do so, and you can use the button on all commands you make

#

you just need to button = ClassName("Button name", "optional emoji") and that's it

slate swan
hoary cargo
#

you can have button classes and do the callback inside the command peeposhrug quite convenient because you can tie embeds to buttons without any problem

slate swan
#

very true

#

i like having a subclass for buttons tbh better handling

slate swan
#

yo momma did

odd walrus
#

is there a way where i can make my command to have an alias

quick gust
#

yes

slate swan
#

use the aliases=[] kwarg in commands decorator

odd walrus
#

@client.command()
async def pay(ctx, price: int):

like i wanna do !pay and !pay2 it would use the same command

slate swan
#

which takes a list as you can see

odd walrus
#

hmm so i just do

@client.command(aliases=['pay2'])
async def pay(ctx, price: int):

quick gust
#

@client.command(aliases=["alias1", "alias2"])

odd walrus
#

aight lemme try

slate swan
slate swan
unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
slate swan
#

slow poke

odd walrus
#

oh godd damn i did try that earlier and didnt work so i came again

quick gust
odd walrus
#

good spelling

odd walrus
quick gust
#

lmao

slate swan
#

Ashley youre slower then ||never gonna give you up||

odd walrus
#

thanks

quick gust
#

Ashley is like okimii 2.0

slate swan
#

im better

quick gust
#

agreed

slate swan
#

im smorter🚶

#

aka braindeadpithink

slate swan
slate swan
#

jk

#

is there a way to delete the command msg sent by user after the command has finished

slate swan
unkempt canyonBOT
unkempt canyonBOT
#

Hey @hidden hazel!

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

slate swan
#

!d discord.Message.delete

unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
slate swan
#

look above

#

delete is a coro for a msg object

slate swan
quick gust
#

yes

slate swan
#

yes its a coro

quick gust
#

it is a coroutine

slate swan
#

look what i sent😔

slate swan
#

dont ignore😔

#

amen

slate swan
quick gust
slate swan
slate swan
#

their is no context

slate swan
quick gust
#

await interaction.message.delete in that case I think? idk about interactions much lol

slate swan
#

in a interaction

#

its an interaction-

#

the heck are you doing? interaction with a command?

#

huh

#

argument namingpithink

#

huh? pithink

quick gust
#

application command interaction

#

tf is that

slate swan
quick gust
#

im so outdated with these new interactions lmao

slate swan
#

there all ez

#

i~

quick gust
slate swan
#

dont remember any of them

tawdry perch
#

Too bored to learn interactions

slate swan
#

🚶

quick gust
slate swan
slate swan
#

what did i do wrong

#

why would it work

slate swan
slate swan
#

your command doesnt make sense

#

why

#

a command takes context

#

not interaction

#

just you not me

#

im to smort for that

slate swan
#

the ss you sent

slate swan
# slate swan

use context only and make msg a kwarg so it will eat all text

#

theirs limits which are pinned btw

#

youre doing something wrong

#

any error

#

show the embed

#

your embeds just dont like you, cry about it

slate swan
#

pithink stop, both of you

#

no need for return btw

#

and make the second if an elif

#

no need for it

#

then why return?

#

fix it😤

#

and you can use return to send a msg btw

slate swan
slate swan
#

maybe you edited the desc?

#

its really long ngl maybe it succeeds the limit

#

smartest piece of code

#

argument naming

#

and why have

return
print("")

if you can save a line

#
return print("")
slate swan
slate swan
#

?

slate swan
#

😭

#
return print```
If different from  ```py
return 
print
#

pithink you have a life, woah

#

Just saying

slate swan
#

smort

#

pithink the world would be a mess otherwise

slate swan
#

🫂 aw c'mere, have a hug

#

:)

#

ashley the mental support thank you

#

🫂

slate swan
#

I'll be your soda uwu
anyways
ot

#

you get hug no soda🫂

slate swan
#

lol

#

ill be there for you <3

#

no👁️ 👁️

#

!ot

unkempt canyonBOT
slate swan
#

let me think harder

#

||never gonna give you up||

#

whats your problem actually?

#

wait

#

why the heck are you using sqlite????

#

sqlite isnt async

slate swan
#

!pypi aiosqlite

unkempt canyonBOT
slate swan
#

use this

slate swan
slate swan
#

lol

slate swan
#

kermit_sed i mean , your issue please?

#

prob

#

its probably blocking

slate swan
#

then stop talking

#

🧠

slate swan
slate swan
#

gtg to school bye guysyert

slate swan
slate swan
slate swan
#

thank you guys!

#

oh and its okimii's birthday too 😳

#

!ot

unkempt canyonBOT
slate swan
#

mehh ill rather stay here

#

happy birthday though!

slate swan
#

.topic

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

pine crown
slate swan
#

so far done with only a check lol

pine crown
slate swan
pine crown
#

no

slate swan
#

I did

pine crown
#

pls

slate swan
#

okay sorry

pine crown
#

do i need class

slate swan
#

no

pine crown
#

ok

slate swan
#

so weird

#

you need a class , but you wont make it.

#

¯_(ツ)_/¯

#

anything in python is a class

pine crown
#

ok

slate swan
#

anyways, good luck, bye

slate swan
# slate swan no?

what else do you think the statement "python is an object oriented language" means

tough lance
#

Hi I'm getting this error when using a proxy in discord.Client

Cannot connect to host discord.com:443 ssl:default [The parameter is incorrect] 
#
client = discord.Client(proxy=proxy_url, proxy_auth=aiohttp.BasicAuth("login", "pass")) 
pine crown
# slate swan anything in python is a class
@client.command()
async def BotInfo(ctx):
    view = disnake.ui.View()
    button = disnake.Button(style=disnake.ButtonStyle.url,label="Invite Bot",url="https://google.com")
    view.add_item(button)
    await ctx.send("ho", view=view)

its?

pine crown
#

ok

#

its like

#

its like an eror

finite crypt
#

Hello everyone, who can merge the code for me to create temporary voice channels, the lobby system is like on faceit

#

Please send codes

pine crown
#

wat

lament mesa
pine crown
pine crown
#

ok

slate swan
#

not disnake.Button

slate swan
lament mesa
#

no, but classes are objects

finite crypt
#

👆

#

@pine crown

hoary cargo
#

Wtf

slate swan
slate swan
slate swan
#

rule 9 , sir

finite crypt
slate swan
slate swan
#

whats the issue though?

slate swan
slate swan
#

🫂

#

ok i now need to make a jump_url

slate swan
slate swan
#

and im using hik~

slate swan
dense dawn
#

hey i have a quick question pls

slate swan
dense dawn
#

could i return a global variable ?

unkempt canyonBOT
#

disnake/message.py lines 604 to 611

@property
def jump_url(self) -> str:
    """:class:`​str`​: Returns a URL that allows the client to jump to the referenced message.

    .. versionadded:: 1.7
    """
    guild_id = self.guild_id if self.guild_id is not None else "@me"
    return f"https://discord.com/channels/{guild_id}/{self.channel_id}/{self.message_id}"```
slate swan
#

i need to make this manually

#

oh

dense dawn
#

aight ty

slate swan
#

thats it , lol

pine crown
#
@client.command()
async def BotInfo(ctx):
    view = disnake.ui.View()
    embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
    button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="censored")
    view.add_item(button)
    await ctx.send(embed=embed, view=view)

how to make more button

slate swan
pine crown
#

no

slate swan
pine crown
#

ok

slate swan
#

yes

#

thats exactly what ashley said , but without the code

#

i see how it is

pine crown
#

no

#

pls

slate swan
#

anyways, who cares

#

idts , but shore

#

uhuh

#

if i type
*embed hey there
it makes it two args, 1= hey,2=there (edited)
[5:01 PM]
how do i make it one arg but have space

#
async def embed(ctx , * , text)```
#

or , use your command like *embed "i can have as many text i want" wrapped inside the "s

pine crown
#

f

kindred drum
#

yo

#

is it possible to listen for a reaction event inside of a command?

slate swan
#

yessir

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
kindred drum
#

wait_for?

#

how would I use it?

slate swan
#

yep!

kindred drum
#

wait_for(on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):?

slate swan
#
payload = await bot.wait_for('raw_reaction_add')
kindred drum
#

this doesn't seem fun

slate swan
#

where payload would be discord.RawReactionActionEvent object

slate swan
#

you can have check and timeout inside wait for too

kindred drum
#

payload = await bot.wait_for('raw_reaction_add')
if payload.emoji == "⚡":
print("hello")

#

how would something like that work

#

also I just realised this won't work so I need to do the start way since it time sout

cosmic mantle
#

hi i am trying to make bot add element to a list in the main code but it doesnt work

#
@bot.command()
async def add(ctx,id):
    global list1
    list1.append(id)
    await ctx.send("done")
    ```
quasi stag
#

how do i make an argument optional?

slim ibex
#

Or use Optional from typing

#

prolly the best option

quasi stag
#

okay

slim ibex
#

Optional[arg] @quasi stag

kindred drum
#

why does this not trigger py @commands.Cog.listener() async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent): if payload.member.bot: print("hello") return else: channel = bot.get_channel(935100681629601802) await channel.send("hello") if str(payload.emoji) == "⚡": print("hello") 😭

slim ibex
#

If you are type hinting args it would look like:

arg: Optional[T]

slate swan
#

is it possible to give boosters more entries in a giveaway ?

#

yea sure , check if member has the booster role...

kindred drum
#

if user has role booster:
entries = 10

#

the logic 🧬

slate swan
#

!d discord.Guild.premium_subscribers

unkempt canyonBOT
slate swan
#

so you can check if the member is in the list or not

kindred drum
cosmic mantle
#
@bot.command()
async def add(ctx,id):
    global list1
    list1.append(id)
    await ctx.send("done")
    ```

it doesnt add the word when i type the command why??
slate swan
slate swan
kindred drum
slate swan
slate swan
unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

slim ibex
slate swan
#

so i can check for every member that enters the givaway

#

yea!

kindred drum
slate swan
#

if i were you , id multiply the number of booster's entries , so there are more chances of them being returned on random.choice

slate swan
#

/removed

kindred drum
#

nope, I have multiple of these events

#

bro I hate the reaction thing, it like limits how many times you can check

#

for a thing

#

wiat

#

I just solved the problem smh

misty ridge
dense dawn
#

code block

#

and add py

#

cant help u more im using a plugin for that

cosmic mantle
#

but it doesnt work

cosmic mantle
misty ridge
#

so it automatically make it like a .py format?

dense dawn
cosmic mantle
#

yea

cosmic mantle
#

i dont know lol

slim ibex
#

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

dense dawn
#

for example im using the french layout azerty and we dont have it

final iron
#

@cosmic mantle

cosmic mantle
slate swan
#

Imagine global varibales that dont even exist

final iron
slim ibex
#

thats what im saying

slim ibex
#

💀

#

maybe im ignored in thss channel but not others

slate swan
unkempt canyonBOT
slim ibex
#

🙃

slate swan
#

Lmao

tough lance
# final iron Can we see the full code?
import discord

client=discord.Client(proxy=proxy, proxy_auth=aiohttp.BasicAuth('login', 'pass'))

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

client.run(token)
#

Just that

slate swan
#

Client eww

slim ibex
#

lmao

tough lance
#

I don't need Bot for this so yh

slate swan
#

Uh?

slate swan
#

with the code pithink

tough lance
#
Cannot connect to host discord.com:443 ssl:default [The parameter is incorrect]   
slate swan
#

!d discord.Message.mentions

tough lance
#

No

#

Windows

slate swan
#

people ask for smth and delete their msg wtf

misty ridge
#

sry

#

i was going to put my script

#

and forgot

final iron
#

he forgor

kindred drum
#
@commands.Cog.listener()
    async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
        if payload.member.bot:
            return
        
        if str(payload.emoji) == "⚡":
            channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
            await channel.purge(limit=1)
            casinoMessageReaction = discord.Embed(title = "SLOTS", description = "These are the current selected slots", color = discord.Color.blurple())
            casinoMessageReaction.add_field(name = "Selection", value = "Please select the slots you want to roll from (click on the emojis)", inline=False)
            casinoMessageReaction.add_field(name = "BLACKLISTED SLOTS", value = "", inline=False)
            b = '\n'.join(map(str, Blacklisted))
            embed_dict = casinoMessageReaction.to_dict()
            for field in embed_dict["fields"]:
                if field["name"] == "BLACKLISTED SLOTS":
                    field["value"] += str(b)
            casinoMessageReaction.add_field(name = "Gates of Olympus", value = "⚡", inline=False)
            casinoMessageReaction.set_thumbnail(url="https://i.imgur.com/7xDaaTf.png")
            casinoMessageReaction.set_footer(text=f'Cosmic Overground',icon_url="https://i.imgur.com/7xDaaTf.png")
            casinoMessageReaction.timestamp = datetime.datetime.utcnow()
            await channel.send(embed=casinoMessageReaction)
            started1 = True
        if str(payload.emoji) == "🍀":
            casinoMessageReaction.add_field(name = "Leprechuan goes WILD", value = "🍀")
            await channel.purge(limit=1)
            await channel.send(embed=casinoMessageReaction)``` Anyone got any ideas on how I can edit/change the embed when the clover is reacted to?
#

the zap has to be reacted to tho

final iron
kindred drum
#

💀

tough lance
#

Camel case 💀

slate swan
final iron
#

Why do people use camel case with python

nimble plume
#

How to get bot currently connected voice channel name

final iron
#

Snake case is so much easier to write and read

tough lance
final iron
#

I think that's how

slate swan
tough lance
unkempt canyonBOT
#
Not in a million years.

No documentation found for the requested symbol.

final iron
#

Wait

tough lance
#

!d discord.ext.commands.Context.voice_client

unkempt canyonBOT
#

property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
final iron
#

!d discord.VoiceClient

slate swan
#

spam

tough lance
#

ctx.voice_client is best

final iron
#

Aha

#

!d discord.VoiceClient.channel

unkempt canyonBOT
final iron
#

That's how

nimble plume
#

I didnt understand

#

Just give the variable

final iron
nimble plume
#

Cant find

#

Ok got it

final iron
#

The dpy doc's are fine

nimble plume
#

Lemee test

final iron
#

You just need to know how to read them

nimble plume
#

Idk how toread them

#

Its not begginer friendly

final iron
#

Discord.py is not supposed to be a beginner project

nimble plume
#

Yup im doi g that

nimble plume
final iron
#

If you're a beginner there are probably a lot of bad practices implemented

slate swan
#

is there a function for like embedded messages

pine crown
#

how to make slash commands with disnake? can i have a exmaple cuz when i make sl;ash commands with disnake its like a error and like im gettinbg

#

mad

nimble plume
#

Attribute error voice client gas no attribute channel

nimble plume
pine crown
final iron
nimble plume
#

Botchannel = discord.Voice.Client.channel

final iron
#

Well no

nimble plume
#

..

pine crown
nimble plume
#

Then

nimble plume
pine crown
# final iron Okay but what's the error

@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
    view = disnake.ui.View()
    embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
    button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="e")
    button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="🌐 Website",url="e")
    view.add_item(button)
    view.add_item(button2)
    await ctx.send(embed=embed, view=view)

this is code but when i run the command it sya application not respond

final iron
final iron
#

Oh, wrong reply

nimble plume
#

It need a class

#

!!!

final iron
#

Slash commands?

nimble plume
#

Wrong reply???

nimble plume
#

Help me

#

Walter help

final iron
#

Not too experienced with voice channels I'm afraid

nimble plume
#

;-;

#

Afraid of what

pine crown
#
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(inter):
    view = disnake.ui.View()
    embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
    button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="e")
    button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="🌐 Website",url="e")
    view.add_item(button)
    view.add_item(button2)
    await inter.respose.send_message(embed=embed, view=view)

not work stil

nimble plume
#

Anyon else how to get current voice channel name bot connected too

visual island
pine crown
pine crown
pine crown
dreamy sluice
#

Anyone know how to setup a discord bot with heroku?

#

(I am trying to load it into a GitHub repository and then use that in heroku for context)

cloud dawn
#

You mean convert numbers to scientific notations?

pine crown
#

wait how

#

did the link

#

get thru

honest vessel
#

from disnake.ext import menus ImportError: cannot import name 'menus' from 'disnake.ext' (unknown location)

#

??

slate swan
#

¯_(ツ)_/¯

final iron
#

!d disnake.ui.Select

unkempt canyonBOT
#

class disnake.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.

This is usually represented as a drop down menu.

In order to get the selected items that the user has chosen, use [`Select.values`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Select.values "disnake.ui.Select.values").

New in version 2.0.
nimble plume
#

Pls help none helping me

placid skiff
#

what do you need?

slate swan
#

easy, read the error

#

¯_(ツ)_/¯

misty ridge
#

how do i make my bot tag a user that have been tagged by another user

if msg.startswith("!hug"):
    hugimgs =[
      'https://i.imgur.com/cyyH17s.gif',
      'https://i.imgur.com/Z6F1giB.gif',
      'https://i.imgur.com/CW8GEF1.gif',
      'https://c.tenor.com/OXCV_qL-V60AAAAC/mochi-peachcat-mochi.gif',
      'https://c.tenor.com/CnTxN4UrdysAAAAM/boo-hug.gif'
      'https://c.tenor.com/4ZKqZ_F2N18AAAAM/running-hug.gif'
    ]
    hugs = random.choice(hugimgs)
    x1 = str(message.content).split()[1]
    embedMessage = discord.Embed( title=f" {username.split('#')[0]}  hugged {x1} 💓", color=0x6166B7)
    embedMessage.set_image(url=hugs)
    await message.channel.send(embed=embedMessage)

from this code if some one do "!hug @shy mica"
the output from the bot will be an Embeded Message
but the Embeded Message title will be "Alief Hugged <@andbunchof numbers>"
how do i make my bot do "Alief Hugged @shy mica" instead of the user id

final iron
misty ridge
nimble plume
#

How to get voice channel name

final iron
slate swan
nimble plume
#

Its connected if

slate swan
nimble plume
#

Ok now i understand

final iron
slate swan
#

You're saying something else while your error says something else ¯_(ツ)_/¯

final iron
#

!d discord.VoiceClient.channel

unkempt canyonBOT
nimble plume
#

Now i understand

slate swan
#

¯_(ツ)_/¯

nimble plume
#

¯\_(ツ)_/¯

pine crown
#
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
    view = disnake.ui.View()
    embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
    button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="e")
    button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="🌐 Website",url="e")
    view.add_item(button)
    view.add_item(button2)
    await ctx.send(embed=embed, view=view)

why does this say application didnt responed

slate swan
#

Imagine if people actually tried solving their problems by reading the errors cries

slate swan
#

ig I cant, sorry

nimble plume
#

I cant understand the error mainly

misty ridge
slate swan
nimble plume
#

Can i use ctx.me.voice.channel instead

final iron
#

Perhaps

#

Try to

nimble plume
#

I want it to smh

slate swan
#

is that even a thing?

nimble plume
#

Already connected to the channel

#

Smh

slate swan
nimble plume
#

I want to add some try except if else ...

#

Have to**

slate swan
nimble plume
#

Yup i have to change all ;-;

#

I have been doing since 4 houra

#

Im thinking to do tmrw

brazen raft
#

If it is a fork, there shouldn't be a lot different, only added.

slate swan
#

discord.py is discontinued, while disnake is the forked version of dpy and is maintained

nimble plume
#

Means it gives a bollean true or false

#

..

#

It would be easier

slate swan
nimble plume
slate swan
#

!d discord.VoiceClient.is_connected

unkempt canyonBOT
nimble plume
#

that return a bollean

slate swan
#

cof cof

#

ping me if you need smth

honest vessel
#

@final ironah thanks

sage otter
slim ibex
#

new data type

tender lily
#

Hello

#

Can anyone tell me how can I add more than one channel id

sage otter
#

To what.

tender lily
#
chan= bot.get_channel(678048899893821444)

Can anyone tell me how can I add more than one channel id in brackets

sage otter
#

You don’t

#

You have to get each channel separately

tender lily
#

No other way to add more than one channel id

slate swan
#

i have a user's username , how to get their roles?

devout iris
#

can i add a general error message, if i want to send error i just need to return error message. Can i make this?

leaden jasper
#

How to upload images to an embed

#

because you can only do set_image(url='')

#

would the url be file:// or

#

that wouldnt work?

devout iris
#
@command.error()
async def error(ctx, error):
....
#

should be like that?

devout iris
# velvet tinsel yes

so for example i have a "reboot" command and if i want to show error message,

@reboot.error
return error

should be like that?

devout iris
#

why

velvet tinsel
#

decorators are for functions pithink

#

maybe like

@reboot.error
async def error_oh_no(ctx, error):
   if isinstance(error, commands.IDontKnowPutSomeRandomErrorHere):
     # do shit
devout iris
velvet tinsel
misty ridge
devout iris
dense swallow
#

can a bot edit it's own role?

#

does it have that perms?

pine crown
#
class MyButton(disnake.ui.View):
  def __init__(self):
    super().__init__()
    button = disnake.ui.Button(label='Click Me', style=disnake.ButtonStyle.url, url='https://discord.com')
    self.add_item(button)


@client.slash_command(description="Shows Bot Info.")
async def BotInfo(inter: AppCmdInter):
  embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
  button = MyButton()
  await inter.send(embed=embed, view=button)

why does thi not work

unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

dense swallow
#

!d discord.on_error

unkempt canyonBOT
#

discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is printed to stderr and the exception is ignored. If you want to change this behaviour and handle the exception for whatever reason yourself, this event can be overridden. Which, when done, will suppress the default action of printing the traceback.

The information of the exception raised and the exception itself can be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.9)").

If you want exception to propagate out of the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") class you can define an `on_error` handler consisting of a single empty [raise statement](https://docs.python.org/3/reference/simple_stmts.html#raise "(in Python v3.9)"). Exceptions raised by `on_error` will not be handled in any way by [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
peak loom
dense swallow
#

does anyone know?

placid skiff
#

If he has the permissions to do that yes

#

usually only if he is administrator

quick gust
#

you can try it and see

boreal ravine
#

the intergrated one?

dense swallow
hoary cargo
vale wing
slate swan
unkempt canyonBOT
#

property self_role: Optional[discord.role.Role]```
Gets the role associated with this client’s user, if any.

New in version 1.6.
slate swan
#

and use .edit

boreal ravine
slate swan
vale wing
#

Better to implement one

#

Nvm didn't see it

slate swan
#

ah oki

dense swallow
hoary cargo
#

it is

boreal ravine
#

ok

vale wing
slate swan
unkempt canyonBOT
#

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

Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").

If the interaction hasn’t been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").

Note

This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.ApplicationCommandInteraction.original_message "disnake.ApplicationCommandInteraction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if you’re sending a followup message.
rose ledge
#

Sorry, what is a “token”? I’m from c++ background knowledge.

boreal ravine
#

bot token

vale wing
#

The one you get on developer portal

rose ledge
#

Okey

boreal ravine
#

instead of none

boreal ravine
slate swan
unkempt canyonBOT
#

class disnake.ui.ActionRow(*items)```
Represents a UI action row. Useful for lower level component manipulation.

New in version 2.4.
slate swan
#

and ui.View for view

boreal ravine
#

what are action rows

slate swan
#

similar to views , but less complex

kindred drum
#

yo anyone got an idea on how this should work, When someone reacts it should deleted the embed and send a new one with the slot name/symbol of the one they have choosen

kindred drum
#

buttons?

final iron
#

Mhm

#

!d discord.ui.button

unkempt canyonBOT
#

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

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

Note

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

bruh

final iron
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Examples

Deleting bot’s messages...
final iron
#

@slate swan

slate swan
#

ty

#

@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
        await ctx.channel.purge(limit=limit, bulk=True)
        await ctx.send('tbh Purged by {}'.format(ctx.author.mention))
        await ctx.message.delete()
#

can someone help me that does not work

#

it says 404 not found

#

idk why

quaint scaffold
#

You are trying to delete an already deleted message

#

Simple debugging could have solved this issue

zealous dagger
#

Ok

slate swan
#

oh

zealous dagger
#
  File "main.py", line 6, in <module>
    ADS.run("TOKEN")
TypeError: run() takes 1 positional argument but 2 were given```
#

I don't know why

#

This is happening

#

Please help

#

@quaint scaffold I think you can help

burnt sedge
#

ADS.run(f"{TOKEN}")

zealous dagger
forest beacon
#

What database should I use for discord bot? I need to save guild id and a channel id

zealous dagger
#

It works fine

forest beacon
#

Thanks.

quick gust
keen talon
#

Your choice really

zealous dagger
#

OK

slate swan
zealous dagger
slate swan
zealous dagger
#

Ok

#

once can you try

slate swan
#

i legit just did await ctx.channel.purge(limit = amount + 1) and that’s it

quick gust
zealous dagger
#

then it will delete

#

that

#

@slate swan

zealous dagger
#

I think it will work

slate swan
#

@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount : int):
    if amount > 999:
        amount = 1000
    await ctx.channel.purge(limit= amount + 1)
```there
#

kk

quick gust
#

same error?

slate swan
#

no

quick gust
#

show the error then...

slate swan
#

kk

cloud dawn
#

One error at a time please.

slate swan
#

hmm

slate swan
obsidian ledge
#

how do u make a thing where if u press a button and it tells how many times ive pressed it

slate swan
#

idk

zealous dagger
#
@client.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
        await ctx.channel.purge(limit=limit, bulk=True)
        msg = await ctx.send('tbh Purged by {}'.format(ctx.author.mention))
        await msg.delete()
#

Here you go this code

slate swan
#

kk lemme try that

zealous dagger
slate swan
#

kk

zealous dagger
#

If you want to delete after a

#

selected time period

#

you can use this

#

Code

slate swan
#

kk ty

zealous dagger
#
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
        await ctx.channel.purge(limit=limit, bulk=True)
        await ctx.send('tbh Purged by {}'.format(ctx.author.mention),delete_after=5)
zealous dagger
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.

slate swan
zealous dagger
#

Use this

#

This will work for you

slate swan
#

kk

zealous dagger
#
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
        await ctx.channel.purge(limit=limit, bulk=True)
        await ctx.send('tbh Purged by {}'.format(ctx.author.mention),delete_after=5)
slate swan
#

No offense

#

how

zealous dagger
slate swan
cold sonnet
zealous dagger
#

OK

#

@slate swan thanks for telling

slate swan
#

bruh still doesn’t work @zealous dagger

zealous dagger
cold sonnet
#

you can make a say command be against discord's ToS cuz the whole server can spam it

#

🧠

slate swan
zealous dagger
#

the

#

chat icon is hiding the

zealous dagger
slate swan
#

error

#

it’s the same error

#

as before

zealous dagger
#
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
    await ctx.channel.purge(limit=limit, bulk=True)
    await ctx.send('tbh Purged by {}'.format(ctx.author.mention),delete_after=5)
``` Here you go fixed indentation issues
cold sonnet
#

what's bulk

zealous dagger
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Examples

Deleting bot’s messages...
slate swan
#

bruh idk why it still doesn’t work

cold sonnet
#

oh it's set to true by default

zealous dagger
#

that u

#

are defining while using

cold sonnet
#

please send the whole command

#

I assume you didn't

slate swan
#

wait 2 sec

zealous dagger
#

With the name of variable you are defining

cold sonnet
#

and I can't get the error out of your context

zealous dagger
#

for the bot or the client

zealous dagger
cold sonnet
#

1... 2...

#

jk we're always patient

slate swan
zealous dagger
#

so its like this

#
bot = commands.Bot(command_prefix="!")
#

Am I right

#

@slate swan

slate swan
#

yh

zealous dagger
#

ok

slate swan
zealous dagger
#

Can

#

you help @slate swan

slate swan
# zealous dagger How

umm, because, its against discord's TOS for a bot to delete messages that are older than two weeks

zealous dagger
#

@slate swan Can you

slate swan
#

always welcome

zealous dagger
#

See

slate swan
#

yep

#

seeing, slowly and steadily

zealous dagger
#
  File "main.py", line 6, in <module>
    ADS.run("my token")
TypeError: run() takes 1 positional argument but 2 were given```
zealous dagger
#

sure

#
from ads.core import bot
from os import getenv

if __name__ == "__main__":
    ADS = bot.ADS()
    ADS.run("my token")
zealous dagger
slate swan
#

is ADS() a class?

zealous dagger
#

Yes

slate swan
#

did you define a run function in it?

zealous dagger
#

Nope

zealous dagger
slate swan
#

Show it

zealous dagger
#

Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

I got my errro

#

I know how to fix it

slate swan
#

😬I'll assume your Missed a self there

#

😔stop calling me sire , or I'll cry

slate swan
#

best

#

cool

#

🤝

#

tbh

#

the bot gives me roles like this
[<Role id=933717532232269825 name='@everyone'>, <Role id=935119622112411689 name='bot'>]
how do check if someone has a role 'bot' ?

unkempt canyonBOT
slate swan
unkempt canyonBOT
slate swan
#

use any one of those :)) using an ID is better

#

lemme see

#

@slate swan are you trash? i can’t tell

#

i mean trans?

#

no my question is , how do i put this
if this == 'bot':
do Smth

@slate swan

#

@slate swan are you straight or trans? i can’t tell.

slate swan
#

what sexual orientation

slate swan
#

bro

#

what sexual orientation

zealous dagger
#

@slate swan Me back with new error

slate swan
#

i can’t believe ur 15 and don’t know what sexual orientation means

zealous dagger
#
  File "main.py", line 6, in <module>
    ADS.run()
  File "bot.py", line 30, in run
    self.setup()
  File "bot.py", line 25, in setup
    for filename in os.listdir("./cogs"):
FileNotFoundError: [Errno 2] No such file or directory: './cogs'```
#

This is my code

slate swan
#

are you straight trans lesbian what

slate swan
slate swan
slate swan
slate swan
#

this is a discord bot channel

#

tf up

zealous dagger
#

@slate swan @slate swan Please don't talk all of these

#

Things here

slate swan
zealous dagger
#

I am younger than you

slate swan
#

i don’t give 5 fucks anyways bye

slate swan
slate swan
zealous dagger
slate swan
slate swan
glass rock
#

doesn anyone have any alternatives to heroku?

slate swan
slate swan
zealous dagger
zealous dagger
#

but when I try this withought

slate swan
zealous dagger
#

the class

wind stone
#

what would be a good free way to learn how to code a bot in python

zealous dagger
#

It works @slate swan

slate swan
#

this chat now feels more like a place where people just argue :)

zealous dagger
slate swan
#

nvm

glass rock
slate swan
zealous dagger
#

OK

glass rock
#

any alts to heroku?

zealous dagger
slate swan
slate swan
wind stone
zealous dagger
slate swan
zealous dagger
slate swan
zealous dagger
#
def setup(self) -> None:
        for filename in os.listdir("./cogs"):
            if filename.endswith("py"):
                self.load_extension(f"cogs.{filename[:-3]}")