#General Help
1 messages · Page 10 of 1
✨ Read the docs ✨
Hi, how to fix that?
https://prnt.sc/WiJrk9vVuKVN
Use: bridge
This error appears when using the normal commands but slash command its work
Error: ```
'Context' object has no attribute 'respond'
change ctx: comands.Context to just ctx
you are forcing it to be a commands.Context while it is actually a bridge context
The same error appears
does it not work?
not work
work now
This should be like this bot = commands.AutoShardedBot(.....) TO bot = bridge.AutoShardedBot(.....)
gj
have any example to get application_id by name?
Hi so I'm trying to dynamically set the options for a select menu through class variables though @discord.ui.select doesn't seem to have access to the class (dosen't have access to self). The code snipped bellow represents what I'm trying to do. Any way to get around this?
def __init__(self, ctx):
super().__init__(timeout=15)
self.ctx=ctx
self.feature = None
self.options = []
for feature in features:
self.options.append(discord.SelectOption(label=feature["friendly_name"], description=feature["description"]))
@discord.ui.select(
placeholder = "Choose a feature to setup!", #
min_values = 1,
max_values = 1,
options = self.options
)
Can the options field access self?
what if you inherited from discord.ui.Select and added an instance of it with view.add_item
instead of initializing the variable in __init__ i just defined the variable in the class scope which seems to have fixed the issue without too much trouble
that works
Can someone please give me a list of reaction ids?
#969691826078482442
Use : bridge in normal command not work how to fix?
https://prnt.sc/1Prgjl4y13vY
how can i cache member in voice only?3
Application Command raised an exception: AttributeError: 'LinkageButtonsView' object has no attribute 'disable_all_items'
```Not sure why this is occuring. LinkageButtonsView is a subclass of `discord.ui.view.View()`
Controls the library's cache policy when it comes to members.
This allows for finer grained control over what members are cached.
Note that the bot's own member is always cached. This class is passed
to the ``member_cache_flags`` parameter in :class:`Client`.
Due to a quirk in how Discord works, in order to ensure proper cleanup
of cache resources it is recommended to have :attr:`Intents.members`
enabled. Otherwise the library cannot know when a member leaves a guild and
is thus unable to cleanup after itself.
To construct an object you can pass keyword arguments denoting the flags
to enable or disable.
The default value is all flags enabled.
.. versionadded:: 1.5
.. container:: operations
.. describe:: x == y
Checks if two flags are equal.
.. describe:: x != y
Checks if two flags are not equal.
.. describe:: hash(x)
Return the flag's hash.
.. describe:: iter(x)
Returns an iterator of ``(name, value)`` pairs. This allows it
to be, for example, constructed as a dict or a list of pairs.
Attributes
-----------
value: :class:`int`
The raw value. You should query flags via the properties
rather than using this raw value.```
should be just discord.ui.View
thx
.
from discord.ui.view import View
```This is my import statement
okay that works, was confused by what you said first
I'm assuming you're on a version that doesn't have the function
what version are you running
How to fetch data of selected from dname? (Its mongodb)
selected is not under dname
Yeah it isnt cuz selected has a different function
I mean can i use selected as a filter for the data of dname
Hey how can I make it so that as soon as you select an option on the select menu, this option is deleted directly from the select menu history so that you can see the placeholder again

hey guys how can i check if an user has a role?
i was with ext.commands and now i'm trying bridge but i don't find anything related to roles on bridge
with ext.commands i was using the @commands.has_role decorator
when running the code:
@bot.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, user: discord.Member, *, reason):
await ctx.guild.ban(user, reason=reason)
i get the error:
gnoring exception in command ban:
Traceback (most recent call last):
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\commands\core.py", line 126, in wrapped
ret = await coro(arg)
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\commands\core.py", line 853, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "C:\Users\alexj\Desktop\EpicGiant Bot\cogs\moderation.py", line 11, in ban
await ctx.guild.ban(user, reason=reason)
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\guild.py", line 2907, in ban
await self._state.http.ban(user.id, self.id, delete_message_days, reason=reason)
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\http.py", line 353, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\bot.py", line 993, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\commands\core.py", line 357, in invoke
await injected(ctx)
File "C:\Users\alexj\Desktop\EpicGiant Bot\venv\lib\site-packages\discord\commands\core.py", line 134, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
my bot and i have ban permissions. why do i get a missing permissions error message?
idk but it seems to be tripping up when you try to ban someone with the bot
is there any change using Selectmenu in 2.0.0rc1 version?
after update pycord to 2.0.0rc1 version
interaction failed when select
you need to respond to interaction
Hi, quick question
@bot.command()
@commands.is_owner()
async def delete(ctx, nombre):
salon_del = await bot.fetch_channel(ctx.channel)#on prend le channel ou a eu la commande
await salon_del.purge(limit=nombre)#on supp les messages (la var nombre c'est le nb messages supp)
await salon_del.send(f"Ok,{ctx.author.mention}, j'ai supprimé{nombre} messages!", delete_after= 5.0)#on signale que c'est delete et on supp le message 5 sec apres
Traceback (most recent call last):
File "C:\Users\celia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 360, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\celia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 927, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\celia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 190, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In channel_id: Value "🍃・le-salon" is not snowflake.
and I dont understand the doc abt snowflake
yes I fix it by add callback, thanks
basically channel id
I know
Is check_interaction() a good way to check if an interaction was pressed/exited etc
@bot.command()
@commands.is_owner()
async def delete(ctx, nombre = 0):
print(ctx.channel.id)
salon_del = await bot.fetch_channel(ctx.channel.id)#on prend le channel ou a eu la commande
await salon_del.purge(limit=nombre)#on supp les messages (la var nombre c'est le nb messages supp)
await salon_del.send(f"Ok,{ctx.author.mention}, j'ai supprimé{nombre} messages!", delete_after= 5.0)#on signale que c'est delete et on supp le message 5 sec apres
salon_del = await bot.fetch_channel(ctx.channel)#on prend le channel ou a eu la commande this line is essentially useless
already modify this
youre making an unnecssary api call when you already have the channel via ctx.channel
@proven plume ^
then?
how should I modify he codeN
now I have this error
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: '>' not supported between instances of 'str' and 'int'
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000028050F84790>
remove the first two lines, replace salon_del with ctx.channel for the purge line and with ctx for the send line

is there any decorator like ```py
@commands.has_role(role_ID)
on bridge?
checks from the commands extension work for any type of command
Any help in how do I get date, time input from user? Using slash commands.
take string and parse it
when i try to run my code, i get this error:
discord.errors.ExtensionFailed: Extension 'cogs.events' raised an error: ExtensionFailed: Extension 'cogs.help' raised an error: TypeError: 'type' object is not subscriptable
from this section of code
def __init__(self, help_command: "MyHelpCommand", options: list[discord.SelectOption]):
its List if youre using the typing module, just list if in 3.10+
it also seems youre not using 3.10
@ancient stag
i have pycord 2.0 installed
pycord version has nothing to do with your issue
we are talking about python versions right now
you need to import List from typing and use that as the type hint
ok, ive done that
show me the arguments again with the change applied
all of it?
def __init__(self, help_command: "MyHelpCommand", options: list[discord.SelectOption]):
TypeError: 'type' object is not subscriptable
change list to List
no longer outputting errors. thanks 
remember, you cant use the lowercase versions of list, tuple and whatever else might be affected as type hinting in versions below 3.10
to use them as type hinting you need to import them from the typing module
how can i handle the errrors with bridge? i'm getting this error
AttributeError: 'BridgeCommand' object has no attribute 'error'
i'm trying like it was ext.commands tho
@restart.error
async def restart_error(ctx, error):
if error == 'MissingRole':
des = "Necesitas el rol <@&735506792494399638> para reiniciar el bot"
color=discord.Color.red()
name='Fallo al reiniciar'
await embed(ctx, des, color, name)
else:
print(error)
Is there anyway to use @discord.ui.button on @commands.command without interactions?
Because when i use ctx.send they send a message but, the bot say interaction failed
What to do if send_audio_packet sends audio correctly but i hear "pttt" sounds instead of the actual audio
(that happens with encode=True, because if i pass in False i dont even hear the pttt sounds)
nope, gotta respond
Can anyone help me in #980112836330151946 been a while since I opened it
Hey how to set options as button in slash command?
Example Picture:
I can use the bot's edit_message through interaction.response.edit_message() so that the bot doesn't get an error that the interaction failed
choices
or just pong(), some people have seen success using it
you need to use options https://guide.pycord.dev/interactions/application-commands/slash-commands#options--option-types
Learn all about Slash Commands and how to implement them into your Discord Bot with Pycord!
yeah i have see this but how i can this in a button ?
like a picture
that's not result
i will try to edit the bot message with interaction
How am I supposed to learn from something if I don't know how to make something else out of it? (No offense)
lol
testing
try out things
read the docs
has to be the emoji itself or a unicode representation
Just asking if , /check @Role pings the role or not?
no
the emoji itself?
anywhere where you can use rich text can have emojis
It doesn't ping right?
copy from there or use the emoji picker (iirc windows + comma)
it doesnt
Okay thank you
do note however that depending on which ide you have, having emoji will mess up the spacing
can I not use it like :earth _ americas:
Its not a custome emoji
i know i just mentioned it for the sake of mentioning it
I dont get it...
https://www.compart.com/en/unicode/U+1F30D just use this
U+1F30D is the unicode hex value of the character Earth Globe Europe-Africa. Char U+1F30D, Encodings, HTML Entitys:🌍,🌍, UTF-8 (hex), UTF-16 (hex), UTF-32 (hex)
@commands.Cog.listener()
async def on_application_command_error(self, context:discord.ApplicationContext, exception):
if isinstance(exception, commands.NSFWChannelRequired):
await context.respond('> **Error : Command can only be run on channels marked NSFW**')
This is present in another cog from the original command
However, it doesnt run when the error does take place. The command just times out without responding
console is clear
This one works, weird
is there some incorrect syntax?
because the shortcut of using :thumbs_up: is a discord only thing
its not gonna get parsed by discord if its sent by bots
Anyone know why custom emojis arent working in ephemeral messages spawned by a dropdown menu in a particular server?
They work fine in one server but not in another, bot has admin perms in both
Server 1: https://cdn.no1irishstig.co.uk/sztqe.png
Please ping me in the response if anyone knows the solution, thanks
does your bot have permission to use custom emojis originating outside of the server?
I'd assume so since its working in Server 1, the emojis are from a different server completely (which the bot is in but none of the commands are ran there)
The emojis work in the second server for normal commands which dont have an ephemeral response
¯_(ツ)_/¯
Does bot.before_invoke call for slash commands too?
I'd assume so considering its discord.Bot
sweet
how do i register a slash command that only works in dms?
how can i get the command given, i tried setting it on ctx but if the command doesn't exist, it throws a big error on ctx but a small error
this is the code
@bot.event
async def on_command_error(ctx, error):
if error == 'MissingRole':
des = "Necesitas el rol <@&735506792494399638> para reiniciar el bot"
color=discord.Color.red()
name='Fallo al reiniciar'
await embed(ctx, des, color, name)
else:
des = f"Error: {error}"
color=discord.Color.red()
name=f'Fallo con el comando {ctx}'
await embed(ctx, des, color, name)
youre going about checking what kind of error it is entirely wrong
it should be isinstance(error, commands.errors.MissingRole)
on the if?
yeah ty
hm i wonder
i was going to fix that right after
is it possible to use a match-case statement to check for errors without needing elif?
Hi there,
I have a problem where my PC (Windows 10) has pycord version 2.0.0b1 installed, but my Raspberry PI (Debian, Rasperry PI Desktop) only has verson 1.7.3. I work on the bot on my PC and some features I've implemented doesn't seem to work when ran on my PI (it acts like a server so I can turn off my PC at night). Is there a way to install a given version of pycord? I can't seem to find it on the website neither here, on Discord.
Commands do not work when I use cogs
main.py
import discord
from discord.ext import commands
import sys
import traceback
bot = discord.ext.commands.Bot(command_prefix="=")
# list
initial_extensions = [
'cogs.math',
'cogs.economy',
]
# load cogs
for extension in initial_extensions:
try:
bot.load_extension(extension)
except Exception as e:
print(f'Failed to load extension {extension}.', file=sys.stderr)
traceback.print_exc()```
math.py
```py
from discord.ext import commands
class Math(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def multiple(ctx, num1: int, num2: int):
await ctx.send(num1 * num2)
def setup(bot):
bot.add_cog(Math(bot))```
from discord.ext import commands
class Math(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def multiple(ctx, num1: int, num2: int):
await ctx.send(num1 * num2)
def setup(bot):
bot.add_cog(Math(bot))```
Make sure commands.command() is inside the class.
In the same column as your __init__ function```
py-cord==2.0.0b1
though you should upgrade to py-cord==2.0.0rc1
I see, thank you!!
thanks but it's trowing a different error when the command is run
Command raised an exception: AttributeError: 'Math' object has no attribute 'send'
In a cog every function's first arg must be 'self'. So your multiple function should be as follows:
async def multiple(self, ctx, num1: int, num2: int): [...]```
Self represents the class itself
*instance
Ahh, my bad
oh
do i need to add self to ctx.send?
no
nope
only when making a method for a class
it's still trowing the same error
code please?
@commands.command()
async def multiple(self, ctx, num1: int, num2: int):
await ctx.send(num1 * num2)
Hey how would I set my help command to MinimalHelpCommand. I'm using discord.Bot
i was thinking
how crazy would it be to have dynamic slash commands
so i have an array of names
and each of those names become a command
i reached the part where i made the command
but actually getting the command in discord isnt working
Ignoring exception in on_typing
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
TypeError: on_typing() takes 1 positional argument but 3 were given
I passed only one argument in the function, but it is saying I passed three. What do I do?
you need to give it three parameters as shown in the docs
why does this keep happening
ahh. I meant to do on_raw_typing. That's why I had passed one argument. thanks
its like multiple on_ready() are being constantly called
how to import options?
the docs say that it isn't guaranteed to be called only once due to the implemented reconnect logic
you'll need a way to make sure the task isnt running
i.e. use the is_running() method on the task
no the problem is in discord.commands
its not being recognized
you probably aren't on the right version then
check your pycord version
if its 1.7.3 then yeah, discord.commands doesn't exist there
how can i update my pycord version?
yeah you definitely have the wrong pycord installed
uninstall that
pip install py-cord==2.0.0rc1
That you sir :)
btw is that webhook or embed?
i wanna make something like that
i think its webhook ...
it looks like a webhook message which contains an embed
yea, btw does pycord support it?
of course
is there a way to delete ephemeral message?
or a way to get user who select SeleteMenu
why doesn't this work?
on_application_command_error
How do I get all the default stickers of discord so that my bot can use them?
sorry, I just new to use about “help” channel. what is this cool things? how can I make a channel with only threads?
Ok so I have this linux machine, and it has 3.9(pre installed) and I have python version 3.10, which I use for coding. I don't know why but some stuff does not work on the linux machine while it works fine on my pc. How can I upgrade it without it literally messing up the installation(since it then goes to initframs if I remove python3.9)
I don't wanna keep doing python3.10 everytime
It's forum channels, only available to partnered servers as of now
Do you get any errors?
or it just doesn't work?
Hi, Why show this error how fix?
'AutoShardedConnectionState' object has no attribute '_interaction'
just doesn't work
and i'll just use python3.10 for the time being
Does anyone know why it doesn't work?
@slash_command()
async def helper(self, ctx: commands.Context):
embed = discord.Embed(title="help", description="helper1")
embedd = discord.Embed(title="help", description="helper2")
embeddd = discord.Embed(title="help", description="helper3")
select = Select(
placeholder="Wybierz Kategorie Pomocy",
max_values=1,
min_values=0,
options = [
discord.SelectOption(label="Informacyjne", description = "Wyswietl kategorie Informacyjne."),
discord.SelectOption(label="Administracyjne", description = "Wyswietl kategorie Administracyjne."),
])
async def thecallback(interaction):
select.callback = thecallback
view = View()
view.add_item(select)
await ctx.respond(embed=embed, view=view)
if len(select.values) != 0:
for choice in select.values:
if choice == "Informacyjne":
await interaction.respond.edit_message(content=embedd)
elif choice == "Administracyjne":
await interaction.respond.edit_message(content=embeddd)```
Please??
You dont set the callback inside the callback function
Also you dont set the view and respond inside the cb func
how to edit the followup message
heyy y'all, just a quick question
is the read message intent required if we wish something to be executed when pinged? (using the message.content method)
or are there any alternative ways to detect pings without that intent as well?
if you dont have message_content intent, you can still access dm messages, messages in which bot is pinged n all
i read it somewhere but never tried
is there a possibility to add app commands when right clicking a vc?
nope
i sent a follow up message after using a slash command in ephemeral, can i send another ephemeral followup message after it?
user or message only
Can you try to store the followup to a var
yes
can we edit it rather?
the followup message
Maybe
If you wanna do something after clicking the button, you can send respond, or interaction.message.edit
how do i edit slash command interaction message
How do I add discord.ext ? This is the error I get
message.interaction.author
interaction.response.edit_message ig
How do I setup discord.Option() for roles?
!install
Install pycord:
pip uninstall discord.py
pip install py-cord
Install pycord beta:
pip uninstall discord.py
pip install py-cord==2.0.0b7
Install pycord alpha from git:
pip uninstall discord.py
pip install git+https://github.com/Pycord-Development/pycord
!option
AttributeError: module 'discord' has no attribute 'Bot'
Why does this happen at times?
did you uninstall discord.py?
yes
make sure u used py-cord, not pycord
all
cause a couple days back the code worked
Traceback (most recent call last):
File "d:/Prediction Bot/main.py", line 7, in <module>
bot = discord.Bot()
AttributeError: module 'discord' has no attribute 'Bot'
from discord.ext import commands
import discord
bot = discord.Bot()
can you give me the command for the git one.
!install
Install pycord:
pip uninstall discord.py
pip install py-cord
Install pycord beta:
pip uninstall discord.py
pip install py-cord==2.0.0b7
Install pycord alpha from git:
pip uninstall discord.py
pip install git+https://github.com/Pycord-Development/pycord
last
uninstall pycord too
there should be not any other conflicting package
how to edit en ephemeral message in button callback func
thanks man. it helped a lot.
turns out I was using Python 3.7
my bad.
What is this called in the docs?
And for messages?
Are there any tutorials or examples to follow and learn how they work?
Here's the context menus example.
Thank you so much!
hi
what is wrong?
Traceback (most recent call last):
File "c:\Users\darkm\OneDrive\Desktop\Lambda Pycord\pycord.py", line 1, in <module>
from discord.ext import commands
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\__init__.py", line 23, in <module>
from . import abc, opus, sinks, ui, utils
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 60, in <module>
from .voice_client import VoiceClient, VoiceProtocol
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\voice_client.py", line 55, in <module>
from .gateway import *
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\gateway.py", line 37, in <module>
import aiohttp
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\__init__.py", line 6, in <module>
from .client import (
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client.py", line 35, in <module>
from . import hdrs, http, payload
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\http.py", line 7, in <module>
from .http_parser import (
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\http_parser.py", line 15, in <module>
from .helpers import NO_EXTENSIONS, BaseTimerContext
File "C:\Users\darkm\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\helpers.py", line 667, in <module>
class CeilTimeout(async_timeout.timeout):
TypeError: function() argument 'code' must be code, not str
PS C:\Users\darkm\OneDrive\Desktop\Lambda Pycord>```
Testing out some localized commands and the names show up just as expected. But there seems to be some issues with discord's 'autocomplete' (not sure if Autocomplete means anything more special than string/pattern matching). Basically, it shows commands (localized) when I type in the default/English name, but it doesn't match the localized names.
Is there something more I need to do or is this a product of localization features being in early stages?
I don't think there's anything you can do, maybe open an issue on discord's api docs
.
Hi, quick question. Is it normal that the pictures detached to a respond to a slash command are black for all other people except the one who used the slash command?
I think that just means that the image is loading
Something wrong with your installation Try installing https://pypi.org/project/py-cord/2.0.0rc1
thanks i have
Meow
Anyone Here?
I have one issue \
I wannt to send nothing in Response to Slash command
how can I do that?
Cause ctx.defer() just says bot is thinking But, I want the bot to say nothing on Slash commands
@here
you can send a message and delete it after a second
await ctx.respond("text", delete_after=1)
Ik :) I even did delete_after=0.0 this too works :)
But, Why Can't I just send nothing?

One message removed from a suspended account.
One message removed from a suspended account.
is there any way to get a user's email? There's no email attribute in discord.User
p.tag idw
Saying it doesn't work or asking what's wrong with this code? is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.
no
also, please use motor, the async version of pymongo
Anyone know why custom emojis arent working in ephemeral messages spawned by a dropdown menu in a particular server but in normal commands invoked in the same server they do?
Does the everyone role has external emotes perms
It did not, but it does now and thats fixed the problem.. thank you. any idea why this happens?
Slash command responses are webhooks. And webhooks need external emotes perms, based off the everyone role.
I see, but that wasnt from a slash command, it was a dropdown
Any interaction response.
https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes
It requires oauth2.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
how can i get message in channel from starting to last msg
last_message isnt always reliable though so it's best to just use TextChannel.history
aa np i just want to make transcript (making a ticket bot)
how can i get datetime of a msg when it send with a custom timezone?
how can i add a callback when someone dismiss a ephemeral message sent by my bot
is it even possible?
no
ok and i want to invoke a button callback when view timeouts, how to?
quick question: is it possible to get a users created at/joined at time as unix time?
Execute the code under view.wait()
ok but how to invoke a button callback?
view.children[0].callback(ctx.interaction)
Is it possible to create a discord.Emoji just from a string like <:emoji_name:123456...>?
So I'm getting the PrivilegedIntentsRequired error. I know that the fix is to enable it both in the code and in the developer portal. But my bot is verified so it's not possible to toggle the content intent on.
I've fully migrated to slash commands, but wanted to ease the transition with one or two traditional commands until the expiration date.
Does anyone know a solution for this apart from straight up applying for the intent?
There is no other solution. No intent, no message content. Discord wouldn't have introduced the intents if we could bypass them, right?
They were working yesterday though, before I switched over to pycord for this migration 🤔
its not a privileged intent yet. it will become such on august 31st
As the popularity and number of Discord bots grow, it's important to keep our users and developers safe and healthy. This means from time to time, like any maturing platform, we need to update our ...
@dapper ibex ^
Yes I'm aware, but discord's already preventing me from turning it on. This is what my mouse does when I try
huh
I have one idea, since my pre-migration code just needed the intent declared in-code. Maybe I just need to ignore the exception
oh yeah discord.py stable still uses api v9 which doesnt enforce the message content intent
I was actually using discord.js but grew to hate js so I very painfully rewrote it in python
lol
ah, i see lol
i dipped my toes into the js side of making bots for a bit
that turned into alot of work and it just kinda fell off gradually
Well I can except the exception but obviously that doesn't make it work. I started this at 5 am so I'm not smart right now.
I guess I'll just have to wait for discord to approve my request for one (1) command (if they'll even do that).
something something 'limitation breeds innovation'
Hey there community,
I know this might be a really dumb question but I want to make my bot as a sub class in my project. What I mean with that is that I want to have a driver code that can call functions of the bot. My bot is basically like an event listener and a few other commands.
My driver code listens for some events and triggers the discord functions accordingly. I tried using tasks.loop() but my driver code runs 24/7.
What i really want is to have my bot in form of a Class such as a cog and call certain functions if needed. Any help with that?
you can make it repeat at specific times
It's like a loop going through a list, so I don't want to disturb the flow of the loop if that makes sense.
is there any maximum amount of choice in slash cmd option choice?
I need that variable for something else 
No no
something else
hm
for later use 
mk
how to disable a select menu?
is it dropdown_variable.disabled = True?
I'm not using a class
yes
dont forget you have to edit the message with a new view containing the modified object
Any way of running the bot as an object of a class?
Like a cog but it is stand alone and does not require another class.
btw why my task is never runned
no error shown
wait i need to start the loop
eh yes i started the loop but nothing happends too
side question:
how do I disable a button after it was clicked
is someone invisible for me?
actually no one answering our questions so
no, i got a ghost ping which stayed when i marked the chat as read
I ve been getting same buggish behavior with Forum threads, I guess, not ready for public release 
how do i disable all the buttons in a view when i have reacted to one of them, i tried this but it doesnt work
button1 = [x for x in self.children if x.custom_id == "decline_trade"][0]
button1 = [x for x in self.children if x.custom_id == "accept_trade"][0]```
Edit your message with updated view
thats what i did, it doesnt disable all the buttons
Huh? Can someone help me?
How do I catch exceptions which are not DiscordExceptions (an event that catches all exceptions?)
on_application_command_error catches exceptions as DiscordExceptions
communication_disabled_until returns None because they are not in timeout (whoever is the member in the member object)
Yeah it’s supposed to time them out before it gets the timestamp
Could you share the code block so I get some idea?
No it’s alr I think I fixed it
cool
Any idea on this one?
Try on_error maybe? I’m not sure tho
Not sure why the on_error is not getting triggered tho
I do have it in place
After looking at the docs, seems like it only gets triggered if an exception occurs in a .event() and not a command
how can I add reactions to a slash command message?
You mean, if I use /help and you want to add a reaction to that?
ye
You can try ctx.message.add_reaction()
That is, if the ctx object has the message attribute.
is there a way to make it so my slash command has more then 25 options??
or a way to make it so it's possible to filter between the selections of each option
Have you had a look at choices? Maybe that's what you're looking for
https://docs.pycord.dev/en/v2.x/api.html#discord.Option.choices
Why isn't the bot writing? on_typing event
@bot.event
async def on_typing(channel, user, when):
channels = bot.get_channel(980818985270509589)
if type(channels) != discord.channel.TextChannel:
await channels.trigger_typing()
maybe the type is TextChannel
All good i haved
How do I make the bot repeat a task everyday at a certain time?
Use tasks.
Here's the background task asyncio example.
Is there a way to make some slash commands visible to specific roles or permissions?
client = discord.Client(debug_guilds=[965533467557371944])
client = discord.Client()
@client.event
async def on_ready():
print(f"We have logged in as {client.user}")
@client.slash_command
async def hello(ctx):
await ctx.respond("Hello!")```
'Client' object has no attribute 'slash_command' this is my error and google wont help me, whys it happening?
ofc client.run is there just no in what i showed
Hi on_member_join get invite code and inviter. Someone knows a reliable way to use?
In API i found this.
But in the pycord documentation I did not find an inviter? and code
you're misunderstanding; the API structure you're referring to is an invite object itself
the member_add (or member_join) event, when fired, doesn't come with invite information
How can I query that something only happens to a certain category?
can you elaborate?
roles: use the integrations tab
permissions: use default_member_permissions in the decorator. This can be overridden by whatever permissions you set in the integrations tab
discord.Client doesn't support slash commands; you want discord.Bot
Yes, um, I have a Modmail support means the IDs are stored in a channel in the topic and now I have the on_typing event and I have to tell him somehow that he should only do it in this one category. I hope you understand me 
I changed it to discord.Bot im going to re send my code as im getting new errors
import discord
bot = discord.Bot(debug_guilds=[965533467557371944])
bot = discord.Bot()
@bot.event
async def on_ready():
print(f"We have logged in as {Bot.user}")
@bot.slash_command
async def hello(ctx):
await ctx.respond("Hello!")
Traceback (most recent call last):
File "C:\Users\jackd\Documents\Felbcord Py\main.py", line 2, in <module>
bot = discord.Bot(debug_guilds=[965533467557371944])
AttributeError: module 'discord' has no attribute 'Bot'
i think you wanna check message.channel.category.id?
how did you install it before
py -3 -m pip install -U py-cord
then do the same but with py-cord==2.0.0rc1
alr
Mhmm i have tried this but this is not working.
@bot.event
async def on_typing(channel, user, when):
topic = channel.topic
category = discord.utils.get(channel.guild.categories, id=939910389536280577)
if topic in category is None:
print("No")
if topic:
member = channel.guild.get_member(int(topic))
if member:
await member.trigger_typing()
so:
category = discord.utils.get(channel.guild.categories, id=939910389536280577)
if topic in category is None:
print("No")
I got a bunch of messages saying requirment already satisified
what was the final message
I try to tell him to only do it in that category
i think you've approached it wrong
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\jackd\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord==2.0.0rc1) (6.0.2)
Requirement already satisfied: idna>=2.0 in c:\users\jackd\appdata\local\programs\python\python310\lib\site-packages (from yarl<2.0,>=1.0->aiohttp<3.9.0,>=3.6.0->py-cord==2.0.0rc1) (3.3)
WARNING: You are using pip version 22.0.4; however, version 22.1.1 is available.
You should consider upgrading via the 'C:\Users\jackd\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.
The final rough part
are you sure the bot is running on 3.10?
I also think
How would i check
you should check if channel.category == category
^
in your bot's main file py import sys print(sys.version)
@bot.event
async def on_typing(channel, user, when):
topic = channel.topic
category = discord.utils.get(channel.guild.categories, id=939910389536280577)
if channel.category == category:
print("No")
if topic:
member = channel.guild.get_member(int(topic))
if member:
await member.trigger_typing()
Is that correct?
hopefully; to clarify, if channel.category == category will be True if they're talking in the correct channel
added this code just bellow import discord and same error when tryna start it
add it at the top of your file so it runs first
Good thanks 
same error
it should at least be printing the version, right?
yeah, 3.10.4
can you do py -3 -m pip list
Package Version
aiohttp 3.7.4.post0
aiosignal 1.2.0
async-timeout 3.0.1
attrs 21.4.0
chardet 4.0.0
charset-normalizer 2.0.12
discord.py 1.7.3
frozenlist 1.3.0
idna 3.3
multidict 6.0.2
pip 22.0.4
py-cord 2.0.0rc1
setuptools 58.1.0
typing_extensions 4.2.0
yarl 1.7.2
completely uninstall discord.py and py-cord, then reinstall py-cord==2.0.0rc1
alr
Sorry i forgot the command to uninstall them
what is it?
uninstall...
Not sure if ive made progress here but ive now got Bot is not defined
import sys
print(sys.version)
import discord
bot = discord.Bot(debug_guilds=[965533467557371944])
bot = discord.Bot()
@bot.event
async def on_ready():
print(f"We have logged in as {Bot.user}")
@bot.slash_command()
async def hello(ctx):
await ctx.respond("Hello!")
you 100% sure that's the error...?
I got it sorry, but PS C:\Users\jackd\Documents\Felbcord Py> py -3 main.py 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] Ignoring exception in on_connect Traceback (most recent call last): File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 352, in _run_event await coro(*args, **kwargs) File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 793, in on_connect await self.register_commands() File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 460, in register_commands await self.http.bulk_upsert_command_permissions( File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 338, in request raise HTTPException(response, data) discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed
It starts but i get this error
!install
Install pycord:
pip uninstall discord.py
pip install py-cord
Install pycord beta:
pip uninstall discord.py
pip install py-cord==2.0.0b7
Install pycord alpha from git:
pip uninstall discord.py
pip install git+https://github.com/Pycord-Development/pycord
use rc ver
I got it installed already, is this a fix to my current issue?
This is a discord limitation as they don’t keep track of the inviter. You would have to track this manually. https://pypi.org/project/DiscordUtils/ has a simple implementation
is your bot in the guild id you're using
and did you invite with the applications.commands scope
I did but i dont renember if i kicked and re-invited, is that needed?
If you get a Missing Access (50001) error, you probably forgot to add the applications.commands scope.
To fix that, just replace YOUR_BOT_ID with your bot id and visit this link: https://discord.com/oauth2/authorize?client_id=YOUR_BOT_ID&scope=applications.commands
Btw, Is there a way for me to have a slash command to change a users nickname to a specfic name
if you get the member object from the command, you can do await member.edit(nick=...)
alright ty!
the lowercase option is the @option decorator, while the uppercase Option is using discord.Option directly
the example only uses the decorator, but the direct implementation looks something like py async def test_command(ctx, text: discord.Option(str, "Example"))
or let's say for the last example on that link py async def say(ctx: discord.ApplicationContext, attachment: discord.Option(discord.Attachment, "A file to attach to the message", required=False))
@bot.slash_command(name = "nick", description = "Change nickname of a user")
async def nick(ctx, member: discord.Member, *, ):
if ctx.author.guild_permissions.administrator:
await member.edit(nick=Censored nickname)
else:
await ctx.respond("You do not have the permissions to use this command", ephemeral=True)
How would i sort this i have alot of errors and my aim isnt to nick a different name every time, I want to /nick (user) then it will nick to censored nick as this is for inappropriate nicks/invis names
well you need to figure out the censorship logic yourself
I am defining a class in a cog like this
class Cog(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
class MyModal(discord.ui.Modal):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def callback(self, interaction):
#do stuff
And my question is how I can access the bot object in the methods of MyModal.
Is that possible without passing the bot as an arg or kwarg to the class?
Or how would I in general access attributes and methods of the Cog?
Hey sorry to bother you,
Traceback (most recent call last):
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 352, in _run_event
await coro(*args, **kwargs)
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 793, in on_connect
await self.register_commands()
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 286, in register_commands
if key2 in match[key][i].keys():
IndexError: list index out of range```
I am getting this error and my commands have stopped working
```import sys
print(sys.version)
import discord
bot = discord.Bot(debug_guilds=[965533467557371944])
bot = discord.Bot()
@bot.event
async def on_ready():
print(f"We have logged in as {bot.user}")
@bot.slash_command(name = "addslowmode", description = "Add slowmode to a channel")
async def slowmode(ctx, channel_id, amount: int):
if ctx.author.guild_permissions.manage_messages:
channel = bot.get_channel(int(channel_id))
await channel.edit(slowmode_delay = amount)
await ctx.respond(f"{channel} has been slowed to {amount} seconds :white_check_mark:", ephemeral=True)
else:
await ctx.respond("You do not have the permissions to use this command")
@bot.slash_command(name = "nick", description = "Change nickname of a user")
async def nick(ctx, member: discord.Member,*,name):
if ctx.author.guild_permissions.administrator:
await member.edit(nick= name)
name = ["Censored"]
else:
await ctx.respond("You do not have the permissions to use this command", ephemeral=True)```
(Bottom command isnt finished)
still figuring out the bottom command
ok thank
Im getting this error and not sure why, it only occurs in VSCode, and not my server host
I removed the bottom command and get the error about method not allowed although i re invited the bot
just use discord.Intents.all()
instead of setting them all separately...
nvm, I thought intents are only used for those three...
well for that implementation, all is exactly what you want
you need to update to py-cord==2.0.0rc1 on your local machine too
how?
yeah but like the user cant search for a specific choice can he?
they can, it happens automatically
if you want more than 25 options use autocomplete instead
So whats the difference between py-cord==2.0.0rc1 and py-cord==2.0.0b
though note autocomplete isn't enforced, so you should have a check inside the command too
rc1 is the latest release that's closest to the final 2.0 release
h
and how can i do so?
Here's the slash autocomplete example.
refer to that
how do i update pycord on my local system
thanks
the same as you did on your server...?
py -m pip install py-cord==2.0.0rc1
dosent this just do it in the folder
run it in your terminal
i think we might have mixed up some feedback
@slender lintel can you paste the exact error you're getting
alright
using bot.get_application_command(), how would i get a slashgroup command
The error seems to be gone, Although when i do /nick (user) (name) it says application does not respond
didn't you remove the command
probably 25?
I did, Then re added it and it worked not sure why it was
damnn so u cant have more then that alright
in autocomplete it doesn't matter since you're generating choices
oh alright
@crimson coral
what is the command code here
Traceback (most recent call last):
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 126,
in wrapped
ret = await coro(arg)
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 856,
in _invoke
await self.callback(ctx, **kwargs)
File "C:\Users\jackd\Documents\Felbcord Py\main.py", line 23, in nick
await member.edit(nick= name)
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 808, in edit data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 353, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 993, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 357,
in invoke
await injected(ctx)
File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 134,
in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
this is the error ^
async def nick(ctx, member: discord.Member,*,name):
if ctx.author.guild_permissions.administrator:
await member.edit(nick= name)
name = ["Censored"]
else:
await ctx.respond("You do not have the permissions to use this command", ephemeral=True)```
command code
not sure if you can (may be worth raising this as an issue on the github?), but you can find subcommands in bot.walk_application_commands(); this is normally an iterator, but you could convert it with list()

actually
use get_application_command on the group but specify type=discord.commands.SlashCommandGroup
then access group.subcommands
hmm i wonder if there's a shorter way
any idea
i think thats the only way
ah i see
subcommands aren't included in the internal application_commands and _application_commands lists
they're always invoked under group so i guess it was considered unnecessary
Any suggestions on this? @crimson coral
your bot doesn't have permissions to edit the member's name
💀 im dumb
uhhhhh as far as im await the various on_error events catch any exception that occurs during a command
unless im misunderstanding your question
application_command is catching that one
well yeah i was referring to any error handler you have; on_command_error, on_application_command_error etc
For example, there's a 404 error from another lib, and the error is caught in on_application_command_error but the type() for that is the base discord exception class\
i don't think it requires DiscordException though?
e.g. i just made a dummy command and my error handler catches a generic typeerror just fine
Let me try to show you some screenshots
as long as you know how to reference the error you should be fine
yeah that'd help
Weird how it's starting to work now lol
@crimson coral
So, I tried the print debugging technique and found this:
<class 'discord.commands.errors.ApplicationCommandInvokeError'> is the Error cls of on_error
ahh now that we can work with
if you get ApplicationCommandInvokeError or CommandInvokeError, access error.original for the real error
This is my testcase command
ah, lemme check
i personally just rerun the error handler, but alternatively you can check for it at the start and handle that
e.g.
async def on_command_error(self, ctx, error):
if isinstance(error, commands.CommandInvokeError):
await self.on_command_error(ctx, error.original)```
Interesting
Thanks for that
all good
hi
i need help with a command
in discord.py its works
but in pycord ;//
@client.command(pass_context=True)
async def ostrzezenia(ctx, member: discord.Member = None):
if not member.guild_permissions.kick_members:
embed=discord.Embed(title="**Error 404**", description="Komenda działa tylko dla adminów! **Poprawna forma**: ``v!ostrzezenia <@admin>``", color=0xff0000)
embed.set_footer(text=f"Wywołane przez: {ctx.author.name}", icon_url=ctx.author.avatar.url)
await ctx.send(embed=embed, delete_after=5)
await asyncio.sleep(5)
await ctx.message.delete()
else:
guild = ctx.message.guild.id
rows = Database.rows("SELECT * FROM ostrzezenia WHERE UserID = ? AND Guild = ? ORDER BY ROWID ASC",
str(member), str(guild))
embed = discord.Embed(
ctx=ctx,
)
embed.set_thumbnail(url=member.avatar.url)
value = '\n'.join(f' >  `Ostrzeżenie z dnia:` **{row[3]}**\n >  `Przez Administratora:` **{row[0]}**\n >  `Powód Ostrzeżenia:` **{row[2]}**\n\n' for row in rows)
embed = discord.Embed(description=value, color=0xFE7D35)
embed.set_author(name="Lista Ostrzeżeń", icon_url="https://cdn.discordapp.com/emojis/979114000375763024.webp?size=96&quality=lossless")
await ctx.send(embed=embed)```
Are you trying the prefixed command or slash commands?
Prefixed
What's the error/excepted output? @frank wadi
no error
Not sure how you got no error.
Try using print statements to try and debug the code
You'll find an error while using the "\n".join() on value.
You need to use a list/tuple to be able to use the list/tuple comprehension.
And I don't think discord.Embed(ctx=ctx) is valid .
Try using print statements to see how your code executes and you might get an idea.
How can i stop this warning from appearing everytime i update/install/uninstall a module?
I have a little problem making a group, if i place the group variable inside the class it gets created twice, but if i place it outside the class i get discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Utilities.info_emoji() missing 1 required positional argument: 'ctx'
how can i make a black space like this
Those are just codeblocks.
use ```
ok thanks
What could be the cause of an interaction to return "Interaction Unknown" when attempting to do a ctx.respond()?
cogsReport/manager.py lines 109 to 122
async def assign(self, ctx, member: Option(discord.Member, "What user do you want to assign?"), _id: Option(str, "To which report do you want to assign the user?", autocomplete=get_server_reports)):
"""Server Admins only - Assign a member to a report."""
if await isManager(ctx):
report = await ReportFromId(_id, ctx)
track_google_analytics_event("Assign", f"{report.report_id}", f"{ctx.interaction.user.id}")
report.assignee = member.id
await report.addnote(member.id, f"Assigned {report.report_id} to {member.mention}", ctx, ctx.interaction.guild.id)
await report.commit()
await report.update(ctx, ctx.interaction.guild.id)
await ctx.respond(f"Assigned {report.report_id} to {member.mention}")
else:
await ctx.respond("You do not have the appropriate permissions to use this command.")```
len(clinet.guilds) not len(client.guilds())
ok
One message removed from a suspended account.
min_length kwarg in InputText
One message removed from a suspended account.
One message removed from a suspended account.
NP
how do you do cooldowns in slash commands
LoL, even im on android google croming my discord i never had this thing happend
The same way it works on commands.
Here's the cooldown example.
ModuleNotFoundError: No module named 'dotenv'```
showing this forever trying to use .env...
i've already tried everything from https://stackoverflow.com/questions/59572174/no-module-named-dotenv-python-3-8
Are command cooldowns any user per command or per user per command
did ephemeral go away for message send?? i could've sworn it was there before https://docs.pycord.dev/en/master/api.html#discord.TextChannel.send
how to invoke a slash subcommand?
as in like, through code?
there should be ApplicationContext.invoke if you're using cogs, otherwise you should just be able to call the function
the first pic is the error i got and the second is my code can someone let me know what to do
did you uninstall discord.py before installing pycord
pls dont ping
make sure you install the latest version and not 1.7.3
do pip install py-cord==2.0.0rc1
sorryyy
alright wait
alright did it
nothings happening now
no error code or nothing
but the commands still wont work
so no errors?
if you're using prefixed commands then you need to have the message content intent
Is there a fix?
async def command_not_found(self, cmd):
ctx = self.context
bot = ctx.bot
return await ctx.deny(f"{cmd} does not exist")```
**ERROR**
AttributeError: 'TextChannel' object has no attribute 'news'```
hm
update to rc1
if that doesnt fix it then update to github master branch
i just watched the video tho and he didnt use any intents
videos are not accurate
What is Pycord?
this is a good place to get started w pycord
alright ill look into it
and docs
okii thank you
Ignoring exception in command lyrics:
Traceback (most recent call last):
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\commands\core.py", line 126, in wrapped
ret = await coro(arg)
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\commands\core.py", line 860, in _invoke
await self.callback(ctx, **kwargs)
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\bot.py", line 386, in lyrics
await ctx.respond(embed=embed)
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\commands\context.py", line 227, in respond
return await self.interaction.response.send_message(*args, **kwargs) # self.response
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\interactions.py", line 686, in send_message
await self._locked_response(
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\interactions.py", line 933, in locked_response
await coro
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\webhook\async.py", line 211, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\bot.py", line 993, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\commands\core.py", line 357, in invoke
await injected(ctx)
File "C:\Users\shan's python work\PycharmProjects\da_pycord_botto\venv\lib\site-packages\discord\commands\core.py", line 134, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
im getting this bigass error
lemme send the code
holup
@client.slash_command(description="Get the lyrics to your favorite song >:)")
async def lyrics(ctx, song:Option(str, "Enter the name of the song for which you want the lyrics!")):
song = urllib.parse.quote_plus(song)
async with aiohttp.ClientSession() as lyricsSession:
async with lyricsSession.get(
f'https://some-random-api.ml/lyrics?title={song}') as jsondata:
if not 300 > jsondata.status >= 200:
return await ctx.send(f'Recieved poor status code of {jsondata.status}')
lyricsData = await jsondata.json() # load the json data into its json form
error = lyricsData.get('error')
if error:
return await ctx.send(f'Recieved unexpected error: {error}')
songLyrics = lyricsData['lyrics'] # the lyrics
songArtist = lyricsData['author'] # the author's name
songTitle = lyricsData['title'] # the song's title
songThumbnail = lyricsData['thumbnail']['genius']
for chunk in textwrap.wrap(songLyrics, 4096, replace_whitespace=False):
embed = discord.Embed(
title=songTitle,
description=chunk,
color=discord.Color.blurple(),
timestamp=datetime.datetime.utcnow()
)
embed.set_thumbnail(url=songThumbnail)
await ctx.respond(embed=embed)
der u go

it could be taking longer than 3 seconds to respond
have you tried deferring the interaction?
any1 know why i get this error?
code
Add ephemeral=True
await ctx.respond("Hello!", ephemeral=True)
I'd have to see your code, but you're probably updating a DB file and trying to assign values to it afterwards.
hi, how do I sync the command for every guild that invited the bot, without needing to restart the bot? cuz rn if i invite the bot to a guild, i need to restart the bot in order to see the commands on that guild
I guess you're using guild_ids=[...] in your commands?
If you remove that, a command becomes "global" so it can be used in every server.
I think there are 2 ways to fix this.
for result in serveractions.find({}):list(serveractions.find({}))
Your current code makes results a cursor object, not a list that you can use with a for loop.
Oh
like this then?
Okii lmfao
One or both of my solutions will work 
very confident i see 👀 😄
The code isn't exactly complicated 
result[]
Gonna check, thanks
the error you sent doesn't appear to be in your code
it also is easier to send a copy of your code rather than a screenshot
oh and this is a super simple error, you should also be able to fix it yourself
bit confused lol is it a problem on the line 158 or another line?
Your error states that the error is on like 158 results["Discord Invite"] but this isn't in the screenshot you sent.
please consider following starter courses Python
you have to be able to read a simple error like this
How do i add a space in the slash command name
You can only add spaces to context commands, not in slash commands
There are sub commands though.
How do u make sub commands
btw how to get ctx author text channel id?
ctx.message.author.channel.id?
ctx.guild.channel.id?
ctx.channel.id?
ctx.message.channel.id?
read the docs or check examples
Do you mean the author of a message or...?
ummm
i mean like
grab the channel id from user when user use / cmd
uhhhh
simpliedly like i need to grab the channel id when a user use the commands
okie tryin
well it work but i got another question
ctx.message.author.guild_permissions.administrator
AttributeError: 'NoneType' object has no attribute 'author'
slash commands don't have a message
is it ctx.author.guild_permissions.administrator
ctx.author, not ctx.message.author
message = await ctx.interaction.original_message()
await message.add_reaction("👍 ")
If I want to register a command for all guilds the bot is in but not want to make them global how would I do that
I guess you could use client.guilds
Hmm
But as someone who had that exact idea, it's almost always better to use globals, there's also a limit on "local" ones
of like 100 I think
Does that work in cogs
There's a limit of 100 global and 100 local
best way of slash command groups in cogs? I'm doing this in a cog if that helps
https://guide.pycord.dev/extensions/commands/groups/
vs
https://guide.pycord.dev/interactions/application-commands/slash-commands/#subcommand-groups
Command groups are a way to create subcommands for your commands. For example, !afk set or `!afk
Learn all about Slash Commands and how to implement them into your Discord Bot with Pycord!
Not a lot atm, but I'm gonna have a lot of commands

I mean a limit of 100 "local" servers you can provide the bot with, meaning when it gets verified you'll have to switch anyway
In December 2020, Discord released their first interaction: the
Uh
Nvm im dumb
You can have 100 commands, and each command can have up to 25 sub-command groups. Each sub-command group can have up to 25 sub-commands.
100 x 25 x 25 = 62.5k
if you wanted to count local commands, just double it
why isn't Client.get_message() working? it says 'Client' object has no attribute 'get_message'
Um i see your token, which Pycord version do you have?
need help in #981191104751861790
Hello guys, I'm having some troubles importing Modal and InputText from discord.ui. I've inspected .ui but neither of those two are not included in. My version is 2.0.0b1
1.7.3 i can reset the token
Install pycord 2.0.0b7
Because it doesn't exist. Use await channel.fetch_message
How can i do that on pycharm
In the cmd (terminal)
i only have a message ID to work with
Works thx
I have a other question
Thats weird
yeah but this also working
b7 still have some bugs which are fixed in rc1
Now only that shows up
With me everything works so far I can not complain so far
do you use ctx.send?
Yes
you need ctx.respond() for slash commands
I have a question, there is a ctx.guild.owner , is there a ctx.guild.administrator ?
Guys, i have a question how do i start a thread from a slash_command message, since ctx.respond doesn't work with create_thread()?
create_thread can be used on either a text channel or a message
so just use ctx.channel.create_thread()
No, administrators are people with a role that has administrator permissions.
Is there a way to change this code to has_permissions() ?
How would i use interaction.response.send_message to send a message with buttons, For all i can see is that i can send it without as a regular message
I have a slash command that has a question then has button "next question" its a sereis of quetions
questions*
@slender lintel I don't know your code but you could just use ctx.respond with a view too
Alright, Ill try that as well as sending the code
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/confirm.py at master · Pycord-Development/pycord
ill loook at that
I see i tested this and it's almost the same i have, but its this i want to achieve w/o having the interaction failed message https://i.imgur.com/4QcuFLk.png
you want to use ctx.respond and create a thread on the response?
message = await ctx.interaction.original_message()
await message.create_thread()
this is how it looks
It worked, thank you for time and help
Does that mean I have to re-write the whole function?
Sorry im still confused, class View(discord.ui.View):
async def button_callback(self, button, interaction):
await interaction.response.send_message("", ephemeral=True)
@bot.slash_command(name="staffapp", description="staff app questions")
async def button(ctx):
await ctx.respond("Would you like to apply for staff?", view=View())
``` This is the code, But i dont want it to be a regular message it responds with i want a regular message with buttons
use has_permissions
read the docs
your code literally has a button
assuming it is working code
Yes the first question does, The code works but i want that code to respond to another message with a button messae
message
you want to add a button to someone else's message?
No, I will give an example of what im looking to do 1 sec
(This is a staff app if your wondering lol)
I want to have when i click "Yes i do" to enter the next button message
just repeat a respond or send
you'll also have to combine that with a wait_for('message') if you want the bot to do something with the age response
like fr look at the example, it's all there
Well once you type ur age, you would click next question
@discord.ui.button(label="Next Question", style=discord.ButtonStyle.primary, emoji=":white_check_mark:")
async def button_callback(self, button, interaction):
await interaction.response(Content="Why do you want to be staff at felbcord?", label="Next Question", view=View())
@bot.slash_command(name="staffapp", description="staff app questions")
async def button(ctx):
await ctx.respond("Would you like to apply for staff?", view=View()) ```
Sorry im not understanding, May you explain more?
so if I call view.wait() and there is more than 3 seconds between view.stop(), the error pops up?
Anyone able to help? I've got my slash command saying the message with buttons but i want the "Yes i do" to go onto another question with a button.. I know i can have it so it responds to another message but i cant figure out how to add buttons..? Please help
could you elaborate on your question?
I want the button to respond with another message when its clicked , but i want that message to to have a button and i showed an example of what i meant in the picture,
@discord.ui.button(label="Next Question", style=discord.ButtonStyle.primary, emoji="✅", custom_id="Next1")
async def button_callback(self, button, interaction):
await interaction.response(Content="Why do you want to be staff at felbcord?", label="Next Question", view=View())
@bot.slash_command(name="staffapp", description="staff app questions")
async def button(ctx):
await ctx.respond("Would you like to apply for staff?", view=View())
``` code
Ah, ok. so simply add another button inside the callback. you could create a new view for the new message and a whole new button. if you don't want to make a whole new class, you could use this code as a short way of making a button:
testlol = discord.ui.Button(label=f"test",
style=discord.ButtonStyle.green,
emoji="😁")```
Hey sorry, What am i doing wrong here?
the new button has to be in the callback
Can you give me an example so i can understand better? Sorry if im being a pain
so i'm not doing the method of buttons your doing. you do with classes but i do just short boi code so here example of what i would do:
@lol.command()
async def lol(ctx):
#BUTTON
testlol = discord.ui.Button(label=f"test",
style=discord.ButtonStyle.green,
emoji="😁")
#FIRST BUTTON CALLBACK
async def testlol_callback(interaction):
firstbuttonembed = discord.Embed(bla bla bla)
#SECOND BUTTON
testlol = discord.ui.Button(label=f"test",
style=discord.ButtonStyle.green,
emoji="😁")
#SECOND BUTTON CALLBACK
async def testlol2_callback(interaction):
secondbuttonembed = discord.Embed(bla bla)
bla bla```
Why are these errors occuring? I know unidendents ofc but i cant tell where to fix that.
I dont know if i messed it up or i am being stupid
so select the whole button1_callback and then press tab, to bring it up one tab and also tab the testlol button
tabs on discord are slightly off, so when you copy and paste, it pastes weird
alr
I think it’s the latter
latter?
Just brings more errors for it, I press tab to bring it to the left right
first of all, view is not defined
Yeah but whats the correct code? I dont wanna mess it up :/
it's gonna be hard to help cuz there's a no-code-giving rule except for tiny snippets
I wouldnt copy it all though, Id just use it to know what to do then edit it all to fit what im doing, thats fine right
i dont wanna copy, I just wanna understand how to do it
?tag ex
Bot examples: https://github.com/Pycord-Development/pycord/tree/master/examples
Slash command/context menu examples: https://github.com/Pycord-Development/pycord/tree/master/examples/app_commands
Buttons, dropdowns example: https://github.com/Pycord-Development/pycord/tree/master/examples/views
?tag guide
The Official Guide for Pycord
the button guide dosent tell me how to respond to buttons with messages with buttons
lol
Learn all about implementing buttons in your Discord Bot using Pycord.
ty
Cant see anything about what i specficly need it just shows regular message responses, Is there another source that would guide me to have messages with buttons?
Is there a way to get all the messages in a channel?
@slow dome I need to know by tmr preferably (just a link that actualy helps)
it works wdym
these also are examples
The link there only showed how to respond to buttons with normal messages, without buttons
Ill have a look at what u just sent
you want to respond to it with a message with buttons?
Yes
Basicly this
just do it like
class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View
@discord.ui.button(label="Click me!", style=discord.ButtonStyle.primary, emoji="😎") # Create a button with the label "😎 Click me!" with color Blurple
async def button_callback(self, button, interaction):
await interaction.response.send_message("You clicked the button!", view = View2())
class View2(discord.ui.View): # Create a class called View that subclasses discord.ui.View
@discord.ui.button(label="Click me!", style=discord.ButtonStyle.primary, emoji="😎") # Create a button with the label "😎 Click me!" with color Blurple
async def button_callback(self, button, interaction):
await interaction.response.send_message("You clicked the button!", view = View3())
...
it may not be the most efficient
lol ima read the code there so i can understand it for myself 😄
Am i correct, I start the class just below my async def button(ctx):
?
if you are creating a button instance, you create a button with
view = discord.ui.View()
view.add_item(discord.ui.Button(label="label", style=style=discord.ButtonStyle.primary, callback=corotine))
do you know object oriented programming
at all?
I dont know if this is the same thing, I know a bit of css but if not no. I dont, Should i?
you should probably learn object oriented programming before learning py-cord
Whys that?
What does it help me with in coding bots
py-cord uses object oriented programming
Alright, Does it take long to learn or?
so if you don't know oop (for short), you will struggle
everyone is different
True, Considering myself i will probably take longer than average
Alright, What sources could i use to learn it?
?tag lp
Official Beginner's Guide: https://wiki.python.org/moin/BeginnersGuide
Official Tutorial: https://docs.python.org/3/tutorial/
Shortcuts:
https://wiki.python.org/moin/BeginnersGuide/NonProgrammers
https://wiki.python.org/moin/BeginnersGuide/Programmers
Learn Python:
https://automatetheboringstuff.com/ (for complete beginners to programming)
https://learnxinyminutes.com/docs/python3/ (for people who know programming already)
https://docs.python.org/3/tutorial/ (official tutorial)
http://python.swaroopch.com/ (useful book)
http://www.codeabbey.com/ (exercises for beginners)
someone of these may help
Thanks
np
sheesh is there a way to make this dark mode xD
my eyes 🤣
How can I make it send message.content only after it has already sent new_ticket_embed?
this is not possible in the same embed
you can make another one or just send a regular message
My problem is it sends my Embed and Message.Content as soon as someone opens a ticket....
oh
Yeah..
then when do you want to message.content be sent
After the second message so after the ticket open
guys
await role.edit()
what kind of parameters can i fit in this
await role.edit(color = discord.Colour.blurple())
this is an example
theres any more?
b!rtfm pyc role.edit
discord.Role.edit
discord.VoiceClient.endpoint
discord.VoiceClient.send_audio_packet
discord.ext.commands.DefaultHelpCommand.get_destination
discord.ext.commands.MinimalHelpCommand.get_destination
discord.ext.commands.DefaultHelpCommand.get_ending_note
discord.ext.commands.MinimalHelpCommand.get_ending_note
discord.ext.commands.MinimalHelpCommand.get_command_signature
b!rtfm pyc guil.create_role
