#discord-bots

1 messages · Page 214 of 1

smoky sinew
#

you can't do if "..." in category

left dew
#

im not sure how to access channel seeing as it ill be different every hour

#

oh

smoky sinew
#

what are you trying to do?

left dew
#

if a channl is called chat in a specifc category them after an hour it gets deleted and remade

smoky sinew
#

just use discord.utils.get

#

discord.utils.get(category.channels, name="「🥥」・chat")

left dew
#

ooohh tyy

smoky sinew
#

it will return the chat channel

gusty flax
left dew
#

i cant

gusty flax
smoky sinew
#

because the channel is deleted and re-created

gusty flax
#

Hmmm

left dew
#

that worked

#

mudkips idea

#

yay

gusty flax
# left dew that worked

Instead, I think one way that is safer, unless any of ur staff edits the spacing of the channel, is to iterate through all channels and check to see if the name u give us the same as the category name. But without the emoji. That way, if u edit emoji but u keep the channel called chat, u will still be able to retrieve the channel.

left dew
#

ohh

gusty flax
#

I can write you a code example if u need

left dew
#

i think it should be alr for now, if not ill let u know

junior walrus
#

trying to get the last 10 messages in a channel but i'm getting an error

gusty flax
#

instead flatten m2

junior walrus
# gusty flax instead flatten m2
async def on_message(message: discord.Message):
    chan = message.channel #finds channel of message
    print(chan)
    chann = chan.id
    print(chann)
    m = discord.utils.get(message.guild.text_channels, name=chan)
    m2 = await m.history(limit=10)
    m3 = m2.flatten()
    print (m3)```
gusty flax
#

r u sure theres a channl with taht name

#

and ur bot has perms

junior walrus
junior walrus
#

says m is None for some reason

gusty flax
#

in the list of channels u provided

junior walrus
#

and chan is general

#

when I test it

#

I gtg but let me know if u know how to fix it

slate swan
sour peak
#

Which would you say is currently better?
Discord.py or Pycord or Nextcord?

slate swan
#

nextcord

glad cradle
#

disnake

sour peak
#

Why are there so many????

#

this cna't be good

slate swan
#

there are even more

sour peak
#

I getting a headache

slate swan
#

just use whatever you're fine with

#

||i personally would recommend nextcord 🤫 ||

gusty flax
#

That isn’t specifically a bot question, but more for a general python question. U may get more help in gen or help channel.

#

But seems that u don’t have an empty list

smoky sinew
#

everybody asks for non-discord bot stuff all the time in here

#

the list is returned it's just empty

gusty flax
gusty flax
smoky sinew
#

yes, but you said a list isn't being returned which is not true

gusty flax
#

What I meant was an empty list

#

Thanks for the correction

flint heart
#

Could any of you help me figure out why my /viewcard command isn't working? The bot says that the card is not recognized. Here's the relevant code: https://pastebin.com/u0Waa9qG

#

For example, if I do "/viewcard Jhett [Standard]", it responds with "Card not found: Jhett [standard]"

scarlet aurora
#

can you use prefix and slash commands in 1 bot

flint heart
#

Here's the /openpack command for reference on how they are added to the db:

scarlet aurora
#

if so how

flint heart
gusty flax
#

For my code, I separate it into cogs.

#

I have cogs that are dedicated to slash commands and cogs that are dedicated to prefix commands

#

The difference is ```py
@app_commands.command()

vs

@bot.command()```

smoky sinew
slate swan
#

im getting sh AttributeError: 'str' object has no attribute 'send'

    @commands.Cog.listener()
    async def on_member_join(self, member):
        with open("welcome.json", "r") as e:
            fr = json.load(e)
            message = fr[str(member.guild.id)]["message"]
            channel = fr[str(member.guild.id)]["channel"]
            if "{user.mention}" in message:
                message.replace("{user.mention}", member.mention)
            await channel.send(str(message))```
slate swan
#

or?

gusty flax
#

await channel.send()

slate swan
gusty flax
#
channel = client.get_channel(channel_id)
slate swan
#

ah yeah i forgot about that

smoky sinew
#

get_channel isn't a coroutine

gusty flax
#

its loaded into cache i forgot

smoky sinew
#

!d discord.Client.get_channel

unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
gusty flax
slate swan
#
    @commands.Cog.listener()
    async def on_member_join(self, member):
        with open("welcome.json", "r") as e:
            fr = json.load(e)
            message = fr[str(member.guild.id)]["message"]
            channel = fr[str(member.guild.id)]["channel"]
            frr = int(channel)
            channelf = await self.bot.get_channel(frr)
            if "{user.mention}" in message:
                message.replace("{user.mention}", member.mention)
            await channelf.send(str(message))``` so this would work
smoky sinew
#

it's not a coroutine like i said remove the await]

slate swan
#

alr

#

help pls

gusty flax
gusty flax
slate swan
slate swan
gusty flax
#

oh nvm

gusty flax
slate swan
gusty flax
slate swan
#

wym ?

#

sorry i'm new issou

slate swan
gusty flax
#

Maybe u dont have intents enabled/passed in

slate swan
gusty flax
slate swan
gusty flax
#
@client.event
async def on_message(message):
  print("Called")
  if message.content == "Ping":
    await message.channel.send("Pong")```
slate swan
gusty flax
#

u need to enable intents @slate swan

slate swan
#

how ?

gusty flax
#
intents = discord.Intents.all()
client = discord.Client(intents=intents)```
#

I think thats correct.

slate swan
#

just migrate to:

client = commands.Bot(command_prefix = "", intents=discord.Intents.all())```
gusty flax
#

print message.content instead

slate swan
#

how can i define it ?

gusty flax
slate swan
#

good ?

slate swan
# slate swan good ?

you should hide your token, as someone could generate and check the other 4 digits

gusty flax
# slate swan good ?

Delete the two on_messages and do py @client.command() async def ping(ctx): await ctx.send("Pong")

gusty flax
slate swan
#

ik

gusty flax
#

see if that worked

slate swan
#

the script is not working

#

@gusty flax uh ?

#

@slate swan

slate swan
#

when i started the script, the window were closed instantly

#

@slate swan could you help me ?

primal token
primal token
#

Pardon?

slate swan
#

mdrr

#

@primal token same problem

primal token
#

Can you hover over the yellow underlined text? And may i ask, do you have several python versions?

gusty flax
primal token
#

And do you have all of your intents enabled in dev portal?

slate swan
#

worked because i just activated this presence intent

primal token
#

Lol, have a good one!

#

Since when were reactions added back to the channel?

gusty flax
primal token
#

Oh 2 days ago

unkempt canyonBOT
#

@young dagger :x: Your 3.11 eval job has completed with return code 1.

001 |   File "/home/main.py", line 2
002 |     existing_tier_rank = Gold 3
003 |                               ^
004 | SyntaxError: invalid syntax
gusty flax
#

@young dagger need help?

young dagger
#

How is return outside function?

gusty flax
#

return isn't in a function...

young dagger
#

!e

tier_and_rank = None
existing_tier_rank = 'Unranked'

if tier_and_rank is None:
    tier_and_rank = existing_tier_rank
if tier_and_rank != "Unranked":
    tier, rank, lp = tier_and_rank.split()
    tier_and_rank = f"{tier} {rank}"
print(tier_and_rank)```
unkempt canyonBOT
#

@young dagger :white_check_mark: Your 3.11 eval job has completed with return code 0.

Unranked
young dagger
#

!e

tier_and_rank = None
existing_tier_rank = 'Gold 3'

if tier_and_rank is None:
    tier_and_rank = existing_tier_rank
if tier_and_rank != "Unranked":
    tier, rank, lp = tier_and_rank.split()
    tier_and_rank = f"{tier} {rank}"
print(tier_and_rank)```
unkempt canyonBOT
#

@young dagger :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 7, in <module>
003 |     tier, rank, lp = tier_and_rank.split()
004 |     ^^^^^^^^^^^^^^
005 | ValueError: not enough values to unpack (expected 3, got 2)
young dagger
#

!e

tier_and_rank = None
existing_tier_rank = 'Gold 3'

if tier_and_rank is None:
    tier_and_rank = existing_tier_rank
elif tier_and_rank != "Unranked":
    tier, rank, lp = tier_and_rank.split()
    tier_and_rank = f"{tier} {rank}"
print(tier_and_rank)```
unkempt canyonBOT
#

@young dagger :white_check_mark: Your 3.11 eval job has completed with return code 0.

Gold 3
gusty flax
#

@young dagger pls take this to #bot-commands

#

🙂

slate swan
slate swan
#

can i get a help for bot devlopment here??

smoky sinew
#

yes

echo wasp
#

hi, I am using app_commands.Group for another file how would i put a task.loop into that file?

#

same as a regular cog?

slate swan
#

can anyone tell how to set up discord.py cuz i am not able to download pip

knotty ice
#

Does anyone know of a way in xml.etree to get specific fields of a POST response? I’m trying to get that information to post as a message to my discord bot

smoky sinew
#

i guess download the wheel manually or something

echo wasp
vale wing
echo wasp
#

hello, I am using slash commands but i want to use a commands.GroupCog but i can't get it to load the extenstion because client doesn't have an attribute load_extension How do i make this load a cog without a prefix?

smoky sinew
#

cogs can be in extensions but you can also have an extension without a cog

#

clients dont have extensions

#

only bots

echo wasp
shrewd apex
#

u use bot

naive briar
#

Did you read

echo wasp
#

i did read

naive briar
#

!d discord.ext.commands.Bot.load_extension

unkempt canyonBOT
#

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

Loads an extension.

An extension is a python module that contains commands, cogs, or listeners.

An extension must have a global function, `setup` defined as the entry point on what to do when the extension is loaded. This entry point must have a single argument, the `bot`.

Changed in version 2.0: This method is now a [coroutine](https://docs.python.org/3/glossary.html#term-coroutine "(in Python v3.11)").
echo wasp
naive briar
#

They just said client doesn't support extensions

echo wasp
#

so how do i redo this because the other way involves a prefix

echo wasp
# shrewd apex u use bot

I used bot but it said that the tree command was already being used but then when i removed the statement it said it was undefinded

naive briar
#

You're kidding

#

!d discord.ext.commands.Bot.tree

unkempt canyonBOT
#

property tree```
The command tree responsible for handling the application commands in this bot.

New in version 2.0.
naive briar
#

It's already there

echo wasp
echo wasp
naive briar
#

You're kidding

#

tree is a property of bot object

#

So it's bot.tree

echo wasp
#

oh

#

also how do I use bot without specifying a prefix?

echo wasp
naive briar
#

You don't

#

Just override the on_message to not allow it to receive message commands

naive briar
#

And?

echo wasp
echo wasp
#

def cog_load:

#

?

smoky sinew
slate swan
#

hi i am hosting my discord bot locally currently.. and i wanted to host it 24/7 is there any good services to host it? btw, it is a discord play "currency" and multipurpose bot

#

you can check pinned messages in this thread

#

oh ok

echo mural
unkempt canyonBOT
echo mural
karmic nimbus
#

is there any discordpy readthedocs alternative?

naive briar
#

What

copper bobcat
#

ummm whats my problem ?://

tough lance
#

Can you check if a user is in a guild if member intents are disabled?

tough lance
silk fulcrum
#

Discordpy's docs are one of the best I've seen tbh

shrewd fjord
#

Bro kidding 🗿

silk fulcrum
copper bobcat
#

bruhhhh whats the problem ://

silk fulcrum
shrewd fjord
#

It's not the error bru

#

!e
hello="cat"
await hello

unkempt canyonBOT
#

@shrewd fjord :x: Your 3.11 eval job has completed with return code 1.

001 |   File "/home/main.py", line 2
002 |     await hello
003 |     ^^^^^^^^^^^
004 | SyntaxError: 'await' outside function
karmic nimbus
shrewd fjord
#

This is how the error occurs

#

You will always need to await something under async func

silk fulcrum
#

If he removes await it isn't gonna help

shrewd fjord
#

He need to await it anyway

#

Just saying him how the error occurs and what to do opsi

silk fulcrum
silk fulcrum
#

That await shouldn't be outside an async func

shrewd fjord
#

Ye

silk fulcrum
#

What you told is to put it in a async func right?

shrewd fjord
#

What's so hard about that fr

silk fulcrum
shrewd fjord
shrewd fjord
silk fulcrum
shrewd fjord
#

Maybe idk, i didnt use that IDE so lol

silk fulcrum
#

This is simply indentation

shrewd fjord
karmic nimbus
#

how do i use but respond only if message content greater than 80? idk how to explain it

if '80' in message.content
shrewd fjord
#

if len(message.content)>80:
#do stuff

shrewd fjord
# silk fulcrum

I told ya i didnt use that IDE 🗿, also i was only focusing to the error kek

#

So ig forgive me BBG_worship

shrewd fjord
#

Bro gone crazy mode

shrewd fjord
karmic nimbus
silk fulcrum
# shrewd fjord GUI?

Same way of showing indentation? Spaces? Or use an ide that use something different to show indentation? Colors?

karmic nimbus
#

I'm trying to create register form

shrewd fjord
shrewd fjord
#

I mean all IDE's workspace layout isnt same 🗿

#

Actually leave the topic fr, lets not argue 💀

shrewd fjord
#

!e
chars="Tyrion"
print(len(chars), type(chars))

unkempt canyonBOT
#

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

6 <class 'str'>
shrewd fjord
#

!d len

unkempt canyonBOT
#
len

len(s)```
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).

**CPython implementation detail:** `len` raises [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") on lengths larger than [`sys.maxsize`](https://docs.python.org/3/library/sys.html#sys.maxsize "sys.maxsize"), such as [`range(2 ** 100)`](https://docs.python.org/3/library/stdtypes.html#range "range").
radiant bough
#

So I just changed my python version but now
import discord says - import “discord” could not be resolved

slate swan
radiant bough
#

how?
Tried pip install

winged coral
#

Try specifying your python version first

slate swan
winged coral
#

pythonx - m pip
or on windows maybe
pyx - m pip

#

I think that's the windows one i'm not sure

slate swan
radiant bough
#

Tried python-3.8 -m pip install discord
But it says CommandNotFoundException

radiant bough
radiant bough
copper bobcat
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'icon_url'
duds whats problem ?

naive briar
#

The error just told you

white citrus
#

If I treat the error in the error handler and also treat it in a specific command, who then accesses it?

unkempt canyonBOT
#
Nuh-uh.

No documentation found for the requested symbol.

shrewd fjord
#

Check docs mate

#

Wait bot ded?

#

!d print

#

!d discord.Guild.icon

unkempt canyonBOT
shrewd fjord
#

It's Asset.url eh i forgor

scarlet aurora
#

discord-py-slash-commands isn't being recognised

#

I pip installed it and it's in the same environment and I am running it correctly but it just wont accept the fact it's there

#

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.utils' raised an error: ModuleNotFoundError: No module named 'discord_slash'

#

discord-py-slash-command 4.2.1

#

can someone help?

scarlet aurora
#

so I can't use 2.2?

#

aint helping with the module not being found

thin raft
#

don't use discord_slash

scarlet aurora
#

ok

thin raft
#

!d discord

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

scarlet aurora
#

..

gusty flax
radiant bough
#

the bot’s ping depends upon what factors?

slate swan
#

you can't do much about the latter

shrewd apex
#

altho that dosent matter as much as ur internet speed

radiant bough
#

mhm

sick birch
#

Not sure if it's exactly AWS but I do remember hearing something about that

spice carbon
#

how can i fetch a category

sick birch
unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
spice carbon
quick gust
smoky sinew
#

categorychannel.category

#

interesting

hushed galleon
unkempt canyonBOT
#

discord/abc.py line 360

category_id: Optional[int]```
hushed galleon
#

yea look at infernum's screenshot, its not listed there

gloomy owl
#

how to do a discord bot with vsc plz

#

i make it online but he didn't have cmds

slate swan
#

this is how you can start creating bots

gloomy owl
#

ty

#

how i do with the library

#

how i open it i didn't see the doc

smoky sinew
#

?

gloomy owl
#

nothing

white citrus
#

Well, if I treat the error in the error handler and also treat it in a specific command, who then accesses it?

gloomy owl
#

me

quick gust
#

Lmao

gloomy owl
#

?

cold sonnet
#

the lib checks for more specific error handlers first

#

you mean like

@bot.command()
async def command(ctx):
    pass

@command.error
async def command_error(ctx, error):
    pass

@bot.event
async def on_command_error(ctx, error):
    pass
#

command_error treats the errors of command

young dagger
#

How can I make the task to run once at the time?

async def calculate_mmr_async(summoner_id, RIOT_API_KEY):
    elo_rating = await calculate_mmr(summoner_id, RIOT_API_KEY)
    return elo_rating

@client.command(name='checkmmr')
@commands.guild_only()
async def checkmmr(ctx, summoner_id):
    task = asyncio.create_task(calculate_mmr_async(summoner_id, RIOT_API_KEY))
    elo_rating = await task

    embed = discord.Embed(title='',
                          description=f'Your elo: {elo_rating}',
                          color=discord.Color.blue())
    await ctx.send(embed=embed)```
#

To allow multiple users to run !checkmmr at the same time, but only one instance of calculate_mmr will be executed at a time?

smoky sinew
#

so you want to wait?

slate swan
#

can someone help me pls ?

smoky sinew
#
  1. we don't help with boost bots
slate swan
#

pls help me

smoky sinew
#

i can't help with boost bots

#

it's against server rules

slate swan
#

in dm so ?

smoky sinew
#

no...

gloomy owl
#

bro

#

poor turtles

smoky sinew
#

lol

gloomy owl
#

guys

#

i already do this

#

how to create a cmd now

smoky sinew
#

what type of command

#

@gloomy owl

gloomy owl
#

ik lemme just send the pfp

young dagger
#

Why am I getting Unexpected argument when I use @tasks.loop(days=4) and not @tasks.loop(hours=96)

gloomy owl
#

the screen

#

i already do that how create own bot cmds

#

like a generator of accounts

#

i just copy cat

smoky sinew
#

also, tasks.loop is unreliable because if your bot restarts it will reset the loop

young dagger
#

or 96

smoky sinew
#

just don't use tasks.loop for that long of a time

gloomy owl
#

im done with prefix

smoky sinew
#

save it to a database

gloomy owl
#

all i have to do now is create cmds of generator

#

but how

young dagger
smoky sinew
#

hmm sure

gloomy owl
#

PLZ

#

GIVE THE EXAMPLE OF CREATING COMMANDS

smoky sinew
gloomy owl
#

yes

#

plz

gloomy owl
#

ty the boss of the boss

slate swan
#

simple as that

gloomy owl
#

oh

#

what is extra

#

what i type in extra

#

@slate swan plz what i type in extra

slate swan
#

Hi im making a discord bot for keyauth basically i have the keyauth.py file in the same directory but there is a variable there i want to called
"failed_register"
ive tried doing from keyauth import * but its no use can anyone help

smoky sinew
#

it's optional

gloomy owl
#

But

#

What's on purpose

#

what's the point of having an extra place

smoky sinew
#

it's just for command metadata

gloomy owl
#

Metadata

smoky sinew
#

extras (dict) – A dictionary that can be used to store extraneous data. The library will not touch any values or keys within this dictionary.

gloomy owl
#

What metadata diserve

smoky sinew
#

anything you want

cinder tulip
#
@client.command()
@commands.is_owner()
async def nuke(ctx, user: discord.User = None):
    for i in range(5):
        await ctx.send(user.mention)
        await ctx.message.delete()

hmmm how do i ping everyone?

smoky sinew
#

by typing in @ everyone

cinder tulip
#

does not work lol

#

ehh its whatever

smoky sinew
slate swan
#

try f"<@&{ctx.guild.id}>

smoky sinew
#

interesting

slate swan
#

can anyone help i want to make it so I can call a "def" in a discord bot function e.g

def sendmsg(ctx):
await ctx.send("HI")

@bot.command()
async def sayhello(ctx):
  sendmsg(ctx)```
smoky sinew
slate swan
smoky sinew
#

no

#

async def is for a function definition

#

await is for calling the function

#

so move the async to before def

slate swan
#

so u mean??

async def sendmsg(ctx):
  await ctx.send("HI")

@bot.command()
async def sayhello(ctx):
  await sendmsg(ctx)```
smoky sinew
#

yeah

slate swan
#

should be pretty simple for u

gusty flax
#

We don’t do stuff for pay.

slate swan
#

and I want to attach a file if thats okay

gusty flax
smoky sinew
#

what are you having trouble with?

gusty flax
#

U csn make a help channel if u need

slate swan
#

basically, I have two files
my main.py (my discord bot)
and keyauth.py (basically an api not sure how to describe it)
now keyauth.py has a function register, i want to call that from the discord bot it all works well it registers an account with the details provided however it prints "Sucessfully registered" to console I want it to display it as a message on a discord bot I cant find a way to do it.

#

I can attach files if needed ❤️

smoky sinew
#

why don't you just let the main.py file handle the response?

slate swan
gusty flax
slate swan
#

literally just copy and pasted the code from keyauth.py into main.py and tried editing the function etc to send a message in a discord bot instead of printing it

slate swan
#

no error just dosent send

gusty flax
slate swan
#

yes printing works

#

sending to a discord bot dosent however

gusty flax
#

Code

slate swan
#
    def register(self, user, password, license, hwid=None):
        self.checkinit()
        if hwid is None:
            hwid = others.get_hwid()

        init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

        post_data = {
            "type": binascii.hexlify("register".encode()),
            "username": encryption.encrypt(user, self.enckey, init_iv),
            "pass": encryption.encrypt(password, self.enckey, init_iv),
            "key": encryption.encrypt(license, self.enckey, init_iv),
            "hwid": encryption.encrypt(hwid, self.enckey, init_iv),
            "sessionid": binascii.hexlify(self.sessionid.encode()),
            "name": binascii.hexlify(self.name.encode()),
            "ownerid": binascii.hexlify(self.ownerid.encode()),
            "init_iv": init_iv
        }

        response = self.__do_request(post_data)
        response = encryption.decrypt(response, self.enckey, init_iv)
        json = jsond.loads(response)

        if json["success"]:
            print("successfully registered")
            self.__load_user_data(json["info"])
        else:
            print(json["message"])```
gusty flax
#

And ur bot is online? And u have all intents?

smoky sinew
#

you aren't sending a discord message in that code though

gusty flax
slate swan
#
@bot.command()
async def register(ctx, arg1, arg2, arg3):
    user = arg1
    password = arg2
    license = arg3
    result = keyauthapp.register(user, password, license)
    if result == "success":
        await ctx.send("Registered")
    else:
        await ctx.send(result)
#

the "if else" statement dosent work lol just found that out

smoky sinew
#

register isn't returning anything

slate swan
gusty flax
smoky sinew
#

no it's not returning anything

gusty flax
brisk prawn
#

why make it return "success" and send a message based off that? return the "Registered" and just send whatever it returns via the bot

slate swan
#

im new to all this

gusty flax
#

Oh wait ye in the keyusrh register doesn’t haves. Return

#

So result is not success

slate swan
#

so I thought i would try the same

dull plank
#

Where do I start with all this discord bot with python stuff. I’m kinda past that beginner point of python

gusty flax
gusty flax
dull plank
#

What counts experienced?

smoky sinew
#

do you have any knowledge of async programming and async patterns?

dull plank
#

No💀

smoky sinew
#

or object oriented programming / classes?

slate swan
gusty flax
#

U assigned result to ur register

dull plank
gusty flax
#

but result is none

smoky sinew
gusty flax
slate swan
#

how would I return the value of success

dull plank
#

So what things should I learn to make learning a discord bot easier?

gusty flax
gusty flax
smoky sinew
#

no type hinting is not really necessary

#

it is optional after all

gusty flax
slate swan
dull plank
#

Ah ok then

smoky sinew
#

i wouldn't call converters type hinting

smoky sinew
#

nevermind

gusty flax
#

No, the hint is what uses the converter.

#

If u hint, Optional, it will be optional in discord.

#

So yes, type hinting is required.

smoky sinew
#

lol

gusty flax
slate swan
#

this would work right? I slimmed down the register func

#

to the main part of code

gusty flax
#

Why do u have json["success"]

smoky sinew
#

just do return True instead

gusty flax
#

Thats what I said

#

Send ur whole register function again.

#

Let me try and rework it.

slate swan
#
    def register(self, user, password, license, hwid=None):
        self.checkinit()
        if hwid is None:
            hwid = others.get_hwid()

        init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

        post_data = {
            "type": binascii.hexlify("register".encode()),
            "username": encryption.encrypt(user, self.enckey, init_iv),
            "pass": encryption.encrypt(password, self.enckey, init_iv),
            "key": encryption.encrypt(license, self.enckey, init_iv),
            "hwid": encryption.encrypt(hwid, self.enckey, init_iv),
            "sessionid": binascii.hexlify(self.sessionid.encode()),
            "name": binascii.hexlify(self.name.encode()),
            "ownerid": binascii.hexlify(self.ownerid.encode()),
            "init_iv": init_iv
        }

        response = self.__do_request(post_data)
        response = encryption.decrypt(response, self.enckey, init_iv)
        json = jsond.loads(response)

        if json["success"]:
            print("successfully registered")
            return True
            self.__load_user_data(json["info"])
        else:
            print(json["message"])```
#

i really appreciate you guys doing this I spent 1-2 hours going through forums etc I didnt wanna ask here and sound like an idiot since im new to all this

gusty flax
smoky sinew
#

that will work

slate swan
gusty flax
#

There are things we need to fix.

slate swan
gusty flax
slate swan
gusty flax
slate swan
slate swan
gusty flax
#

Let me rewrite this for u, and I will explain it.

smoky sinew
slate swan
#

alr thank you so much btw may I ask how did u learn all this im still learning im 14 and I find this really interesting

gusty flax
smoky sinew
gusty flax
#

Its pointless. Just add another var.

gusty flax
#

No reason to use the same name.

slate swan
smoky sinew
#

there are more things to nitpick than just that

smoky sinew
slate swan
#

damn

gusty flax
smoky sinew
#

why is that better

#

it's so much longer

gusty flax
# smoky sinew it's so much longer

In practice, it's is less prefferd to use to one variable name like that. Assigning two varaibles makes it more modular. But since that is the only use, it is better to just pass that directly into the function.

#

Unless u wanna make a temp.

smoky sinew
#

at least split it up into multiple lines

#
response = encryption.decrypt(
    self.__do_request(post_data),
    self.enckey, init_iv
)
gusty flax
#
temp = self.__do_request(post_data)
response = encryption.decrypt(temp, self.enckey, init_iv)```
smoky sinew
#

temp is not a very descriptive variable name either

gusty flax
smoky sinew
#

what is the purpose of not overwriting response though

#

readability is one of the most important things in python

gusty flax
smoky sinew
#

temp variable of what though

gusty flax
gusty flax
slate swan
#
@bot.command()
async def register(ctx, arg1, arg2, arg3):
    user = arg1
    password = arg2
    license = arg3
    result = register(user, password, license)
    if result == "success":
        await ctx.send("Registered")
    else:
        await ctx.send(result)
``` do i need to change result == "succes": to result == True or something or success == True
smoky sinew
gusty flax
gusty flax
slate swan
smoky sinew
#

if you're not using it, there's no point in storing it as a variable and calling it temp does not help other people that are reading the code

gusty flax
#

This argument is pointless.

#

Less move on.

smoky sinew
#

your example stretched too long, that's why i recommended to split it up pithink but you insisted on the temp variable name

#

ok though

gusty flax
#

Ur response after I sent the message was that, it isn't a good name.

slate swan
# gusty flax Exactly

it should send the else statement on the second command as the username and key have already been used

#

wait I think I know why I didnt return false

gusty flax
slate swan
#

nope just fixed

gusty flax
#

Perfect!

slate swan
#

still the same issue

#

i see this in CMD aswell

gusty flax
smoky sinew
#

something is async that shouldn't be i guess

gusty flax
gusty flax
#

Actually, it must not be.

smoky sinew
#

why would it be Command.__call__ if it's with register

gusty flax
#

Cause the message was getting sent.

gusty flax
#

Maybe not this time, but it is good to check.

slate swan
#

thanks for the help guys i guess ill wait till tmrw for a keyauth admin to assist he knows discord.py aswell and he said he could assist me tmrw I think it would be easier for all of us!

smoky sinew
#

it is a user error

#

the error is happening while discord.py is trying to call some coroutine without await

hushed galleon
smoky sinew
#

huh

hushed galleon
#

if you have a function named register() but also want a command named register, you can use the command(name=) parameter to set that name without shadowing your first function, i.e. py @bot.command(name="register") async def register_command(ctx, user, password, ...): ... or you can rename your other function instead

slate swan
#

oh YEAH

vital glacier
#

whats the best i can use to use apis in my bot? isnt it aiohttp.ClientSession()?

vital glacier
#

like

#

ima start on a lastfm command right

#

and it uses an api

#

whats the best i can do that with

#

is it aiohttp.ClientSession()?

smoky sinew
#

aiohttp as a library yes

vital glacier
#

alright

smoky sinew
#

it's good for http

#

but ClientSession is just a class

vital glacier
#

oh

#

i seei

smoky sinew
#

aiohttp supports more than just that

vital glacier
#

i never worked with apis before rly so

smoky sinew
#

it even has server support

vital glacier
#

so whats the best i should use to work with lastfm api?

smoky sinew
#

wdym

gusty flax
#

Wait nvm I misread what u said

smoky sinew
vital glacier
#

Im not saying it is an api, im saying im going to use the lastfm api and im wondering what the best thing is i can use haha

#

allg nw

vital glacier
#

alright 👍

gusty flax
#

It will help prevent blocking.

tulip barn
#

I'm a beginner, I would like to know which library you use to make slash commands

gusty flax
#

If u want to make slash commands in python.

tulip barn
#

Ah , thanks 🙂

#

I will research about her

gusty flax
dense jackal
#

There’s something I wanna solve an issue to my modmail but I have very low knowledge with coding. I asked about 3 times here and all 3 times, it was a different answer. May someone help me to literally rewrite my code to help me solve my issue?

iron turret
#

Hey, im trying to figure out a way to import slash commands in discord.py, most of them requires guild ids and only works in the server im testing it in. plz help 🙏

gusty flax
#

from discord import app_commands

dense jackal
# gusty flax What question do u have?

Hi! When a user types in the bot’s dm, this text appear. From there, they can choose if they want to create a ticket or cancel the interaction. Although, we found a glitch that if you send 2 messages, the text will sent twice and then, you will be able to create 2 tickets at once. Can someone help me to code so that the embed stops resending everytime they type in? My script is: https://paste.pythondiscord.com/yidukekala

sick birch
#

If you just leave it off entirely they become global commands

sick birch
dense jackal
#

But only once.

#

Like it wont send it a second time if I resend another text

sick birch
#

But in the screenshot, it already sent it once?

dense jackal
#

The embed sent once

sick birch
#

So when you said "H" it shouldn't have said anything, is that correct?

dense jackal
#

The second H

#

Oh yes

#

That’s right

#

Nothing sent on H

sick birch
#

Got it. Just trying to figure out what the intended behaviour was.
How I'd go about doing it is having somewhere where you would store all the created tickets, and if a user tries to create another one, it'd just deny them saying "You already have a ticket open" or something similar

#

This external source would probably be a database

dense jackal
#

That’s not it

#

They can send multiple messages when there’s no opened ticket

#

And then, spam accept on every embeds and create tons of tickets

#

And I dont want the embed to send more than once

sick birch
#

Yes. So the first time they click "accept", it would create an entry in the database for them

#

Next time they click "accept", your bot would check the database to see if there's already an entry

#

There is, so the bot just wouldn't do anything

dense jackal
#

That works

#

But I still don’t want the embed to send more than once anyways

#

Like this

sick birch
#

That's going to be a quite a bit more difficult

dense jackal
#

Yeah but that’s really important

sick birch
#

Is there something wrong with just sending a message saying the user already has a ticket open?

#

Why is it imperative that that the embed doesn't show at all?

dense jackal
#

Yes, the embed is big and its aesthetically not beautiful lol

sick birch
#

You could just set a timeout on it

dense jackal
#

Wdym

sick birch
#

Once the view times out (say 30 seconds), the embed is deleted along with the view

dense jackal
#

Like in the picture?

sick birch
#

You could do that
You could also just delete the embed entirely
Up to you

dense jackal
#

Is there a way to delete both buttons?

#

And keep the embed

sick birch
#

You'd just remove the view by passing view=None into the edit method

dense jackal
sick birch
#

Removes the view without touching anything else

dense jackal
#

What is view

sick birch
#

A "view" is conceptually a container that holds all of the components in a message - I believe that's only buttons and select menu as of now

#

Each message can have at most 1 view

dense jackal
#

Oh so they will like disappear?

#

When timed out

sick birch
#

Right.

#

The exact time-out behaviour is up to you

#

Either way you'd use the on_timeout method of discord.ui.View

dense jackal
#

alright

#

Any website to help me? Im new at coding lol

#

Or maybe you could help me out

#

That’s up to you

sick birch
#

All of this is quite complex, I'd say 🤔

dense jackal
#

Yeah U agree

#

I*

sick birch
dense jackal
#

Is it something like this @sick birch ?

async def ask(ctx: commands.Context):
    """Asks the user a question to confirm something."""
    # We create the view and assign it to a variable so we can wait for it later.
    view = Confirm()
    await ctx.send('Do you want to continue?', view=view)
    # Wait for the View to stop listening for input...
    await view.wait()
    if view.value is None:
        print('Timed out...')
    elif view.value:
        print('Confirmed...')
    else:
        print('Cancelled...')```
sick birch
#

This will create a basic confirmation view sure but not really what you want

#

Do you have an underlying database?

dense jackal
#

I have one database that contains closed ticket and member id I tuink

sick birch
#

Update your schema so it includes a relation between user IDs and their opened tickets

dense jackal
#

I*

sick birch
#

Perform database migrations if you need to (alembic is quite nice)

sick birch
# dense jackal How

Depends on the database, but you can just run SQL queries to directly update it

#

I much prefer working with ORMs so I can't be of much use in that area

dense jackal
vital glacier
#

For some reason my buttons of my VoiceMaster stop working after a while, is there any way i can fix that?

gusty flax
#

@dense jackal whats ur question? Sry I had dinner

gusty flax
vital glacier
#

There is timeout set to it

#

no timeout*

gusty flax
gusty flax
dense jackal
vital glacier
gusty flax
# dense jackal How??

Create a list in ur class that will be the overarching class, and pass that list reference to where u send the view. Then add that user to that list the users who applied.

gusty flax
gusty flax
#

So it persists.

dense jackal
slate swan
dense jackal
#

Imma need more assistance than this lol

gusty flax
# dense jackal ^^

Do u have a specific question about what I described? That will help me help you the best I can 🙂

slate swan
slate swan
#

it returns this I just wanna strip the b'' part but keep the KOTH-JOB-F60

dense jackal
#

That would be better

slate swan
gusty flax
slate swan
#

so change response to data and do data.txt?

gusty flax
#

Not txt

slate swan
#

text*

gusty flax
dense jackal
#

class TicketButtons(discord.ui.view) right above my buttons @gusty flax

naive briar
#

Wat

gusty flax
#

So it can be py response.text

slate swan
#

ahh

gusty flax
#

Whatever is being assigned to the response.

slate swan
#

perfect thanks

dense jackal
#

Want me to send the script?

naive briar
#

It should be ui.View

dense jackal
#
    def __init__(self):
        super().__init__()
        self.author_name = None
        self.author_id = 0
        self.avatar = None
        self.content = None
        self.message = None
    # If they click reject do this

    @discord.ui.button(label="Reject", style=discord.ButtonStyle.red)
    async def reject(
        self, interaction: discord.Interaction, button: discord.ui.Button
    ):
        await interaction.response.send_message("No new ticket has been submitted. Thank you :)")
        await self.message.delete()

    # if they press accept do this
    @discord.ui.button(label="Accept", style=discord.ButtonStyle.green)
    async def accept(self, interaction: discord.Interaction, button: discord.ui.Button):
        await interaction.response.send_message("A new ticket has been created! Please wait for a staff member to respond.")
        guild = bot.get_guild(1081721180123320413)
        category = bot.get_channel(1081726505496887327)
        admin_role = discord.utils.get(guild.roles, name="Reports")
        overwrites = {
            guild.default_role: discord.PermissionOverwrite(read_messages=False),
            admin_role: discord.PermissionOverwrite(read_messages=True)
        }
        modmail_channel = await guild.create_text_channel(f"{self.author_name}-modmail", overwrites=overwrites, category=category)
        await add_user(discord_user=self.author_id, channel_id=modmail_channel.id)
        embed = discord.Embed(
            title="New Modmail Ticket",
            color=discord.colour.Color.brand_green(),
            timestamp=datetime.now(),
            description=self.content
        )
        embed.set_footer(icon_url=self.avatar, text='\
                    Sent by {}'.format(self.author_name))
        embed.set_author(name=self.author_name,
                         icon_url=self.avatar)
        await modmail_channel.send(embed=embed)
        await self.message.delete()```
dense jackal
dense jackal
unkempt canyonBOT
#
Formatting code on discord

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.

For long code samples, you can use our pastebin.

dense jackal
#
class TicketButtons(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.author_name = None
        self.author_id = 0
        self.avatar = None
        self.content = None
        self.message = None
    # If they click reject do this

    @discord.ui.button(label="Reject", style=discord.ButtonStyle.red)
    async def reject(
        self, interaction: discord.Interaction, button: discord.ui.Button
    ):
        await interaction.response.send_message("No new ticket has been submitted. Thank you :)")
        await self.message.delete()

    # if they press accept do this
    @discord.ui.button(label="Accept", style=discord.ButtonStyle.green)
    async def accept(self, interaction: discord.Interaction, button: discord.ui.Button):
        await interaction.response.send_message("A new ticket has been created! Please wait for a staff member to respond.")
        guild = bot.get_guild(1081721180123320413)
        category = bot.get_channel(1081726505496887327)
        admin_role = discord.utils.get(guild.roles, name="Reports")
        overwrites = {
            guild.default_role: discord.PermissionOverwrite(read_messages=False),
            admin_role: discord.PermissionOverwrite(read_messages=True)
        }
        modmail_channel = await guild.create_text_channel(f"{self.author_name}-modmail", overwrites=overwrites, category=category)
        await add_user(discord_user=self.author_id, channel_id=modmail_channel.id)
        embed = discord.Embed(
            title="New Modmail Ticket",
            color=discord.colour.Color.brand_green(),
            timestamp=datetime.now(),
            description=self.content
        )
        embed.set_footer(icon_url=self.avatar, text='\
                    Sent by {}'.format(self.author_name))
        embed.set_author(name=self.author_name,
                         icon_url=self.avatar)
        await modmail_channel.send(embed=embed)
        await self.message.delete()```
#

gusty flax
dense jackal
#

That didnt work…

#

Im on mobile btw

naive briar
#

You can't subclass it

dense jackal
gusty flax
#

Or ui.View

#

That’s what they have…

dense jackal
dense jackal
gusty flax
#

I’m on mobile so give me a sec

dense jackal
#

Alright

gusty flax
dense jackal
#

Idk, am I supposed to send it somewhere

gusty flax
dense jackal
#

Mhm then idk where I send it, a friend did this code lol mmmhhh

gusty flax
dense jackal
#

The class TicketButtons thing?

gusty flax
#

Yes

#

Where u instantiate it.

#

I can’t get back on my pc for like 10-15 minutes

dense jackal
#

Damn alright lemme try to find

#

What should I try looking for?

#

A certain keyword?

#

Found it I tuink

#
            ticketbuttons = TicketButtons()
            ticketbuttons.author_id = ctx.author.id
            ticketbuttons.author_name = ctx.author.name
            ticketbuttons.avatar = ctx.author.avatar.url
            ticketbuttons.content = ctx.content

            confirm_message = await ctx.reply(embed=embed, view=ticketbuttons)
            # This is so the confirm embed is deleted. Don't want errors in our database
            ticketbuttons.message = confirm_message```
#

@gusty flax

naive briar
#

You can just take those as arguments

dense jackal
#

So that’s not it?

slate swan
#

can someone help me with datetime? im working on adding a 'deleted amount of seconds to a snipe command idk how to count the time since the time stored in the db'

vital glacier
smoky sinew
#

what library are you using @slate swan ?

vital glacier
#

will that just be enough

gusty flax
gusty flax
dense jackal
gusty flax
vital glacier
dense jackal
smoky sinew
vital glacier
#

so i dont need to add timeout=... anywhere else in my code, but just there?

vital glacier
#

huh

slate swan
vital glacier
#

now im confused

smoky sinew
gusty flax
# dense jackal Talk in beginner terms

Make a list for now, for the ppl who are in the process. So where u send the view, u want to know that user is storing it. So u add to a list and in that list will be a list of ppl in the ticket or whatever. That means u can’t do it if u are already in the process.

gusty flax
vital glacier
#

ooh

slate swan
smoky sinew
#

motor will convert it automatically

gusty flax
slate swan
smoky sinew
#

yeah just remove str

#

why are you doing .time() too?

naive briar
dense jackal
naive briar
#

!d datetime.datetime.timestamp

unkempt canyonBOT
#

datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time").

Naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.

For aware [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:

```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
```   New in version 3.3.

Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
dense jackal
naive briar
#

🫠

smoky sinew
#

@dense jackal are you making the modmail bot?

smoky sinew
#

wow

dense jackal
#

I only have 2-3 more things and I’m done with it

#

Alot of people helped me tbh, I needed a quick made modmail bot. I’ll learn coding more deeply later

slate swan
# smoky sinew yeah just remove str

ok it posted this to the db. do you know how i could get how many seconds since the current time? i want to add a 'deleted 5 seconds ago' or however many seconds to the bottom of my snipe command

gusty flax
# dense jackal Not rlly tbh

I think reviewing the basics of python would be beneficial before finishing it. A list/array is a required data type for any type of programming.

dense jackal
gusty flax
#

Though a list is:
my list = []

dense jackal
#

That’s like one of the last things I need

gusty flax
#

Do you know what a list is?

dense jackal
#

Like store multiple stuff

gusty flax
dense jackal
#

In one variable

gusty flax
#

It will be a list

#

I resell think u shld just go over basics first. A list is one of the first things u learn

dense jackal
gusty flax
#

I’m not trying to be mean, but I am just hurting ur learning rn 😦

smoky sinew
smoky sinew
#

<t:1678930560:R>

gusty flax
slate swan
gusty flax
#

I really think u shld just go over basics quickly first.

smoky sinew
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.11)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
gusty flax
#

Rushing it without knowing what u are doing will cause more problems.

gusty flax
dense jackal
#

Cause I dont want to have to ask again here any sooner

#

For the same thing again

gusty flax
dense jackal
#
            ticketbuttons = TicketButtons()
            ticketbuttons.author_id = ctx.author.id
            ticketbuttons.author_name = ctx.author.name
            ticketbuttons.avatar = ctx.author.avatar.url
            ticketbuttons.content = ctx.content

            confirm_message = await ctx.reply(embed=embed, view=ticketbuttons)
            # This is so the confirm embed is deleted. Don't want errors in our database
            ticketbuttons.message = confirm_message```
gusty flax
dense jackal
#

Then idk

gusty flax
#

So at the top of ur file, underneath py bot = commands.Bot(command_prefix="=", intents=discord.Intents.all()) do ticketer_list = []

dense jackal
#

On the line under?

gusty flax
#

So before u do ```py
confirm_message = await ctx.reply(embed=embed, view=ticketbuttons)

gusty flax
dense jackal
#

You said do ticketer_list = []

#

Like this?

gusty flax
dense jackal
gusty flax
dense jackal
#

I mean you put ticketer_list earlier so does it have to be the same thing the second time?

gusty flax
dense jackal
#

Alright lol, done

#

What now?

gusty flax
# dense jackal What now?

Then in the first line of the on_message function, do py if ctx.author.id in ticketer_list: return

#

But that wont persist even if bot goes down.

#

That will require a db. But as long as bot is online, this is good.

#

But pls, check out the basics.

dense jackal
#

Lmao alright

dense jackal
smoky sinew
#

why not just save the tickets to the database

dense jackal
#

Okay, can I hug you now, your my life saver

dense jackal
gusty flax
dense jackal
#

Theres a problem @gusty flax

gusty flax
dense jackal
#

I need to remove them from the list when they interact

#

I think

gusty flax
naive briar
#

They can, just not easily

dense jackal
slate swan
#

hey, i have a general question, if i wanted to make custom boost messages when a person boosts the server, how should i do it? is their any event for the boost request for guild updates?

dense jackal
gusty flax
gusty flax
slate swan
gusty flax
#

Ofc there are more factors to consider, but this is simplist.

dense jackal
gusty flax
#

shrug well u determine where u want it to go.

smoky sinew
dense jackal
#

What’s the command tho, to remove them

dense jackal
#

Basically and yes it does help a bit

gusty flax
dense jackal
#

Cause im understanding at the same time

vocal snow
gusty flax
smoky sinew
#

hi zefo

vocal snow
dense jackal
#

It will be easier for me to understand afterwards then

slate swan
smoky sinew
vocal snow
#

Ohh

slate swan
gusty flax
#

I do not think that is the right way to go oop

smoky sinew
slate swan
gusty flax
smoky sinew
gusty flax
gusty flax
smoky sinew
#

from the bot owner's account

gusty flax
#

Which is kinda a rlly weird thing to do.

dense jackal
slate swan
gusty flax
#

This is why u need to review basics.

gusty flax
vocal snow
#

I doubt that; I'm pretty sure they generate html and add the messages via the channel history endpoint, with some css to mock the look of discord's UI

gusty flax
#

It bypasses message content intent.

#

We don't do that here 😄

idle surge
#

Hey, how do you close/delete a dropdown after interacting with that said interaction?

smoky sinew
#

by editing the view to be None

#

or just use View.remove_item

idle surge
#

How would that be formatted at the end of the callback?

smoky sinew
#

actually just do self.clear_items()

#

if you're deleting the whole view

#

@idle surge what does your code look like

idle surge
#

class Inviter(discord.ui.Select):
    def __init__(self):
       options=[
RANDOM OPTIONS
       ]
    async def callback(self, interaction: discord.Interaction):
        rant = random.randint(0, 0xffffff)
        value=rant
        channel = vini.get_channel(1085711629775294516)
        userss = len(interaction.user.voice.channel.members)
        usersize = await interaction.user.voice.channel.create_invite()
        
        embed = discord.Embed(title=f"Need More People!",colour=value, description=f'To invite others to your voice channel simply go to [#1085711668622921988](/guild/267624335836053506/channel/1085711668622921988/)`. \n \n :point_right: [Click this link to join this parties voice channel.]({usersize}) :point_left: \n \n')
        embed.set_author(name=f"{self.values[0]} LFG", icon_url=vini.user.avatar.url)
        embed.add_field(name=":loud_sound: Voice Channel",value=interaction.user.voice.channel.name, inline=True)
        embed.add_field(name=":map: Game",value=f'{self.values[0]}', inline=True)
        embed.add_field(name=":family_mwgb: VC Size",value=f'{userss}/10', inline=True)
        embed.set_footer(text=f'Requested by {interaction.user} | {interaction.message.guild.name}', icon_url=interaction.user.avatar.url)
        await interaction.response.send_message(f"Your invite has been created at [#1085711629775294516](/guild/267624335836053506/channel/1085711629775294516/)", ephemeral=True, delete_after=3)
        await channel.send(embed=embed, view=Close(interaction.user))
smoky sinew
#

what does your view look like though

idle surge
#

So this is basically grabbing the information for the class but the actual view I want to delete is this:

    @discord.ui.button(label="Create Invite", style=discord.ButtonStyle.blurple, emoji="🎮")
    async def blurple_button(self, interaction:discord.Interaction, button:discord.ui.Button):
        channel = vini.get_channel(1085711668622921988)
        embed1 = discord.Embed(colour=0x25F8F8)
        embed1.description ='Click the dropdown and choose the game you are wanting to play.'
        embed1.set_footer(text = 'PC Gaming')
        if not interaction.user.voice:
            await interaction.response.send_message(f"Please join a voice channel. {interaction.user.mention}", delete_after = 3, ephemeral=True)
        await interaction.response.send_message(embed=embed1, view=InviterView(), ephemeral=True)
#
class InviterView(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
        self.add_item(Inviter())
smoky sinew
#

i don't know if this will work but maybe do

self.inviter = Inviter()
self.add_item(self.inviter)
...
self.remove_item(self.inviter)
idle surge
#

Okay, ill try it. Thanks.

#

Got this:
AttributeError: 'Inviter' object has no attribute 'remove_item'

smoky sinew
#

you're supposed to do that in the view

#

or just do self.view.remove_item(self)

idle surge
#

nah, still doesnt work. Just nothing happens. No error.

gilded harness
#

Thats in my PC rn

gusty flax
echo wasp
#

how do i create a list with 100-199, 200-299, 300-399, 400-499 ?

#

besides doing only every single one

echo wasp
#

from 100 to 500

naive briar
#

!e

print(list(range(100, 501)))
unkempt canyonBOT
#

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

[100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
... (truncated - too long)

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

echo wasp
naive briar
#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.11)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
naive briar
#

No

#

Just put datetime object as the timestamp

#

!d discord.Embed

unkempt canyonBOT
#

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

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

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

New in version 2.0.

x == y Checks if two embeds are equal.

New in version 2.0...
radiant bough
#

How do I make slash commands inside a cog

naive briar
#

!d discord.app_commands.command

unkempt canyonBOT
#

@discord.app_commands.command(*, name=..., description=..., nsfw=False, auto_locale_strings=True, extras=...)```
Creates an application command from a regular function.
radiant bough
#

I have this in my cog but I still don’t see the command And I use await bot.tree.sync()

naive briar
#

Send the code

radiant bough
#

of?