#discord-bots

1 messages · Page 494 of 1

slate swan
#

could be anything

#

that's because you don't have any ctx param in a command? the error legit tells u what it is

#

...

#

maybe the guild being nonetype

#

or the name being wrong

#

!d discord.ext.commands.Context

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

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

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

look at all of its attributes

#

well yeah, these are the two options lmao

slate swan
#

what?

normal jasper
#

let me send a screen shot

slate swan
#

what i do now?

slate swan
#

I have no idea what your role is, what name it has, what's your guild instance

#

its a simple test role

normal jasper
#

i have no message arguments in my message

#

the only one is

#

{username}

#

what should i do =(

slate swan
#

u should really learn some basic python, the error is really crystal clear 🤦‍♂️

but basically, your message.author becomes ctx.author
message.content becomes ctx.message.content
message.channel becomes ctx.channel
also instead of splitting the author, just do .author.name

stone palm
#

how is this undefined?

slate swan
slate swan
#

if they both exist, only the name could be wrong

stone palm
#

oh yea

slate swan
#

make sure it's right, since it's case sensitive

slate swan
#

I meant

#

print the role name

#

selected_role

slate swan
slate swan
#

bru

normal jasper
slate swan
#

just say

slate swan
#

i show how its work

normal jasper
#

can i ask wheredid you learn this much aabout discord .py

slate swan
#

docs

normal jasper
slate swan
#

but your problem wasn't dpy related, your error was telling u what you did wrong yet u blamed your IDE when it was your lack of knowledge about python

slate swan
slate swan
# normal jasper only docs ?

yes, you have everything you need for the lib in the docs, the rest is just your python knowledge and imagination

slate swan
#

¯_(ツ)_/¯

normal jasper
#

haha

slate swan
#

lmao

normal jasper
#

ok good bye

hasty iron
slate swan
#

^

normal jasper
slate swan
#

I have learned/am learning from just diving in, learning the basics then trial and error

normal jasper
#

if atom's owner is in this chat i want to say sorry to him for calling his IDE shit (btw it's so good and i like it )

plucky shoal
#

How can I send an embed?

kindred epoch
#

ok so, im trying to use sleep_until but it instantly sending the result, idk if im doing it wrong, but heres the code:

import discord.utils
from datetime import datetime,timezone
time = datetime(2021,9,24,hour=2,minute=44,tzinfo=timezone.utc)
await discord.utils.sleep_until(time,"hi")
slate swan
#

using send(embed=yourembed)

normal jasper
# plucky shoal How can I send an embed?
embedVar = discord.Embed(title="The Title ", description="Description" color=0x00ff00)
    embedVar.add_field(name="Chat Commands", value=("The Value"), inline=False))
await ctx.send (embed=embedVar)

plucky shoal
#

idk why I asked only about the embed, didn't specify the video part lol

sage otter
#

So you want the video to embed like YouTube links do when you send them?

plucky shoal
#

ignore my messages and edits my brain is not working today lol

sage otter
#

that’s not possible. The only thing you can put in the embeds image attr like that are gifs.

trail breach
#

um other than the muted role theres now way to mute a ppl??

sage otter
#

Remove their permission to send messages?????

trail breach
#

yeah ok ty

boreal ravine
#

Any clue why it isn't letting me edit my file? I'm new to github by the way.

trail breach
marsh depot
#

Hi i need help in my code, i create a "AntiFlood" when someone make flood the bot mute the user during 2min and later bot remove the specific rol, this works fine if I put in the code if message.author.guild_permissons.administrator: return

But when i put if ROLE in member.author.roles: return the bot mute the user with this role, anyone know how to fix it?

My Code =>
https://paste.pythondiscord.com/jiluligiwu.properties

wicked atlas
#

or no

#

nvm thats the guild role list

warped bronze
#

Didnt work (bot.process_command without s gave an error)

wicked atlas
normal jasper
#

how can i add kwargs

wicked atlas
marsh depot
normal jasper
wicked atlas
wicked atlas
#

unless yo make your own system

slate swan
boreal ravine
slate swan
#

np

wicked atlas
#

Then what do you mean?

#

Show an example

marsh depot
#

and if i put

 if message.author.guild_permissons.manage_messages: return```dont work
slate swan
#

guys i need help with command ideas, my bot is a private multi-purp bot to both manage and entertain the members of my server so any type of command is welcome (as long as it's somewhat short and useful)

normal jasper
hollow mortar
#

any help pls

#

i ge tproblem in it

#

this problem

#
    await coro(*args, **kwargs)
  File "C:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 11, in on_ready
    async with open("ticket_configs.txt", mode="a") as temp:
AttributeError: __aenter__```
wicked atlas
#

Or, no...

#

Might need to make your own check to negate those

wicked atlas
wicked atlas
hollow mortar
#

what ?

wicked atlas
#
async with open("ticket_configs.txt", mode="a") as temp:
```This is the line that shows the error
boreal ravine
wicked atlas
#

But that's strange that it shows a different line in your code

boreal ravine
#

do u mean arguments or keyword arguments

hasty iron
wicked atlas
hasty iron
#

oh sorry didn’t see above that it wasn’t your error

hollow mortar
#

i changed it and removed the async

#

still didnt understand the problem

wicked atlas
#

Looking at your pastebin though it should work, because you have

    async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
        pass
hasty iron
#

probably didn’t save

#

or reloaded

hollow mortar
#

got it working thanks

zenith zinc
#

help

#

this is bag or.....

#

ouuuuuu

#

sorry wrong server

reef shell
#

jss

zenith zinc
#

yes

reef shell
#

lol

zenith zinc
#

do you maybe how fix

reef shell
#

no, idk about js

#

js

#

i only know one thing about js.. it's for frontend web dev.
kek

boreal ravine
#

hm

boreal ravine
#

you'll need to manually change your node version to v16.0+

hollow mortar
#

hello

#

i have a bot that give perms to channel i want it to give per to everyone sendmsg false

#

how do i do that

#

i have this code it give perm to ppl who react to msg and open them a new channel and set there perms but doesnt set everyone perms too

#
await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)```
#

any help

#

like if i change payload.member to everyone.member does it will work ?

slate swan
#

!d discord.Guild.default_role

unkempt canyonBOT
hollow mortar
#

so i change payload to default_role ?

slate swan
#

payload.member to YourGuildInstance.default_role

hollow mortar
#

guildinstance ?

slate swan
#

just some guild object

hollow mortar
#

if i have like member role not everyone

#

i want to change payload to member role

slate swan
#

guild = bot.get_guild(payload.guild_id)

slate swan
#

!d discord.Guild.get_role

unkempt canyonBOT
hollow mortar
#

like i change it to like this

slate swan
#

get the guild

#

get the role with that

#

replace payload.member with the role

hollow mortar
#

so like this

#

still didnt understand

#

i have role called fola i want to give it per to the channel not to read and send msg how can i do that ?

#

this is my question

#
@bot.event
async def on_raw_reaction_add(payload):
    if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
        msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]

        if payload.message_id == msg_id:
            guild = bot.get_guild(payload.guild_id)

            for category in guild.categories:
                if category.id == category_id:
                    break

            channel = guild.get_channel(channel_id)

            ticket_channel = await category.create_text_channel(f"ticket-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
            
            await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)
            await ticket_channel.set_permissions(fola.member, read_messages=False, send_messages=False)```
slate swan
#
guild = bot.get_guild(payload.guild_id)
role = guild.get_role(role_id) #replace role_id with your role's id
await ticket_channel.set_permissions(role, read_messages=True, send_messages=True)
hollow mortar
#

so it should be like this ?like i sent ?

slate swan
#

analyze this please

#

I have no idea what fola could be

hollow mortar
#

fola is a role

slate swan
#

an undefined error

hollow mortar
#

fola is a role that everyone have

#

role fola to get some perms

slate swan
#

but it doesn't exist in this context

#

the code can't read minds

hollow mortar
#

i know this code is only example for you to know what i mean

#

with my question

slate swan
#

the no

#

no need for the member attribute

hollow mortar
#

so just leave it fola ?

#

it wont know its a role in that thing

slate swan
#

yes

#

just get the role and put it there

uncut comet
#

hello im currently having issues editing an embeded it edits the message and adds this <discord.embeds.Embed object at 0x00000218FC8394C0> with this code await meani.edit(embed=embeded)

hollow mortar
#

got it working thanks man thanks alottttt

#

and sorry for talking alot

#

thanks

flat solstice
#

So I have this task which is changing my bots status```py
class Events(commands.Cog):
def init(self, bot):
self.bot = bot
if self.bot.config.testing is False and self.bot.cluster == 1:
self.bot_stats_updater = bot.loop.create_task(self.bot_stats_updater())
self.bot_misc_updater = bot.loop.create_task(self.bot_misc_updater())
self.status.start()

@tasks.loop(seconds = 10) # minutes = 5
async def status(self):
    statuses = cycle([f'{self.bot.config.default_prefix}help', f'{self.bot.config.activity}', f'<t:{int(self.bot.user.created_at.timestamp())}:R>', f'Gateway latency: {round(self.bot.latency * 1000, 2)}ms.', f'CPU Usage: {psutil.cpu_percent(interval=None)}%', f'RAM Usage: {psutil.virtual_memory().percent}%', ])

    await self.bot.change_presence(activity = discord.Game(next(statuses))
@status.before_loop
async def before_status(self):
    await self.bot.wait_until_ready()```but I keep getting this error```py

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: SyntaxError: invalid syntax (events.py, line 39)```but i'm not sure why, is wait until read supposed to be inline with the task itself

slate swan
#

so which line is this

flat solstice
#

line 39 is async def before_status(self):

slate swan
#

mmhmm

hasty iron
#

missing ) in previous line

slate swan
#

oh right

#

but why is it showing the other line

#

but wait a minute

hasty iron
#

because it kept expecting it until it found an expression

slate swan
#

changing presence every 5 minutes

hasty iron
#

or something like that

slate swan
#

nah, that's fine lol

#

I'm overreacting everything

hasty iron
#

no that’s actually 10 seconds

slate swan
#

I hope he's gonna change it

hasty iron
#

5 minutes is commented

slate swan
#

since that comment's there

#

noticed

#

but he'll surely change it

#

right @flat solstice? 👀

reef shell
#

He probably will change to 5 secthinkmon

flat solstice
#

yeah fixed that now, hoping it's not gona break on something else

flat solstice
slate swan
#

not for u

#

for the API

brazen seal
#

how i can remove all reactions form message bot

vestal owl
#
TypeError: 'NoneType' object is not iterable```
slate swan
#

!d discord.Message.reactions

unkempt canyonBOT
slate swan
#

let's check this

vestal owl
#
cur.execute('SELECT User, Language FROM lang_store WHERE User = ?', (user,))
    row = cur.fetchone()
    row = list(row)
    print('help', row)```
slate swan
#

I would iterate through that

#

but that's prolly dumb

vestal owl
slate swan
#

no

brazen seal
slate swan
#

for example you do

brazen seal
#

i just need remove all reactions from bot message

brazen seal
slate swan
#

ctx.message.reactions[0].clear()

#

that would remove all of the first reaction

brazen seal
#

hm

#

so it should work?

slate swan
#

but I found a better one

#

lol

brazen seal
slate swan
#

!d discord.Message.clear_reactions

unkempt canyonBOT
#

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

Removes all the reactions from the message.

You need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this.
slate swan
#

this obviously seems better

#

👀

#

@brazen seal

brazen seal
slate swan
#

ye

brazen seal
#

why it not work?

slate swan
#

clear_reactions

#

not clear.reactions

brazen seal
#

oh

#

thanks

pastel torrent
#

Is there someting to do before i can do the .get_user ???

dapper cobalt
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

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

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

uncut comet
#

hello im currently having issues editing an embeded it edits the message and adds this <discord.embeds.Embed object at 0x00000218FC8394C0> with this code await meani.edit(embed=embeded)

pastel torrent
#
from discord import *
from discord.ext import commands

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

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

m = bot.get_user(286776720449601537)
        print(m)

///OUTPUT: NONE

Please help 🙂

dapper cobalt
#

Are you running the bot at all?

pastel torrent
pastel torrent
dapper cobalt
#

So you have bot.run("bot token") at the end of your code?

wicked atlas
pastel torrent
# dapper cobalt So you have `bot.run("bot token")` at the end of your code?

from discord import *
from discord.ext import commands
from database import *

TOKEN = "x"

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

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

def send(ticker, text):
    mycursor.execute(f'''
                            SELECT user, quantity
                            FROM user_stock
                            WHERE ticker = '{ticker}' AND quantity > 0
                            ''')
    result = mycursor.fetchall()

    for i in result:
        r = i[0]
        mycursor.execute(f'''
                                SELECT discordId
                                FROM user
                                WHERE id = {r}
                                ''')
        result2 = mycursor.fetchone()
        print(result2[0])
        m = bot.get_user(286776720449601537)
        print(m)

send('FTHF', 'h')

bot.run(TOKEN)```
wicked atlas
#

get_user gets the user from the bot's cache, which dosen't exist yet really

uncut comet
dapper cobalt
#

You can call the function inside an on_ready event.

#

!d discord.on_ready

unkempt canyonBOT
#

discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.

Warning

This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
pastel torrent
#

ooooooooh

wicked atlas
#

Can you send where you get that from?

pastel torrent
uncut comet
dapper cobalt
#

No problem.

uncut comet
#

it edits fine but just has <discord.embeds.Embed object at 0x00000218FC8394C0> at the top and idk why

wicked atlas
#

Because that would mean that you are passing the embed as the content in the original message

uncut comet
wicked atlas
#

Send the code for when you first send the message

uncut comet
#

when the embed is first sent it doesnt have <discord.embeds.Embed object at 0x00000218FC8394C0> only after editing it has that

wicked atlas
#

Can you send your whole code for this command?

dapper cobalt
#

Try await meani.edit(embeds=[embeded]).

slate swan
dapper cobalt
#

You're too late.

wicked atlas
slate swan
wicked atlas
#

Any further changes to the discord API will not be applied to discord.py

hasty iron
slate swan
dapper cobalt
unkempt canyonBOT
wicked atlas
#

it's not a fork. disnake is what you're thinking of

dapper cobalt
#

Oh right. I meant disnake.

uncut comet
hasty iron
dapper cobalt
#

!pypi disnake

unkempt canyonBOT
hasty iron
#

i mean if it’s a breaking change it’s probably going to be on another api version

flat solstice
#

This task I have for changing my bots status doesn't seem to be working. It sets the status when the bot launches when it doesn't seem to be changing the status and I've been waiting 5 - 10 mins now but it doesn't seem to be erroring```py
class Events(commands.Cog):
def init(self, bot):
self.bot = bot
if self.bot.config.testing is False and self.bot.cluster == 1:
self.bot_stats_updater = bot.loop.create_task(self.bot_stats_updater())
self.bot_misc_updater = bot.loop.create_task(self.bot_misc_updater())
self.status.start()

@tasks.loop(seconds = 30) # minutes = 5
async def status(self):
    statuses = cycle([f'{self.bot.config.default_prefix}help', f'{self.bot.config.activity}', f'<t:{int(self.bot.user.created_at.timestamp())}:R>', f'Gateway latency: {round(self.bot.latency * 1000, 2)}ms.', f'CPU Usage: {psutil.cpu_percent(interval=None)}%', f'RAM Usage: {psutil.virtual_memory().percent}%', ])

    await self.bot.change_presence(activity = discord.Game(next(statuses)))

@status.before_loop
async def before_status(self):
    await self.bot.wait_until_ready()```
wicked atlas
#

The iterable restarts each time the task executes

flat solstice
#

hmm makes sense

flat solstice
wicked atlas
flat solstice
wicked atlas
#

Ah, yeah, then put them in your before_loop, after the wait for ready

flat solstice
# wicked atlas Ah, yeah, then put them in your `before_loop`, after the wait for ready

so if i'm understanding you correctly then something like this```py
class Events(commands.Cog):
def init(self, bot):
self.bot = bot
if self.bot.config.testing is False and self.bot.cluster == 1:
self.bot_stats_updater = bot.loop.create_task(self.bot_stats_updater())
self.bot_misc_updater = bot.loop.create_task(self.bot_misc_updater())
self.statuses = []
self.status.start()

@tasks.loop(seconds = 30) # minutes = 5
async def status(self):

    await self.bot.change_presence(activity = discord.Game(next(self.statuses)))

@status.before_loop
async def before_status(self):
    await self.bot.wait_until_ready()
    self.statuses = cycle([f'{self.bot.config.default_prefix}help', f'{self.bot.config.activity}', f'<t:{int(self.bot.user.created_at.timestamp())}:R>', f'Gateway latency: {round(self.bot.latency * 1000, 2)}ms.', f'CPU Usage: {psutil.cpu_percent(interval=None)}%', f'RAM Usage: {psutil.virtual_memory().percent}%', ])```am I misunderstanding?
wicked atlas
#

Yah, that's what I mean

flat solstice
#

okay cool

flat solstice
lyric moat
#

Why does the bot needs a link to play a song?

lyric moat
# lyric moat Why does the bot needs a link to play a song?

Code

   @commands.command()
    async def play(self,ctx,url):
        ctx.voice_client.stop()
        FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
        YDL_OPTIONS = {'format':"bestaudio"}
        vc = ctx.voice_client

        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            url2 = info['formats'][0]['url']
            source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
            vc.play(source)```
vague fable
#

How to use @quaint axle.event in a cog again?

#

Sorry for ping 😦

slate swan
#

😦

#

🙂

#

😦

vague fable
#

I remember it is like @glacial swanwhat.listener

#

But I forgot

slate swan
#

green discord

vague fable
#

what

slate swan
#

@glacial swan is green discord

vague fable
#

No

vague fable
dapper cobalt
#

I've set a botvar bot.cluster in bot.py and now I'm trying to access it in a cog but it says that bot doesn't have cluster attribute.

    def __init__(self, bot):
        self.bot = bot
        self.guilds_db = bot.cluster["GX"]["guilds"]
hasty iron
#

you’re probably loading the cog before setting the attribute

exotic forge
#

@bot.command()
async def vote(ctx, *args):
if (startdict[ctx.author]) == 0:
await ctx.send ("Please Do .start")
else:
if len(args) == 1:
if (args)== ("A"):
print ("A")
elif(args) == ("B"):
print ("B")
elif(args) == ("C"):
print("C")
else:
print ("Enter a valid vote")
elif len(args) == 0:
await ctx.send("A, B, C")
else:
await ctx.send("Enter a valid vote")

Can someone help me, no matter what I send as a vote, it sends enter a valid vote, even if I do A, (Ignore the .start part, that doesn't matter)

valid niche
#

you'll probably see what is wrong then

exotic forge
#

ok

hasty iron
#

args is a tuple

#

you’re comparing a tuple to a string

exotic forge
#

oh it is? thx

#

I am new to python how do I make it a string

little ether
hasty iron
#

no need for the typehint

exotic forge
#

It still doesn't work

valid niche
hasty iron
valid niche
#

it's good practice to be explicit with typehints

exotic forge
#

what is a type hint

full lily
#

I love a typehint personally

valid niche
exotic forge
#

oh ok

valid niche
#

you specify what type the value is expected to b e

#

the typing library has a lot of tools for this too

#

!d typing

unkempt canyonBOT
#

New in version 3.5.

Source code: Lib/typing.py

Note

The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checkers, IDEs, linters, etc.

This module provides runtime support for type hints as specified by PEP 484, PEP 526, PEP 544, PEP 586, PEP 589, PEP 591, PEP 612 and PEP 613. The most fundamental support consists of the types Any, Union, Tuple, Callable, TypeVar, and Generic. For full specification please see PEP 484. For a simplified introduction to type hints see PEP 483.

The function below takes and returns a string and is annotated as follows...

little ether
exotic forge
#

Uh, sry for being annoying but I did what u did and it still doesn't work

#

@bot.command()
async def vote(ctx, *args: str):
if (startdict[ctx.author]) == 0:
await ctx.send ("Please Do .start")
else:
if len(args) == 1:
if (args)== ("A"):
print ("A")
elif(args) == ("B"):
print ("B")
elif(args) == ("C"):
print("C")
else:
print ("Enter a valid vote")
elif len(args) == 0:
await ctx.send("A, B, C")
else:
await ctx.send("Enter a valid vote")

#

this is what it looks like now

hasty iron
#

args is still a tuple

exotic forge
#

I changed it to a str

hasty iron
#

remove that * and make it a kwarg

exotic forge
#

ok

hasty iron
#

it doesn’t matter if you keep the *

lyric moat
#

Why does the bot needs a link to play a song?

exotic forge
hasty iron
#

then make it optional

#

give it a default value

exotic forge
#

what?

#

Im so lost

hasty iron
#

give the parameter a default value

#

if you can’t understand that, you should learn more python

lyric moat
little ether
exotic forge
#

I prob should

hasty iron
#

yes you should

exotic forge
#

is there a website that would be good at teaching me

hasty iron
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

exotic forge
#

k thx

vast gale
#

fluwushed today is the day that I learned bots can make servers

hasty iron
#

if your bot is in less than 10 servers yea

slate swan
inland venture
#

if user_message.lower() == '*revive':
await message.channel.send('Revive the chat!')
await message.channel.send('@Chat Revival')
return
its not pinging the role
how i do it

slate phoenix
ionic path
#

k

#
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
  if isinstance(error, commands.CommandNotFound):
    await ctx.send(
      content=f":x: Command `{ctx.message.content.split()[0]}` does not exist.",
      delete_after=3
    )
  else:
    await ctx.send(f":x: Unknown error!\n'{error}'")

how do I improve this error handler

ionic path
soft trout
#

Can u put a button in a embed

ionic path
#

the official discord.py doesn't have that, you have to use a third party module

soft trout
#

can u send me the link

ionic path
#

the official discord.py also doesn't have discord slahs commands

slate phoenix
ionic path
ionic path
soft trout
#

!pypi discord_interactions

unkempt canyonBOT
soft trout
#

there we go

ionic path
#

ye

#

nice

slate phoenix
ionic path
#

and not pip ||(or pypi)||?

slate phoenix
#

nope installing with pip will install discord.py 1.7.3

ionic path
#

take me ther

#

I need B U T T O N S

visual island
#

you can use pip also to install v2

ionic path
visual island
#

here

visual rivet
#

im trying to get the html from a youtube search for a music bot with urllib3 but does anyone no why it is not returning the full html file?

ionic path
#

ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

slate phoenix
#

i guess you can 🤔 i just did this before

visual island
#

git clone sucks

visual island
#

they cloned the package name + directory name

ionic path
visual rivet
ionic path
#

idk

#

I think there is no way to get youtube links now

visual rivet
#

oh i see

visual island
#

use their api

soft trout
#

@ionic path but i mean like buttons inside the embed

ionic path
#

where if you click the lnk something happens

#

it only works on bots tho

soft trout
#

no im talking about

#

discord buttons

#

not hyperlink

ionic path
#

Currently there is no way of doing so like the link the embed on the discord invite links

slate swan
#

may someone know why it is doesn't work?

ionic path
slate swan
#

?

ionic path
#

can you please send the text code in here

#

because its hard to type it all like that

#

what is the error

#

and output

slate swan
#
@client.command()
async def give(ctx, mins: int, *, prize: str):
    embed = discord.Embed(title=f"Giveaway started", description=f"{prize}", color=discord.Colour.random())

    end = datetime.datetime.utcnow() + datetime.timedelta(seconds = mins*60)
    embed.add_field(name=" Ends At:", value=f"{end} UTC")
    embed.set_footer(text=f"Ends {mins} mintues from now!")

    my_msg = await ctx.send(embed=embed)

    await my_msg.add_reaction("🎉")

    await asyncio.sleep(mins)

    new_msg = await ctx.channel.fetch_message(my_msg.id)


    users = await new_msg.reactions[0].users().flatten()
    users.pop(users.index(client.user))

    winner = random.choice(users)

    await ctx.send(f"{winner.mention} won {prize} the prize!")
ionic path
#

I'll try to run it

#

and dm you how to fix it if it hits me with errors

little ether
ionic path
#

it works fro me perfectly

#

:P

#

how.

#

there is no problems

#

with the thing

#

👌 it works perfectly

slate swan
little ether
ionic path
#

tell me whats the error in the console

slate swan
#

no

#

i don't have any errors

ionic path
#

what is the output

#

if it doesn't show errors

#

tell me............

slate swan
#

i have nothing in the output

ionic path
#

add an indent inside the function

#

then put a try:

mystic sky
ionic path
#

and

except Exception as err:
  print(err)
#

also add that

#

and look at the console for output

#

you must have a error handler that doesn't show what is the error and just straight up just raise the error

stone talon
slate swan
#

it should be a command

#

d!give 10 someprize

ionic path
#

or maybe he's talking about this

#

the giveaway ended so quickly

#

its supposed to be minutes

#

it turned into seconds

stone talon
# slate swan it should be a command

yes but when I started I forgot to put await bot.process_commands(message) at the end of the on_message event which made it so that for some reason the bot does not process commands

vague fable
#

In discord.py how to add reaction through message ID

#

ID is int

#

so it doesn't have attribute add_reaction

ionic path
vague fable
#

thnx so much

ionic path
#

you're welcome.

vague fable
ionic path
#

in discord.utils

vague fable
#

Ohh ya

#

I forgot

ionic path
#

:P

#

from discord.utils import get

#

forgot to add that

#

sorry :P

vague fable
#

Np 🙂 thank you

#

Wait

#

And text channel has no attribute messages

#

nor message

vague fable
zenith flicker
#

how do i use paginator?

ionic path
#

sorry for replying late I was washing the dishes

ionic path
vague fable
#

Not related to Code, but how can I modify a followed channel in my server so whenever it updates it will automatically ping a role

crisp hull
#

Hi, I wanted to change a channel name automatically every 1 minute or so. How can I do that? I only need the thing for the change channel name

slate swan
#

use a task loop

#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

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

Yes I know how I will do the loop. But I want to know how I can change the channel name of a specific server with what I provide

slate swan
#

Server ?

#

Or channel

crisp hull
#

Channel. A Voice Channel

slate swan
#

!d discord.Client.get_channel you can use this to get the channel

unkempt canyonBOT
slate swan
#

and then use .edit to edit it

crisp hull
#

Ohh okay

slate swan
#

!d discord.VoiceChannel.edit

unkempt canyonBOT
#

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

Edits the channel.

You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.

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

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
crisp hull
#

Thank you

slate swan
#

Np

vague fable
#

Not related to Code, but how can I modify a followed channel in my server so whenever it updates it will automatically ping a role

crisp hull
slate swan
#

how do i use hex code in pycharm

#

it just prints that

slate swan
#

you need to use 0x before the hex since # are comments in python

#

ohh

#

forgot thank you so much

#

i cant fix this colorama error

#

it just prints

#

@slate swan

soft trout
#

Are voice commands a thing?

maiden fable
soft trout
#

but some bots have voice commands

#

(when you join a vc)

#

how would you do that

sinful drift
#

*are

slate swan
maiden fable
#

Get the VC channel object with guild.get_channel()and do await channel.connect()

novel rampart
#

what is the error

maiden fable
#

Bro... You hid the traceback error

slate swan
#
@bot.command()
async def announce(ctx, *, content, titlee=None, footerr=None):
    if content is None:
        embedd = discord.Embed(description=f"Usage: \`\`\`^embed [message]\`\`\`",
                              color=0x2ae1e9
                              )
        await ctx.message.reply(embed=embedd)
    elif titlee is None:
        embeddd = discord.Embed(description=f'{content}', color=0x2ae1e9)
        await ctx.message.delete()
        await ctx.send(embed=embeddd)
        pass
    elif footerr is None:
        e = discord.Embed(title=f"{titlee}", description=f"{content}", color=0x2ae1e9)
        await ctx.message.delete()
        await ctx.send(embed=e)
    else:
        embed = discord.Embed(title=f"{titlee}", description=f"{content}", color=0x2ae1e9)
        embed.set_footer(text=f"{footerr}")
        await ctx.send(embed=embed)
        await ctx.message.delete()``` anyone have any ideas on how i can fix?
slate swan
#

but if i did ^announce "desc" "title" "footer" then it literally just sends an embed with the description being '"desc" "title" "footer"'

#

i hope u understand that 😭

#

@novel rampart is that good help or

#

ill send visual

slate swan
#

ill try

slate swan
#

did you edit the anime girls onto that-

#

lol-

slate swan
#

ofc-

#

intersting-

#

very

trim barn
#

How do I send messages in a server while using the message param

slate swan
#

bruh

slate swan
trim barn
#

gracias

slate swan
#

that would be my guess

#

ye

#

!d discord.Message.channel

unkempt canyonBOT
slate swan
#

:) there it is

novel rampart
#

how will i get current time

#

??

maiden fable
unkempt canyonBOT
#

classmethod datetime.utcnow()```
Return the current UTC date and time, with [`tzinfo`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.tzinfo "datetime.datetime.tzinfo") `None`.

This is like [`now()`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.now "datetime.datetime.now"), but returns the current UTC date and time, as a naive [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") object. An aware current UTC datetime can be obtained by calling `datetime.now(timezone.utc)`. See also [`now()`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.now "datetime.datetime.now").

Warning

Because naive `datetime` objects are treated by many `datetime` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling `datetime.now(timezone.utc)`.
sweet merlin
#

how do i make bot to wait until i response?

drifting arrow
#

you're doing

#

something wrong

sweet merlin
#

code?

drifting arrow
#

Then why error?

sweet merlin
#

you sending the string and not int

#

i think the link

#

wait

drifting arrow
#

i mean, i'd first start by casting 891168982965563482 as an int. do int(891168982965563482) to ensure it is an int

slate swan
#

Hey, I wanna self deploy @unkempt canyon bot.
I just wanted to know where to store
Bot token ik I have to place token in .env but where.
I'm a noob in discord py
How's to

sweet merlin
#

oh try to make variable list

drifting arrow
sweet merlin
#

list = [827123687055949824,853535211581341737,738609666505834517,826823454081941545,886120777630486538,799975931224784897,853306806116548609,757832621769097226]

#

is it working?

sweet merlin
drifting arrow
#

is this in a cog?

sweet merlin
#

i think we dont need self in non-cogs

drifting arrow
#
async def vcchess(ctx):
authorids = [827123687055949824,853535211581341737,738609666505834517,826823454081941545,886120777630486538,799975931224784897,853306806116548609,757832621769097226]
  if ctx.author.id in authorids:
    await ctx.message.delete()
    authorchannelid = ctx.author.voice.channel.id
    link = await togetherControl.create_link(authorchannelid, 'chess')
    print(link)
```?
sweet merlin
#

nvm

drifting arrow
#

i assume that since @slate swan didnt respond so fast, it must've worked

#

Coz everything else he replies super fast

#

no coz you need to fix discord indents

#

fix the indents and you're fine

#

4 spaces is 1 indent.

#

lemme send screencap

slate swan
steady ember
#

channel = get(guild.text_channels, name='get-logs')
print(channel.id)
if channel is None:
channel = await guild.create_text_channel('get-logs')
print(channel.id)

#

why its not creating log

sweet merlin
steady ember
#

giving error

#

AttributeError: 'NoneType' object has no attribute 'id'

sweet merlin
#

i never tried to do something with channel or guild thing

drifting arrow
#

did some testing @slate swan

#
    async def vcchess(ctx):
        authorids = [827123687055949824,853535211581341737,738609666505834517,
                    826823454081941545,886120777630486538,799975931224784897,
                    853306806116548609,757832621769097226]
        if ctx.author.id in authorids:
            await ctx.message.delete()
            authorchannelid = ctx.author.voice.channel.id
            link = await togetherControl.create_link(authorchannelid, 'chess')
            print(link)
``` Fix indents.
brisk fiber
#

you’d have to only print the id if channel is not none

#

or just get rid of that print statement

steady ember
#

if channel is none

#

it will create channel

sweet merlin
drifting arrow
#

I am saying fix indents coz you wont fix them when you copy and paste. the issue was your authorchannelid.

steady ember
#
author = ctx.author
      guild = ctx.guild
      channel = get(guild.text_channels, name='get-logs')
      print(guild.channel.id)
      if channel is None:
        channel = await guild.create_text_channel('get-logs')
        print(guild.channel.id)```
brisk fiber
brisk fiber
drifting arrow
#

now run it.

#

Then your issue is link

brisk fiber
#

!rule 5

unkempt canyonBOT
#

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

brisk fiber
#

selfbots break discord ToS

#

even so

drifting arrow
#

authorchannelid = ctx.author.voice.channel.id requires the author to be in a voice channel.
If they aren't you'll get an error.

#

await ctx.send(authorchannelid) I use to confirm this.

brisk fiber
drifting arrow
#

idk what a selfbot is

brisk fiber
#

it’s where you use a user token to run your code— basically you automate your own account

#

it’s against discord’s terms of service

drifting arrow
#

oh

brisk fiber
#

idk what that is

drifting arrow
#

so the code itself works, it's just @slate swan is breaking some laws or something? 🤔

#

Well. I know the code works

#

It's just @slate swan who is failing to get it to work

#

¯_(ツ)_/¯

brisk fiber
#

idk if the code works (haven’t tested it) but shes using it in a way that breaches discord’s ToS and as per this server’s rules we cannot provide help with that

drifting arrow
brisk fiber
drifting arrow
#

Oh well

#

Oh look. Something shiny over there.

#

<Wanders off>

boreal ravine
#

How is a module a self bot?

trail breach
#

every time i try to use the ban command on my bot the missing permission error pops up even though i have the required permissions to call the command ....

#

any1 have any idea y?

boreal ravine
#

does the bot have perms

little ether
trail breach
#

this happened when i made a new role

stone palm
#

why am i getting this error```py
Ignoring exception in slash command 'rolemenu':
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/slash_core.py", line 239, in invoke
await self(inter, **inter.options)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/base_core.py", line 135, in call
return await self.callback(self.cog, interaction, *args, **kwargs) # type: ignore
File "/home/runner/BetaBot/cogs/buttons.py", line 153, in rolemenu
view=View(placeholder, min_values, max_values, options)
File "/home/runner/BetaBot/cogs/buttons.py", line 48, in init
self.add_item(MyMenu(placeholder, min_vals, max_values, options))
File "/home/runner/BetaBot/cogs/buttons.py", line 39, in init
self.fill_options()
File "/home/runner/BetaBot/cogs/buttons.py", line 43, in fill_options
self.add_option(label="something")
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ui/select.py", line 228, in add_option
self.append_option(option)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ui/select.py", line 245, in append_option
raise ValueError('maximum number of options already provided')
ValueError: maximum number of options already provided

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

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 1296, in process_application_commands
await app_command.invoke(interaction)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/slash_core.py", line 248, in invoke
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: maximum number of options already provided

boreal ravine
#

maximum options?

valid galleon
#

so i have a command which sends the user's avatar, and it used to work fine a while back, but now its broken. this is my code

    @commands.command()
    async def avatar(self, ctx, *, member : discord.Member):
        useravaurl = member.avatar.url
        await ctx.send(useravaurl)```
And this is the error:
```discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 
'url'```
little ether
little ether
stone palm
#

oh its dpy 2.0 here at least

trail breach
valid galleon
#

it still gives me the same error

stone palm
#

class MyMenu(discord.ui.Select):
    def __init__(self, placeholder, min_values, max_values, options):
        super().__init__(placeholder=placeholder, min_values=min_values, max_values=max_values)
        self.options = options
        self.fill_options()

    def fill_options(self):
        for option in self.options:
            self.add_option()

class View(discord.ui.View):
    def __init__(self, placeholder, min_vals, max_values, options):
        super().__init__()
        self.add_item(MyMenu(placeholder, min_vals, max_values, options))
``````py
    async def command(self, inter):
        placeholder="something"
        max_values=2
        min_values=1
        options = [discord.SelectOption(label="something")]
        view=View(placeholder, min_values, max_values, options)
        await inter.response.send_message(".", view=view)
```I'm trying to add an option to a menu and send it but it doesn't seem to work. can someon help me
valid galleon
#

let me check one sec

trail breach
#

Missing permissions error is raised because the person calling the commands doesnt have the permission ri8

valid galleon
#

wait how do i check the module version? i forgot the command

stone palm
#

or pip show discord.py

valid galleon
#

1.6.0

boreal ravine
#

bruh

valid galleon
#

alright i get it now

boreal ravine
#

why were u using .url then?

valid galleon
#

im on a different pc

#

i'll update it

boreal ravine
#

ok

#

either update to 2.0 or 1.7.3

valid galleon
#

alright

#

btw whats new in 2.0.0?

stone palm
#

and some other stuff

#

can someone help me add options to a select menu ;-;

#

ive been trying for so long

slate swan
stone palm
#

install danny's master version

trail breach
#

every time i try to use the ban command on my bot the missing permission error pops up even though i have the required permissions to call the command ....
any1 have any idea y?

drifting arrow
trail breach
#

it has

#

i hv checke hierarchy also

slate swan
slate swan
#

could u invite me

#

?i will test it

trail breach
#

um

slate swan
#

@trail breach

drifting arrow
#

Don't do it! He's a nerd and will do nerd things!

#

It's a tarp!

trail breach
#

ok

slate swan
#

my Bot's in 86 servers getting verified

drifting arrow
#

woah 86?!

trail breach
#

this is the simple hierarchy

drifting arrow
#

Then perhaps you need to make sure your bot is only banning from the server the command is run on

drifting arrow
#

idk maybe. lemme consult the documentation

trail breach
#

await member.guild.ban(reason = reason)

outer violet
#

is js faster than python?

#

just wondering

drifting arrow
trail breach
#

ohk

#

my bot is in two server but the account im banning is only in 1

drifting arrow
#

Put the account in both servers

trail breach
#

yeah to check ok

drifting arrow
#

alternatively, you could do

guild = ctx.guild
guild.ban(member, reason)?
```https://discordpy.readthedocs.io/en/master/api.html?highlight=ban#discord.Guild.ban
trail breach
#

in the second server my bot doesnt have perms

stone palm
slate swan
#

with the code

high pollen
#

Hi

#

my bot done not work

trail breach
slate swan
drifting arrow
stone palm
#

can someone help me add options

high pollen
trail breach
high pollen
#

!paste

drifting arrow
slate swan
drifting arrow
slate swan
#

see my bot is in verification process

#

@trail breach

trail breach
slate swan
slate swan
high pollen
trail breach
drifting arrow
high pollen
#

BRUH

drifting arrow
drifting arrow
slate swan
high pollen
trail breach
little ether
unkempt canyonBOT
#

Custom help commands in discord.py

To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000

trail breach
#

like it shud be of the peerson i ping in my command

drifting arrow
trail breach
slate swan
slate swan
trail breach
#

ohk

slate swan
trail breach
#

nice

slate swan
#

nah

trail breach
#

no no

slate swan
#

then

#

XD

trail breach
#

ill make myself sense of pride

slate swan
#

when u learn things and find bugs it motivates u to solve the problem @trail breach

drifting arrow
#

oh so thats how you're using stats? XD

slate swan
#

yes

drifting arrow
#

Lemme show you my stats

slate swan
#

whai i just copied the dyno's serverinfo

slate swan
#

show it XXD

trail breach
#

still the error even after ctx.guild.ban

boreal ravine
drifting arrow
trail breach
#
@bot.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx,member:discord.Member,*,reason = "No reason"):
    await ctx.send(f"{member.name} has been banned {reason}\namen")
    guild = ctx.guild
    await guild.ban(member, reason = reason)
    # await asyncio.sleep(int(time))
    # await member.unban()```
drifting arrow
#

😄

high pollen
#

I have a working ban code

drifting arrow
#

My internet is being poop today

#

so it takes a moment to load my bot

slate swan
slate swan
boreal ravine
#

@high pollen No spoonfeeding please

slate swan
#

i have ban kick mute slowmode every single moderation command cod

boreal ravine
trail breach
#

just help me fix mine 🙂

slate swan
#

but i wont give it >:))

boreal ravine
#

@trail breach Is there an error..

trail breach
#

again missing perms

boreal ravine
#

do u have perms?

trail breach
#

is it becuz in the 2nd server my bot doesnt have any powers

slate swan
trail breach
boreal ravine
#

try making a role and make it have admin and then it to urself

#

@slate swan stop spoonfeeding

upbeat otter
#

guys, i want to download an image on my computer using the link of the image from discord, how do i do that?

high pollen
boreal ravine
trail breach
drifting arrow
# high pollen use ``await member.ban(reason = reason)``
    @commands.command(help='[Bans the mentioned user.]')
    @commands.has_any_role('bot','Bot','Owner')
    async def ban(self, ctx, member : discord.Member, *, reason = None):
        if reason == None:
            reason = "No reason given."
        guild = ctx.guild
        await guild.ban(member, reason=reason)
``` is my ban code
boreal ravine
#

@drifting arrow no spoonfeeding pls

drifting arrow
#

it was made a month ago before I learnt about permissions

high pollen
slate swan
boreal ravine
drifting arrow
#

I thought I'd share my version

drifting arrow
#

Not much difference between what I just did and simply saying use this

drifting arrow
boreal ravine
trail breach
high pollen
#

or i can ban head mod

#

or admin

boreal ravine
#

thats optional?

slate swan
high pollen
slate swan
boreal ravine
trail breach
slate swan
#

lol @boreal ravine

#

u know it right

high pollen
boreal ravine
high pollen
#

Also I need help with my bot

#

Code 🆙

#

It is too big to paste here

slate swan
#

hey guys

high pollen
#

It returns voice as None Always

stone palm
#

can someone help me with dpy 2

high pollen
broken igloo
#

How to localize discord bot using gettext? (Users can select bot's language on their servers)

drifting arrow
#

I updated my code to reflect what was 'wrong'

drifting arrow
# high pollen use ``if member.top_role < ctx.author.top_role:`` to check if bot is higher than...
    @commands.command(help='[Bans the mentioned user.]')
    @commands.has_permissions(ban=True)
    async def ban(self, ctx, member : discord.Member, *, reason = None):
        if reason == None:
            reason = "No reason given."
        if ctx.author.top_role > member.top_role:
            guild = ctx.guild
            await guild.ban(member, reason=reason)
        elif ctx.author.top_role < member.top_role:
            await ctx.send(f"I'm sorry {ctx.author.mention}, but I cannot ban someone who is better than you.")
        elif ctx.author.top_role == member.top_role:
            await ctx.send(f"I'm sorry {ctx.author.mention}, your roles match and according to article 32, subsection 193, paragraph 3, dotpoint 8, I can't ban him")
        else:
            await ctx.send("Can't ban. Soz bro.")
#

you satisfied?

drifting arrow
#

There's probably an error somewhere

#

i dont have very many test subjects

high pollen
#

ok

drifting arrow
#

¯_(ツ)_/¯

#

Also my original code had an indentation error.

high pollen
#

oh

#

now working?

high pollen
drifting arrow
#

The code I sent should work.

high pollen
#

ok

drifting arrow
#

I'm referring to when ya'll were like 'dont spoonfeed' after discussing for like an hour.

#

that original code block would only work if you didnt specify a reason

#

or did I fix it? idk

#

idc. moving on.

#

I hate code that requires me to test on people xD

high pollen
#

RIP

#

use alts for testing

#

or friends

stone palm
#

Does anyone know dpy2.0

slate swan
#

how can i change the color of text when i print

drifting arrow
#

My friends have started to ignore me coz of the spam

slate swan
#

Fore*

#

or hex

drifting arrow
drifting arrow
stone palm
#

i need help with adding options to a menu

#

but i cant seem to understand

#

adding options on command*

#

too many classes and stuff, i dont get it

drifting arrow
#

Like buttons?

#

and a dropdown menu?

stone palm
# drifting arrow and a dropdown menu?

YES```py
class Dropdown(discord.ui.Select):
def init(self):
super().init(
custom_id="RoleMenu",
placeholder="Select Role(s)",
min_values=0,
max_values=len(2),
options=[
discord.SelectOption(label="Hello"),
discord.SelectOption(label="Hi")])

#

thats my class

drifting arrow
#

I've never used those new features

stone palm
#

ah

drifting arrow
#

so I wouldn't have a clue xD

#

ALTHOUGH with that being said. I might do a tic-tac-toe game using those buttons..

slate swan
drifting arrow
#

¯_(ツ)_/¯

stone palm
#

'_'

#

alr but i need some help

slate swan
#

im trying to change the color for each leter

slate swan
boreal ravine
slate swan
#

wanna make one letter red, the other black, the one after blue

boreal ravine
#

Use an extension I guess?

slate swan
#

idk what to use

#

colorama doesnt work

visual island
#

you cant, colorama only works for console

#

discord doesn't support anything like that

slate swan
#

and its not working

slate swan
stone palm
# slate swan what tell me

i need to add options to a menu
and also determine its placeholder, max and min values based on the options the user types

stone palm
steep estuary
#

can i change the bot's profile color?

boreal ravine
boreal ravine
steep estuary
#

k

stone palm
boreal ravine
#

hm

slate swan
stone palm
boreal ravine
#

whats linkslike

#

he said he wants to make select menus

slate swan
slate swan
#

@stone palm

boreal ravine
slate swan
stone palm
#

'_'

slate swan
#

this??

stone palm
#

bro what do you mean

slate swan
stone palm
#

no

#

discord.ui.Select

slate swan
#

then u want it to be unique

stone palm
#

no

#

youre somewhat advertising at this point

slate swan
boreal ravine
stone palm
#

i was talking about discord.ui.Select

slate swan
#

i delete

boreal ravine
slate swan
stone palm
boreal ravine
#

hm

slate swan
#

?

stone palm
#

i realized that view.children[0].add_option() adds an option
is there a better way to execute this?

boreal ravine
stone palm
slate swan
#

ohk

stone palm
#

i realized that view.children[0].add_option() adds an option
is there a better way to execute this?

stone palm
#

and also, how do i add the placeholder, min and max values on command

stone palm
drifting arrow
#

nothing

#

depends on what you want to do. maybe do a loop?

stone palm
#

i still didnt understand the thing :/

drifting arrow
#

same

normal jasper
#
@client.command()
async def Pball(ctx , question):
    username = str(message.author).split('#')[0]
    user_message = str(message.content)
    channel = str(message.channel.name)
    eightball = ['Yes','No','Probably','Of Course','Of Course No','From my point of view , yes','100% No','I Donnow','Ask Me Later','Im Busy , Sorry ','Im sure yes','I Guess No']
    embedVar = discord.Embed(title=f"✦Peachy Bot✦\n Question By {username} ",color=0x00ff00)
    embedVar.add_field(name="Answer By Peachy Bot :", value=(f'{question}\n=> {random.choice(eightball)} .'),inline=False)
    await message.channel.send(embed=embedVar)
    return            
#
Ignoring exception in command Pball:
Traceback (most recent call last):
  File "C:\Users\Modarresan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\Modarresan\Desktop\Peachy Bot\Peachy.py", line 89, in Pball
    username = str(message.author).split('#')[0]
NameError: name 'message' is not defined

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

Traceback (most recent call last):
  File "C:\Users\Modarresan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Modarresan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Modarresan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'message' is not defined

normal jasper
#

Gives this error when i type .pball question

#

oh wait

#

i get it

drifting arrow
#

message.author is wrong. there's no message. instead change that entire first line to be username = ctx.author.name

#

and using dpy returns string so no need to cast as a string

#

so user_message = str(message.content) can be change to user_message = ctx.content

drifting arrow
#

stop casting everything as string

#

basically the entire things wrong.

boreal ravine
drifting arrow
#

you trying to get a count of members with x role?

boreal ravine
#

Role is undefined

#

just do role.members?

#

!d discord.Role.members

unkempt canyonBOT
boreal ravine
stone palm
#

does anyone know how to create a customized menu on command, i.e. a menu with the text the user sends as the placeholder and variable max and min values?

boreal ravine
#

Meaning? An error?

drifting arrow
#

oof

boreal ravine
#

run the command ig

sweet merlin
#
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.commands' raised an error: AttributeError: type object 'commands' has no attribute 'command'
boreal ravine
#

output?

sweet merlin
#

uh...

boreal ravine
#

maybe variable hierachy or something

sweet merlin
#

alright

sweet merlin
#

i change the file name

boreal ravine
#

o ok

#

?

#

o i meant the

#
    em.add_field(name="Users", value=role.members)
``` and change this back to ```py
role: disnake.Role
#

huh

maiden fable
#

That means no one has the role

boreal ravine
#

use len()