#discord-bots
1 messages · Page 16 of 1
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...
how do i make it so that a user can only run one command at a time
cooldown?
no like
if one command is already active, then dont let the user use another command
😳
does anyone here know anything about a voice recording via bot, it seems to be the hardest thing ever to get working, I've been reading github threads and stackoverflow and official api forever and I can't seem to find a solid answer
please
make a custom cache system and use thw on_command event to write your logic


Yeah it's quite difficult, as discord.py doesn't have support for it and the discord API docs don't seem to have anything on it either. FWIW, I believe discord.js supports full voice reception
Kind of like our bot @last ermine
djs 
damn I was afraid I'd have to use js
HOW
😢
dev portal.
is there a way to use python and djs on one bot 
gl
Not without using a bridge.
...
welp thanks guys
dont pollute js with python, the vice versa doesnt apply 'cause no
btw "kech" is not really an appropriate name
async def command(ctx){
await ctx.send('yes');
console.log(f'{ctx.author} launched command')
}
``` i want this lang :lemao:
what is on command i cant find in docs
Yes ash
no-
!d discord.ext.commands.on_command
No documentation found for the requested symbol.
why(
what why would you know that
lol
even I did, we're not weirdos
ok thank

!d discord.discord.ext.commands.on_command
discord.ext.commands.on_command(ctx)```
An event that is called when a command is found and is about to be invoked.
This event is called regardless of whether the command itself succeeds via error or completes.
ahahahah
just what I thought
thats just my online alias I came up with, one that I've had for years I don't give a fuck if it means something inappropriate in moroccan arabic jesus
Ashley is basically a swear word in my local language so it's fine
lol
...
what does this mean discord.errors.HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.
nvm
once a button has been clicked how can the command that sent the button receive information from the button?
the view that has the button would receive an interaction and then execute its callback
result returned None
!d discord.Guild
class discord.Guild```
Represents a Discord guild.
This is referred to as a “server” in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guild’s hash.
str(x) Returns the guild’s name.
ok now no error but it just doesnt find me for some reason
do you have intents? and get_member can return None as well, as its a cache look up
what are intents
im not a bot dev i just assembled some really trashy code for something
!intents
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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.
Well, its needed so your bot can actually see the Member, better described in the links and description above in the embed
but what is the command.Bot
I only have the basic of the basic
clientrd.Client()
and client.run
maybe
comammnds.client?
Well its a creation of an instance of commands.Bot, if youre using discord.Client, you can also pass the intents kwarg to the constructor
What libraries are you using and for what?
That doesn't help me help you
import discord
from discord.utils import get
from discord import Intents
from discord.ext import commands
@primal token not working
just given an error
Technically you could construct a Client like this, but commands.Bot has nice things like proper commands and errors handling
if you imported commands you can use the Bot class for more abstractions, can i see the error and can you show how your intents is setup?
ok ill try
ltierally copy pasted the thing u sent
the embed was sent by the bot to be specific and can you provide the error?
File "D:\Devlopment\Disacord BOt\TGE\main.py", line 69, in <module>
client.run(Token)
File "D:\Devlopment\Disacord BOt\TGE\venv\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "D:\Devlopment\Disacord BOt\TGE\venv\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "D:\Devlopment\Disacord BOt\TGE\venv\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "D:\Devlopment\Disacord BOt\TGE\venv\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x00000298B4DD8310>
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
I don't know what asynchronous database library you are using, but aiosqlite's fetchone method returns either a single item tuple or None (when the column value doesn't exist in the entire table)
You need to enabled the intents youre asking for/setting up.
I did,
intents.members = True
In the developer portal as shown in the error.
Instead of (%s) try writing $1 or ? whichever you prefer
I'm assuming the channelID column type is INTEGER or something like that
Also the second argument to execute needs to be an iterable. (channel.guild.id) reads as channel.guild.id which is of type int (not an iterable)
If you meant to write a single item tuple, add a trailing comma inside the parentheses
Does aiosqlite support $1? I thought that it only supports ?
It supports $1
sqlite3 (a standard library module it aims to write an asynchronous version of) also supports $N
In what sense are place holders "cringe"
I mean ? is worse than $1 for me
Read the error, its quite descriptive and redirects you to the developer portal
In what sense is it worse? appearance? Imo i like the question mark, as it can be referred to as questioning its value
Like here?
in the Bot tab
I use the $N primarily for the fact it forces me to use numbers and then I can't see clearly if I am having a problem of accidentally using too many parameters or too few
They do have one small disadvantage like if you wanna insert same value into several places you gotta provide it several times in args
It all depends on its context lmao
do I need to do something after enabling this?
Me too, in fact I mostly use asyncpg instead of aiosqlite and in aiosqlite docs they use ? and in asyncpg $N, but I didn't know it's possible to use $N in aiosqlite so thanks for the info
Run your code
I miss asyncpg for the fact it doesn't give me an iterable for fetchone with a single column select
Or, at least, I think that's what it did
If I remember correctly
I like that thing tho
It's okay
as it says I didnt enable it
I am trying to create a new text channel on bot join, but its missing intents. what intents do I need?
the line of code: await guild.create_text_channel("contribute-to-the-code")
I don't think any intent is required to create a text channel. I think your bot simply needs permissions to do so
I think manage_channels
okay I just needed a new token
It's a guild permission
How can you tell it's intents issue? What error do you get
403 forbidden permissions
That's not intents issue
As @brazen raft said it's bot permissions issue
Make sure your bot has the permission to create channels
ah
Which if you dont have permissions the endpoint would return a 403 HTTP code, which means ofc forbidden
@scarlet pond
You can check whether you have the guild permission to create text channels with
if guild.me.guild_permissions.manage_channels:
...
or use the commands.has_permissions decorator
@bot.command()
@commands.bot_has_permissions(manage_channels=True)
async def command_function(...):
...
Yeah it works now
How can I repeat a command on error? Instead of them manually retrying the command.
Perhaps reinvoke it with the same context in the command.error handler function
Sure can
btw whats t2.micro ? any idea
I believe it's 1 core 1gb ram
is it enough for a dc bot ?
@commands.Cog.listener()
async def on_message_delete(self, message):
if not message.author.bot:
embed=nextcord.Embed(title="Message delete", description= f"Deleted by {message.author.mention} in {message.channel.mention}",color=0xfd9fa1, timestamp=datetime.datetime.utcnow())
fields=[("Content",message.content,False)]
for name, value, inline in fields:
embed.add_field(name=name,value=value,inline=inline)
if value is None:
embed.add_field(value="_ _")
try:
await self.bot.get_channel(933978399280599080).send( embed=embed)
```can someone help me with this? im trying to make it so that my code will change the value to \_ _ if the deleted message doesnt have any text in it, but im getting the error
Should be
You have to use r"\_ \_" just like you did when you sent this message
Probably
do i need to put the r in front of it?
Unless you want to use "\\_ \\_"
@commands.Cog.listener()
async def on_message_delete(self, message):
if not message.author.bot:
embed=nextcord.Embed(title="Message delete", description= f"Deleted by {message.author.mention} in {message.channel.mention}",color=0xfd9fa1, timestamp=datetime.datetime.utcnow())
fields=[("Content",message.content,False)]
for name, value, inline in fields:
embed.add_field(name=name,value=value,inline=inline)
if value is None:
embed.add_field(value="\\_ \\_")
try:
await self.bot.get_channel(933978399280599080).send( embed=embed)
```i got the same error
The way you are checking whether the value is None and if so use another add_field is wrong
You are still adding the field with the invalid value
And you are not calling the add_field method correctly inside the if
I also see no reason for this to be inside a loop and for having to check the content of the message
what should it be instead of a for loop?
what does TypeError: Client.event() missing 1 required positional argument: 'coro' mean?
No looping is necessary as I see your code uses the content of the message once to add the field
Message content is never unfit for an embed field, I believe, so no checking has to be done, too
.
You should not post your bot token.
idc, And it's not all of it
The only reason you get this error that I can think of is that you used asyncio.run - or some similar function - already
youre still showing its most important part, so please reset it.
Also rename client to bot so it depicts its variable correctly
You are using commands.Bot, after all, not discord.Client
i got it, thank you so much Roie
how to get the column name in sqlite3?
here is my table :
id | sword |shield
12| 2 | 1
i want to send the user an embed containing :
sword : 2
shield : 1
i know already how to get the numbers of each item but i don't know how to get the column names (sword/shield) any help?
iam using aiosqlite python library btw
you’re not answering his question to be honest
Why does it only prints it's self?
enable intents
yes
it could potentially be a bug with the library. i have no clue why that happens
yes
Why does it not happen to you
no idea
we're using the same library...
that can be done better and your token lol and your missing intents
I already fixed that error
cool
show it fully
well are you trying to do tasks with the EventLoop?
That means?
that can be done better btw
time.sleep...
That's not the case here...
Can you do it for me?
reset your token and you need to enable all of the intents youre asking for, aka all the privileged intents
you forgot one
👍
The bot has administrator and above all the roles...
@slate swan
@client.command()
async def everyoneisharyad(ctx, member = discord.Member):
n = 1
for member in ctx.guild.members:
await member.edit(nick=f"Haryad V{n}")
n += 1
time.sleep(0.5)
you really shouldnt use time.sleep, and why is the member argument for? and you can use enumarate
What do I do now
the bots trying to edit people above it
skip it in the for loop
the owner is also a person it can't edit
@client.command()
async def everyoneisharyad(ctx, member = discord.Member):
n = 1
for member in ctx.guild.members:
try:
await member.edit(nick=f"Haryad V{n}")
n += 1
time.sleep(0.5)
except:
pass
it's for the good
no
just pass the exception smh
what do you mean
he used a bare except, which he could just pass the exception which is CommandInvokeError
!d discord.ext.commands.CommandInvokeError
exception discord.ext.commands.CommandInvokeError(e)```
Exception raised when the command being invoked raised an exception.
This inherits from [`CommandError`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError")
message.author.roles == 1002972472913707080
not working
message.author.role.id == 1002972472913707080
not this to
i want has_role check on message listner
Why does this code:
async def main():
[await bot.load_extension(f"cogs.{file[:-3]}") for file in os.listdir("main\cogs") if file.endswith(".py")]
await bot.start(token)
asyncio.run(main())```
Give this error:
```discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.inventory' raised an error: RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'main' was never awaited```
await asyncio.run
Add await.
Okay thanks
no
the error means that you're trying to do asyncio.run() where there's a running loop already
i have a code that tells server roles and it works fine heres the code: py @bot.command() async def allroles(ctx): embed = discord.Embed(title=f"""{ctx.guild.name} Server Roles: """) output2 = "" server = ctx.message.guild role_id = server.roles[0] for role in server.roles: if role.name == "@everyone": print("it´s everyone role") else: output2 +=f"{role.name} \n" await ctx.send(embed=embed) await ctx.send(output2)
and the command works like this:
and i want to make the bot send the roles in a embed
how can i make that?
Put your output in the description or a field of the embed
@bot.command()
async def allroles(ctx):
embed = discord.Embed(title=f"""{ctx.guild.name} Server Roles:
""")
output2 = ""
server = ctx.message.guild
role_id = server.roles[0]
for role in server.roles:
if role.name == "@everyone":
print("it´s everyone role")
else:
output2 +=f"{role.name} \n"
embed.description = output2
await ctx.send(embed=embed)
@novel prairie
hm
im new to dev
@bot.command()
async def allroles(ctx):
embed = discord.Embed(title=f"""{ctx.guild.name} Server Roles:
""", description=f""
output2 = ""
server = ctx.message.guild
role_id = server.roles[0]
for role in server.roles:
if role.name == "@everyone":
print("it´s everyone role")
else:
output2 += f"{role.name} \n" "")
embed.description = output2
await ctx.send(embed=embed)
await ctx.send(output2)``` like that?
sorry if i did something wrong im new to dev
can u check if i did something wrong?
You're missing a ), and you're sending it twice, once in the embed, then again after sending the embed
The code that I sent should be working
thanks it worked
Hii , i want my bot presence , watching something and also in profile a link with the image 😳
I can i do that ?
check pinned messages
Read that
who made that gist?😳
Okimii !!
🙀
anytime!🫂
yw bro
Hmm done , but i want if user click on bot it shows just like on @slate swan profile vs code showing , but in watching manner !!
pretty sure you can't add images on bots presence'
sadly bots cant have rich presences😔
yeah
🥲 uff , links ? 🤔
Not a good idea
oh
:((
Create a command 😳
@white aurora
what?
How much a on_message function put pressure on bot ?
If 300-400 users there !
Will t2.micro able to manage it ?
Might be cutting it close but should be fine, depends on the activity of those 300-400 members of course
For the longest time now, I've always also thought that changing presence in on_ready was an issue. But looking at many other libraries (mostly in different languages) such as DJS have all be setting presence in READY event with no issue at all
Is this just a python issue?
I don't think so.. maybe it's just a one-off sort of deal where you have a chance to get disconnected from the websocket?
And maybe the other libraries you mention think it's not that big of a deal
Premature disconnection is a pretty big deal isn't it?
The question I've always had is, changing presence happens over the REST API, and on_ready happens after you establish contact with the gateway, which is a websocket, so I'm not sure why those 2 interfere
And there is no warnings in the other libraries
Changing presence does not happen over REST
It's a gateway command
Do you mean where you pass it into your IDENTIFY i believe it is?
its not related to python, its just a waste of dispatching an event thats identical to one thats already been dispatched which the real main issue is since on ready can get dispatched many times you send useless events to the gateway and iirc it can get you disconnected from the gateway or something like that which bluenix told me about
The one passed into IDENTIFY is the one you pass into your client constructor, right?
Yes but you also have a separate gateway command to change presence
Correct
That's what the change_presence uses to set presence
It's not over rest, but infact a gateway command
The gateway ratelimit is 120/2s meaning 60/1s commands, calling PRESENCE_UPDATE over and over again like you say isn't gonna get you disconnected in NORMAL use cases
I doubt your bot sends READY more than that amount?
That might make more sense as to getting disconnected.. maybe Discord doesn't like receiving gateway commands so soon after identification, though I wish Discord themselves had a little blob on it on their API page. If they do, I probably missed it
?
I send HEARTBEAT as soon as I identify
No issue at all, why does discord not like receiving gateway commands after identification quickly?
Is this stated anywhere officially?
That's what I wish existed
How can I use 1h or 1hr as input
So what are your basis
😳
I'm only speculating as like you mentioned, discord.py seems to be the only one doing it, and there's no official information on it
i never said it can nor did i mention ratelimits as i know that it wont affect anything
Generally seems like there's not too much reason to do it
"many times you send useless events to the gateway and iirc it can get you disconnected from the gateway "
Exceeding the GATEWAY ratelimits instantly disconnects you from the gateway
Unlike the REST ratelimits
iirc i never said my statement was correct and i did say "or something like that which bluenix told me about"
I'm not at all seeing anything here about that
"nor did i mention ratelimits as i know that it wont affect anything"
Your whole argument is that, READY is dispatched more than once during conventional life-time of a bot
I'm refuting you because READY doesn't get called enough IN REGULAR USE cases that exceed the 120/2s 60/1s gateway command ratelimit
Which if it did would result in an instant disconnection from the gateway
Does your bot dispatch READY 80 times in 1 second?
i never said it was due to ratelimits, either way i cant really recall the reason lol
Okay you didn't say it was due to ratelimits but that's simply because you don't know about it?
"real main issue is since on ready can get dispatched many times you send useless events to the gateway and iirc it can get you disconnected from the gateway or something like that which bluenix told me about" is basically saying, exceeding ratelimit (which I didn't know) disconnects
so your point is saying that i dont have a valid reason because i cant recall a certain event?
??????
im not saying im right nor did i say i was, i just said it was something along the lines as i cant recall what bluenix told me
¯_(ツ)_/¯
I'm refuting your argument because answer me this, does your bot dispatch READY 60+ times per second?
Just because you cannot recall a certain event does not mean it doesn't exist
?
I can pretend that ratelimits don't exist all I want, but surprise surprise they still do exist isn't that crazy
i never said ratelimits dont exist and i never said the reason was due to ratelimits lol
And I'm telling you your argument is using ratelimits as the basis
ok, great
"real main issue is since on ready can get dispatched many times you send useless events to the gateway and iirc it can get you disconnected from the gateway or something like that which bluenix told me about"
???
its just the dispatching of useless event but it still wouldnt be enough to get you ratelimit if it was on each call of on_ready
i think i was just mixing one of my memories about changing your presence in a certain time frame
how can I when I write a command that it is deleted immediately afterwards?
you can just use ctx.message.delete() I believe.
!d discord.Message.delete
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
this might help you https://discordpy.readthedocs.io/en/stable/intents.html
hey guys im working on a discord bot to send the same message across different servers, but i cant figure out how to send the image or file attached to the command message, can som1 help me pls?
What's your current code look like?
is it possible to use client.event and bot.command in the same bot
someone told me to use client.listen
You shouldn't be using both bot and client
prolly cus my friends cant use that command
it can return a User or a Member which if you convert it to a string the str dunder does return the name and discrim iirc
The __str__ does, yes
well i want to have commands like joined but i also want a on_member_join
use a listen
You can use commands and events alongside each other, yes
Probably because you're using bot and client
I recently migrated my bot's slash commands to discord py 2.0. My commands are all working, however, the details haven't updated in the slash menu for my guilds. For example, here I have a command that I changed the description for, and I haven't been able to figure out how to add a mandatory parameter with discord py. But the command still works, it shows the old description and parameter in the slash menu.
@app_commands.command(
name=FOLLOW_COMMAND,
description="Follow a spotify artist",
)
async def follow_artist(self, interaction: discord.Interaction, artist_link: str):
so is it possible to use both
Easily, yes
if your updating globally it can take a while
how?
Have you synced? If it's global, it can take up to 1 hour to propagate
^^
That's where I'm confused, I made the change long ago at this point, and have even added the bot to brand new test servers
bot = commands.Bot(...)
@bot.listen()
async def on_member_join(member: discord.Member) -> None:
...
@bot.command()
async def my_command(context: commands.Context, ...) -> None:
...
I haven't.... how can I sync? In the bot's initialization? And how can I sync for all guilds?
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").
Example...
pls how do i access a command message's attachment?
!d discord.app_commands.CommandTree.sync
await sync(*, guild=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Syncs the application commands to Discord.
This must be called for the application commands to show up.
You can sync in your setup_hook
Robin knows everything
Just pass in no parameters and it will sync for all guilds?
Only when it comes to discord bots 😅
For real, has been such a huge help 
!d discord.Message.attachments
A list of attachments given to a message. If Intents.message_content is not enabled this will always be an empty list unless the bot is mentioned or the message is a direct message.
Right, sync w/o any params will sync globally (this is what takes 1 hour to propagate), and if you pass a guild (for a test server, for instance) it should be instant
And if you need the url you can do .url to the attachment object
ikr, robin is a cutie😳
attachment = ctx.message.attachments[0]
print(attachment.url)
iirc...
you know whats cuter, robins examples😳
return annotations 😍
im joking robins examples arent that bad 🏃♂️
so how would i use that, "await ctx.channel.send(discord.Message.attachments) " ?
No?
yeah i strive to make my examples mediocre 🙄
ctx.message.attachments -> List[discord.Attachment]
Your examples in the dpy repo are mediocre, they better be better now, cuz youre a helper 🔪
@slate swan Did you even finish your code jam?
When new features come out, I'm the first to make an example haha
thanks for the help guys i do appreciate it, ill try rn
robin is danny's son confirmed?
no i just have all the notifications and whatnot turned on
Damn nice
Not to mention news spreads fast in this community
lol
i was one of the first ones spreading the gist when it revived lmao good times
iirc i was the first one who posted it in this channel
everyone couldnt believe it until they checked the dpy server lol
@loud shard you might get list index out of range, just means the command didn't have a file attached
it dindu
try sending the command without an attachment
do i have to put a asterisk or somn?
what's your code
means there was no attachment
I'm trying to write a script to play mp3 files in discord without any user commands, and I was told discord.py can only do that through commands, so I downloaded voicemeter
yea i sent the command without an attachment
but I can't get it to play sound through my mic. does anyone know of a way to do this?
or has anyone used voicemeter by any chance
"Play sound through mic" how? Microphones are input devices
LOL
I'm just trying to understand here
How we can make our bot send custom emojis?
<:emoji_name:emoji_id>
i got it 2 work, but if i wanted to send multiple attachments in a message would i have to use a "for len(list) to send each attachment?
try it out
that would be a slash command
and it would be treason on my part to help with slash commands
voicemeter is software that takes computer output sound and pipes it into an input device like a mic
but I don't know how to use it and the tutorials are not helpful
and I was wondering if there was another way to play mp3 files in a discord voice server with a python script that doesn't require user commands in a text channel
not really, it creates a "virtual" device/mic in which the program (discord, etc) will use
you've used it?
so it's possible I could use it to have python play an mp3 file in my voice channel?
you want to make a soundboard? or a discord bot that plays mp3 file?
no my actual end goal is akin to a personal assistant. I've got a script with speech to text that can listen to my mic and call functions when I give certain commands
How to respond to a discord interaction / slash command with a message that only the issuer can see? (DPY 2.0)
ephemeral=True
For example in this case, I have a slash command limited to admin permission. If anyone else tries to use it I want the bot to tell them they can't but not send an actual message for everyone
is it possible to have a list of for example bad words and check if the message a user sent is in one of the bad words
list
Pass this into send_message()?
and I recently discovered resemble.ai, which has really realistic text to speech
i think depending on your library, but most use ephemeral
interaction.response.send_message()
Yup I see the parameter, ty!
so I'd like to make a script that when I ask it questions, it uses the resemble.ai api to answer them
either with prerecorded answers or hooked up to a chatbot api like gpt3
okay and you want to send that API response to the voice channel?
precisely
mkay so I think you need to make a virtual input device, pipe the API response to that, and set up Discord so it accepts the virtual input device
i don't know how to do that though
my voicemeter panel looks like this
but I've tried switching all of the sound settings so they use the virtual input
and trying to get it to pipe any output sound into input sound has been unsuccessful
this page right?
you're supposed to change Input Device to that vb audio thing
yeah when I do that, it picks up no sound from my 2-plantronics headset
so the API response is there, but no sound from the actual headset?
I haven't coded the api code
I've been trying to test this first by getting something like a youtube video or system sound to play through my mic
so the end goal is to have both the api response audio and my voice coming out of the virtual input
but right now neither does
i want a list of users to show while typing in /hello, how can i add that option or whatever it's called to my code?
Seems like something @sick birch would know
If it was discord.py, I would, but it's not unfortunately.. my knowledge is quite limited in scope 😔
But, as a library-agnostic solution to point you in the right direction, I'm guessing you would have to pass in your libraries discord.Member equivalent to the first parameter of Option (which is currently str
https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_options.py
the discord.option decorator
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_options.py at master · Pycord-Development/pycord
well make sure they are for pycord because all libraries have their own implementations
you can always refer to the examples folder of the library on github for clear examples with explanations
yep
how do i delete a message
!d discord.Message.delete
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
thanks
np
is it possible to get the user's ID from this?
property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.id "discord.User.id")
how to record audio from
voice channel ?
@royal bone
should i make my whole bot in js?
i guess it's easier to use only js
but you can try using both langs
what is a bridge?
can someone help me? I don't know the syntax for the lines with comments
@client.event
async def on_guild_join(guild):
if "channel-name-blah" not in guild.text_channels:
await guild.create_text_channel("channel-name-blah")
# send message in "channel-name-blah"
else:
# send message in "channel-name-blah"
error:
raise RuntimeError('Task is already launched and is not completed.')
RuntimeError: Task is already launched and is not completed.
Code:
async def on_message(message):
if message.author == bot.user:
return
if message.author.bot: return
if "hello" in message.content.lower():
await message.channel.send("Hello")```
how does message.channel.send work if its not in the function
wdym bro i just didnt format the code that i sent here right, but on my actual code it is formatted correctely
oh ok
what line is the error on
because im using if "hello" in message.content.lower():
instead of if message.content.lower() == "hello":
yeah
idk why
you should try using if/else statements
if (boolean):
# do something
else:
#do something
and how does that fixes it?
wait have you done programming before or just started
no that is a bunch of if statements
with open("/Users/bai/Documents/Personal Things/PythonDiscord/log.txt", 'a') as f:
f.write(message.content + '\n')```
i have this as my else command
else if?
@slate swan have u fixed ur error?
not yet
it keeps sending it because u haven't processed it
then how to process it?
await bot.process_commands(message)
it should be like this
you should use listen
where do I put that at?
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.author.bot: return
if "hello" in message.content.lower():
await message.channel.send("Hello")
await bot.process_commands(message)```
I already have that added though
create_text_channel returns the channel
and it doesn't stop the spam
and I just do .send?
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
ah ty
it should be like this
if message.content.lower() in ("hello"):
no?
no they were correct
😳 😳 😳
also parenthesis aren't needed
ik
go learn python dude,that's not correct
!e
mes = "zeffoisuwu"
if "zeffo" in mes:
print("uwu")
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
uwu

wait you can do that
yeah
how's it not correct? 🤔
It is syntactically correct
exactly
What's the proper way of getting the message.author's connected_accounts? I see the Profile stuff is deprecated
what about in the case the channel already exists
what are connected_accounts?
spotify yt git etc
i see
u could always use the raw api urself
Which endpoint?
I don't see that returning accounts
it werkd :]
https://discord.com/developers/docs/topics/oauth2 connections scope
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Oh I see, so I add the bot with the connections scope, and then what do I do in code?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
That's the endpoint
Not sure what it is in dpy
nothing..
Can you edit a bot's scopes afterwards or have to remove and add to server again?
The latter i think
I don't think that works to get an user's connections, only for the bot's
Unless I'm doing something wrong
well looks like it actually is
only for bot
How do I get an user's connections then? I.e. if I wanted to create a /twitter bot command which returns their Twitter account
Well, you're missing the API version
Worked for @me without
Though you can only get yours, which kind of makes sense
Well then it doesn't need the version, yet again Discord consistency I guess
I want to get the message.author's connections. Used for verifying them via their socials
Well it's very simple: you can't
wow
Why is it in the discord.py docs then?
Where/what version
Deprecated since version 1.7.
So most endpoints are dead and/or deprecated as of right now, hence why it's no longer in newer updates
The 404 on Discord's API clearly indicates the endpoint got removed, otherwise you'd get an error 401 or 403; I believe that's the error code for the other endpoints.
its listed in the documentation though
In which documentation?
the discord api documentation
yes, but there should be some way for an application to access that
why would it be listed there otherwise 🤔
OAuth
Not bot applications
connections is an oauth scope
allows /users/@me/connections to return linked third-party accounts
discord.errors.Forbidden: 403 Forbidden (error code: 20001): Bots cannot use this endpoint
Is there a workaround for that?
I've looked it up and seen some "user bot" solutions but don't really know how to make that happen
Couldn't care less tbh
!rule 2
2. Follow the Discord Community Guidelines and Terms Of Service.
okimiii 👋 👋
I have no clue how Oauth works but is there no way at all to integrate it with a bot application?
hi okimii
Maybe they should fix their shit API then
Not if you don't make a bot login page on a website and then link it together
There's nothing to fix, and it's far from being "shit".
hello zeffo and master✌️
and i see you krypton👋
Well gotta go, trains are cancelled and/or late for my second day at new work 
oof work, im unemployed 
how to edit past message 💀
arent u in 10th grade or something
!d discord.Message.edit
await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
bro who provided you with that information🗿
thanks
he is definetly above 20
im only 15
isnt 15 >= 20? :lemao:
🗿
oki's age is dynamic
probably because his dad is Danny
now that i look at it, age is dynamic all the time
time is relative like einstein said
my dad is Guido😳
ok
ok
!e
from ctypes import c_char
cbase = (c_char*7).from_address(id('python')+48)
cbase.value = b'okimii\0'
print('python')
@paper sluice :white_check_mark: Your 3.11 eval job has completed with return code 0.
okimii
youre evil for using ctypes
@paper sluice youre so evil you probably pour the milk before the cereal🤬
🥴
i dont eat cereal
😎
java is my fav lang 😳
How
im not sure if theres a place worse than hell😔
Ryuga youre going to a place where python is replaced by Swift
😳
never
oh and @silk fulcrum i saw that mr

:shh:
!e
from ctypes import c_char
from fishhook import hook
@hook(str)
def greplace(to_be_replaced: str, replacement: str):
replacement = f'{replacement:<{len(to_be_replaced)}}'
l = len(replacement) + 1
cbase = (c_char*l).from_address(id(to_be_replaced)+48)
cbase.value = bytes(replacement, 'utf-8') + b'\0'
'python'.greplace('swift')
print('python')
already there 😎
bozo
@paper sluice :white_check_mark: Your 3.10 eval job has completed with return code 0.
swift
smh using ctypes
your father made cpython, think about it
mhm
Bruh forbidden fruit
you say that like you arent forbidden in 51 countries
I should be locked up in the strictest jail on earth bruh for life, yet I am walking alive and free
anyways ot.
thats what im saying🗿
on_message: check if message contains bot mention (via message.mentions), get prefix, send it
alr
!d discord.ext.commands.when_mentioned
discord.ext.commands.when_mentioned(bot, msg, /)```
A callable that implements a command prefix equivalent to being mentioned.
These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.
> Changed in version 2.0: `bot` and `msg` parameters are now positional-only.
>
>
Ah that
and how to make my bot delete an embed message after 10 seconds?
await ctx.send(embed=embed, delete_after=10)
ok thanks bro
how to set a embed image/gif?
and how to put python variable in embed?
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
and for the second question.
how?
rannum = ['1',
'2']
em = discord.Embed(title=f"You got {rannum}!")
!e @bot.command() async def ping(ctx): await ctx.send('Pong!')
how to put python variable in embed?
!e ```import discord
from discord.ext import commands
import json
import os
key = "e"
client = discord.Client()
bot = commands.Bot(command_prefix = '.')
random = ['MayBe' , 'Yes' , 'No' , 'Probbly' , 'Likey' , 'unlikey']
@bot.event
async def on_ready():
print("BOT ONLINE")
channel = bot.get_channel(1004036302594920508)
await bot.change_presence(activity=discord.Game('Sky Craft '))
await channel.send("I Am Reloading :orange_square:")
await channel.send("Done Reload :white_check_mark:")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith("!user"):
await message.delete()
await message.channel.send(f"Hello {message.author}")
if message.channel.id == 1004054901787201646:
channel = bot.get_channel(1002154446442209393)
await message.delete()
await channel.send(f"Test bot Server » {message.author} » {message.content}")
if message.channel.id == 1002154446442209393:
channel = bot.get_channel(1004054901787201646)
await message.delete()
await channel.send(f"Sky Craft » {message.author} » {message.content}")
if message.channel.id == 1002154446442209393:
channel = bot.get_channel(100215444644220939)
await channel.send(f"{message.author} » {message.content}")
if message.channel.id == 1004054901787201646:
channel = bot.get_channel(1004054901787201646)
await channel.send(f"{message.author} » {message.content}")
#-------------------------------------------------------------------------------
@bot.command()
async def ping(ctx):
await ctx.send('Pong!')```
f string or if the var is a string just put in desc or field value or something
did u just try to run a discord bot 💀
show how
wdym
!f-strings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
^^
what are u trying to do get a random number?
yeah
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
rannum = ['1',
'2']
em = discord.Embed(title=f"You got {random.choice(rannum)}!")
yes?
!e
import random
x = random.choice([1, 2])
print(f"{x}")
@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.
2
yes
k
@commands.cooldown(1, 10, commands.BucketType.user)
async def coinflip(ctx):
coinside = ['`Heads`',
'`Tails`']
em = discord.Embed(title=f"Flipping a coin!", description=f"will it be heads or tails? :)")
em.set_image(f"https://media.giphy.com/media/V57jUkC3eZFsym7iwE/giphy.gif")
await ctx.send(embed=em, delete_after=5)
await asyncio.sleep(5)
em = discord.Embed(title=f"You got {random.choice(coinside)}!")
await ctx.send(embed=em)```
something is wrong with my code its not working
@bot.command(name="coinflip")
@commands.cooldown(1, 10, commands.BucketType.user)
async def coinflip(ctx):
coinside = ['`Heads`', '`Tails`']
em = discord.Embed(title=f"Flipping a coin!", description=f"will it be heads or tails? :)") em.set_image(url=f"https://media.giphy.com/media/V57jUkC3eZFsym7iwE/giphy.gif")
await ctx.send(embed=em, delete_after=5)
await asyncio.sleep(5)
em = discord.Embed(title=f"You got {random.choice(coinside)}!")
await ctx.send(embed=em)
what did u change here?
still no work
whats the error?
no error shows nothing
are u sure u are using the code i gave rn
yes i am
urs dosent have url=
oh
em.set_image(f"https://media.giphy.com/media/V57jUkC3eZFsym7iwE/giphy.gif")
now it works
it works now, thanks bro
Guys why i am getting this error even i have given the function the url of image
send your code
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
if image is a url you should do embed.set_image(url=image)
@bot.command()
async def info(ctx,pokemo):
pokemo = pokemo.lower()
poke = pokemon(pokemo)
num = poke.number()
image = poke.image()
embed = embeds(f" :emoji_3: #{num} {pokemo}","** **",discord.Color.green())
embed.set_image(image)
await ctx.send(embed=embed)
Ok
Thanks it worked!
Yeah
What bout those
try running bot via console
(AKA Terminal in PyCharm)
Ok so in terminal what do i do?
py filename.py
Ok hold on
Give me this
is it possible to do verification on a button in plain discord.py? If so, how?
are you in the same directory of bot.py?
I think so
show us file structure
show with token
rude
Where do i get that
here on left
first your file is Bot, not bot
and second it's not py format
it should be bot.py
not Bot
rename it
.
what is the problem? do verification system and move it to button's interaction
Now it shows this
yes, now run py bot.py
Give me this
well, that's not the whole token but showing it is not good idea anyways
pip install discord
I will reset it
Gave me a whole long list
idk what does that mean, but i guess discord package installed so now you can run py bot.py
Tell me this
yeah, you'd better just do intents = discord.Intents.all() instead of those 2 lines, you don't need to care a lot about intents rn
run it via Terminal
what?
screenshots are 100% easier to read than a photo
yeah...
thx for the token
discord is also available on laptops
I already reset it😂
Well log in to discord on your browser on the laptop, not only that you are putting yourself at massice security risk constantly showing your token. Do you have any basic python knowledge btw?
I reseted my token like before i sended the message
Yeah sort of
You can't off, you didn't even know how to name a file. My best advice would be to is learn some basic understanding of coding before delving into this.
How can I use the local image in set_thumbnail?
Don't Bruh me thanks, yet still a media question.
Bro it's related embed of discord.py
I not able to understand
I have a file called
poke.png
I want to use it in embed
Help pls
image_file = discord.File("poke.png")
e = discord.Embed(title="some useless stuff here", description="look at my local image")
e.set_image(url="attachment://poke.png")
await ctx.send(file=image_file, embed=e)```
oh wait me dumb
Oh thanks
like that, edited
Ok
set_image takes a url kwarg, it doesnt take any args
oops
this error on my slash command here is code ```py
@app_commands.command(name="post", description="post a gamepass")
@commands.cooldown(1, 3600, commands.BucketType.user)
async def post(self, interaction: discord.Interaction, gamepassID: str):
#view = discord.ui.View() # Establish an instance of the discord.ui.View class
#style = discord.ButtonStyle.blurple # The button will be gray in color
#gamepass = discord.ui.Button(style=style, label="GAMEPASS", url=gamepass)
#view.add_item(item=gamepass)
gamepass=requests.get(f"https://api.roblox.com/marketplace/game-pass-product-info?gamePassId={gamepassID}").json()
embed=discord.Embed(description="your gamepass has successfully been posted in | #1004310613146734682",color=color.color)
await interaction.response.send_message(embed=embed)
channel = self.client.get_channel(1004310613146734682)
embed=discord.Embed(title=f"new post from {interaction.user}", description=f"donate bobux to {gamepass['Creator']['name']}\n `Robux` = {gamepass['PriceInRobux']}\n`gamepass` = **https://www.roblox.com/game-pass/{gamepassID}/{gamepass['name']}**",color=color.color)
await channel.send(embed=embed)
read the last line
i did?
channel = self.client.get_channel(1004310613146734682)
@slate swan
i got that
? how is getting a channel related to syncing a command
thats for the command?
should i take it out then add it? after?
well if you read the error ....
its still not working?
how did you sync
@commands.command()
@commands.is_owner()
async def sync(self, ctx):
op = await self.client.tree.sync()
await ctx.send(f"```py\n{str(op)}```\n**DONE.**")
sync cmd
did you use the command before running your post cmd?
yea
wanna see full error
@slate swan
the command was fine intill i added
this
gamepassID: str
send the full traceback yeah
does the gamepassID option appear on discord bte?
Is that in a cog?
yeah seems like that
How to fix
using a laptop or desktop would be a good start
No... it doesnt matter
ive made bots on mobile.
i just dk why it wants a uri when ive selected scopes
@vocal snow
it generates the url...
what scope did yu select
Bot then admin
hmm should work, maybe uncheck and recheck
what is telling you that it didn't work
super weird
with open ("./configuration.json","r") as config:
bot_token = config["BOT_TOKEN"]
prefix = config["PREFIX"]
guild_id = config["GUILD_ID"]
staff_guild_id = config["STAFF_GUILD_ID"]
manager_role = config["TICKET_MANAGER_ROLE_ID"]
logs_channel_id = config["LOGS_CHANNEL_ID"]
mute_role_id = config["MUTED_ROLE_ID"]
have I gone blind?
wait me dumb
I tried it and it generated the url for me
are you sure you selected stuff?...
it only asks for redirect url if you select something other than bot
FIXXED it
json.load your file object
wait so how exactly
i need help with a cool down error for slash commands
sorry its been a long time since I have done this
json.load(config)
@commands.Cog.listener()
async def on_app_command_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
if isinstance(error, app_commands.MissingPermissions):
embed=discord.Embed(color=color.color,description=f"you are missing the **permission(s)** ``" + ", ".join(error.missing_permissions) + '``')
return await interaction.response.send_message(embed=embed)
elif isinstance(error, app_commands.MissingRequiredArgument):
embed=discord.Embed(color=color.color,description=f"you are missing a **required argument** ``{error.param}``")
return await interaction.response.send_message(embed=embed)
elif isinstance(error, app_commands.CommandOnCooldown):
embed=discord.Embed(color=color.color,description=f"cooldown, try **again** in ``{error.retry_after:.2f}s``",ephemeral =True)
await interaction.response.send_message(embed=embed)
error still
it's not app_commands.cooldown, it's app_commands.CommandOnCooldown
in your isinstance
what's new code?
@commands.Cog.listener()
async def on_app_command_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
if isinstance(error, app_commands.MissingPermissions):
embed=discord.Embed(color=color.color,description=f"you are missing the **permission(s)** ``" + ", ".join(error.missing_permissions) + '``')
return await interaction.response.send_message(embed=embed)
elif isinstance(error, app_commands.MissingRequiredArgument):
embed=discord.Embed(color=color.color,description=f"you are missing a **required argument** ``{error.param}``")
return await interaction.response.send_message(embed=embed)
elif isinstance(error, app_commands.CommandOnCooldown):
embed=discord.Embed(color=color.color,description=f"cooldown, try **again** in ``{error.retry_after:.2f}s``",ephemeral =True)
await interaction.response.send_message(embed=embed)
client.command()
async def allname(ctx, member = discord.Member):
n = 1
for member in ctx.guild.members:
try:
await member.edit(nick=f"Haryad V{n}")
n += 1
time.sleep(0.5)
except:
pass
I have this but I want to do
?allname Haryad
How do I do it? 🥲
im not sure if there is on_app_command_error listener
member**:** discord.Member
could you maybe check?
?
No I want to use the command to change everyone's nickname
?allname Haryad
?allname asdoyuifgasd8fgqwed
bro?
HES TELLING YOU HOW TO FIX IT
@client.command()
async def allname(ctx, member = discord.Member):
n = 1
for member in ctx.guild.members:
try:
await member.edit(nick=f"{member} V{n}")
n += 1
time.sleep(0.5)
except:
pass
So like this?
...
no?
and you also might not have a member named like your query, so it'd be better to do member: str
@client.command()
async def allname(ctx, member: str):
n = 1
for member in ctx.guild.members:
try:
await member.edit(nick=f"{member} V{n}")
n += 1
time.sleep(0.5)
except:
pass
ok so i need to make a custom error for each commando?
What are you passing member arg for if it gets its value from the loop?
comman*
idk what im doing
to name everyone like that member
me2
idk, i don't use slash commands so don't know much about them
@silk fulcrum DANG IT
Do you need the n += 1 thing?
ill check docs @slate swan
tysm
for version
Yes
@client.command()
async def allname(ctx, new_nick: str):
n = 1
for member in ctx.guild.members:
try:
await member.edit(nick=f"{new_nick} V{n}")
n += 1
time.sleep(0.5)
except:
pass
Ummm, It doesn't work
.
Send the error
I don't get an error
huh
Now it works
good
Thanks ❤️
no problem
for who did write all this?```py
import asyncio
@client.command()
async def allname(ctx, *, name: str):
n = 1
for member in ctx.guild.members:
try:
await member.edit(nick=f"{name} V{n}")
n += 1
await asyncio.sleep(0.5)
except:
pass```
@silk fulcrum find anything
yeah, i found on_error for CommandTree, but I guess you don't use it
is thjere a way i can make a error just for that command?
Yeah this would be better
async def allname(ctx, *, new_nick: str):
yes?
can you make it for me just for cooldsown
When I give a space it doesn't work, For example (Hello World), But (Hello_World) Works
yeah change this
add the , *,
Thanks
@some_app_commands_decorators()
async def mycommand(...):
...
@mycommand.error
async def mycommand_error(self, interaction: discord.Interaction, error):
if isinstance(error, app_commands.CommandOnCooldown):
e = discord.Embed(color=color.color, description=f"cooldown, try **again** in ``{error.retry_after:.2f}s``")
await interaction.response.send_message(embed=embed, ephemeral=True)```
@slate swan i guess this
mycommand replaced with your command name
