#Basic Pycord Help
1 messages · Page 79 of 1
first of all you should replace the permission check with @discord.default_permissions(administrator=True)
and guild_only is deprecated too
I've tried a couple of your suggestions but now the commands are beeing refreshed, tho i noticed one more thing, as u can see from the screen it shows that it has 1 mutual guild, but that one is my private server, so it's not showing the server where i added the bot
restart your client
sounds like you didn't add the bot
make sure you use the bot scope in your invite url
Ok it seems that this was the issue, thank you for the help
allgood
is it possible to make a command that requires an argument when used in the bot's dms but gives a modal instead when used in a server
you can't change the command's parameters between dm and non dm
but you can make it open a modal only in dms
I haven't touched my bot code in a while, I have a question about Cogs
I have one cog and there is a function outside of my class called setup(bot)
I thought I remember reading that this was required by Pycord to setup the Cog
But as I'm looking at the Cog documentation, I'm not seeing reference to this being necessary or even shown
Has this changed?
it is required as documented under extensions
There comes a time in the bot development when you want to extend the bot functionality at run-time and quickly unload and reload code (also called hot-reloading). The command framework comes with ...
when you create a cog as its own file, pycord loads it via load_extension
I am seeing that now, thank you!
is there a way to tell whether commands aren't showing up because i'm being rate limited or because i'm doing something else wrong
ok, i'm doing something wrong i guess
Any idea why Im not able to use self.bot.get_channel(channel_id) from within a Cog when outside of the cog it returns the channel just fine? I'm assuming it's some misunderstanding by me about the context of the bot within the Cog?
do you mean in a cog __init__
I'm trying to grab it in one of the class functions outside of __init__
or in your commands
It's in one of my commands which is a loop
mmmm could you show the code
if you haven't already, set up logging
Pycord logs errors and debug information via the logging python module. It is strongly recommended that the logging module is configured, as no errors or warnings will be output if it is not set up...
thanks i've already done that
class Test_Cog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.rolecheck.start()
self.DEV_CHANNEL_ID = int(os.getenv('PERSONAL_DEV_CHANNEL'))
# Testing, get_channel returns None
# Confirmed that channel id is as expected
channel = bot.get_channel(os.getenv('PERSONAL_DEV_CHANNEL'))
print(channel)
#@tasks.loop(time=datetime.time(hour=17, minute=29))
@tasks.loop(seconds=10.0)
async def rolecheck(self):
update_users = get_misranked_users()
output_message = self.format_users(update_users)
# Testing, get_channel returns None
# Confirmed that channel id is as expected
print(self.DEV_CHANNEL_ID)
channel = self.bot.get_channel(self.DEV_CHANNEL_ID)
print(channel)
#await channel.send(output_message)
def setup(bot):
bot.add_cog(TestCog(bot))
.tag get_x
Any function that starts with get_ in Py-cord is retrieving the related object from your bots cache. If the object is not in the bots cache the get_ method will return None. Because of this behavior you should check if the get_x method is None and if it is use the fetch_x method.
Why Is Using fetch_ Without Using get_ First Bad?
The fetch_ method makes a call to the discord API. This API call is unneeded if you already have the information. It will also make your command take longer because it will have to send and than wait for a response from the discord API. It will also contribute to the discord APIs global rate limit of 50 requests per second.
What Is Cache?
The cache is a temporary storage inside your bot. It holds many objects from members to messages. When you restart your bot the cache will be empty. When the cache is full it will delete older objects to make space for the new objects.
Oooh that's interesting, thank you very much I will try it!
Seems like it works now, something like this?:
channel = self.bot.get_channel(self.DEV_CHANNEL_ID)
if channel is None:
channel = await self.bot.fetch_channel(self.DEV_CHANNEL_ID)
get_channel does not work in __init__ because cogs are loaded before the bot starts
only inside __init__ / any function that would run before bot.run
it's still fine inside command code, task loops etc
my personal preference is you define property inside your cog instead py @property def channel(self): return self.bot.get_channel(my_id)then you can access self.channel in your code, for example
@property basically makes an attribute that calls that function every time you access it
Oh very neat
it would still have to attempt to fetch though, right?
So it would have to be async?
no?
uhh, don't you have to await the fetch?
well you do, but moreso i mean you don't need to fetch at all
for small bots you can pretty safely assume you have all channels cached
But isn't that the issue I'm already running into, where it isn't cached?
because you were running it in __init__ no?
No, it was ouside __init__ in my loop
I had it both in __init__ and outside for testing
well you're also starting the task inside init
some advice from the task docs is you wait_until_ready
I did see that in the before_loop, so that would ensure my channels are cached?
yes because the task won't start until the bot fires the on_ready event
Ok that makes sense
wait_until_ready is useful if you need to ever guarantee the bot has fully started first
So then I can leave starting the task in __init__
that's pretty standard yea
allgood
Very nice, that worked great
how can I add/use the same command group in multiple cogs?
that is not natively possible in py-cord, however you can take a look at https://github.com/Dorukyum/pycord-multicog

If I have the name of an emoji is there an easy way to programmatically grab the id?
check bot.emojis or guild.emojis for a specific guild
discord.utils.get makes this a bit easier (e.g. get(guild.emojis, name="..."))
get(emojis, name="") is exactly what I was looking for, thank you!
is there something specific you gotta do to access the value of a modal input field?
my attempts are just giving None
could you share a little more on how you're doing that ?
class SplashModal(discord.ui.Modal):
"""A modal for submitting a splash."""
def __init__(
self,
*args: tuple[discord.ui.InputText],
**kwargs: dict[str, str | float | None],
) -> None:
"""Initialize the modal."""
super().__init__(*args, title="Submit Splash", **kwargs)
self.add_item(
discord.ui.InputText(
label="Splash",
style=discord.InputTextStyle.short,
placeholder="Enter splash text",
min_length=1,
max_length=80,
)
)
``````py
splash_modal = self.SplashModal()
await ctx.send_modal(splash_modal)
if not await splash_modal.wait():
await ctx.respond("splash submission cancelled.", ephemeral=True)
return
splash_text = splash_modal.children[0].value
wait i may be wrong
misread my logs
well, different issue: the modal doesn't go away when submitted, and the cancel message doesn't appear when cancelling
Because you can't know when someone closes the modal
That's just a timeout iirc
and you need to respond to a modal submission
Here's the modal dialogs example.
this includes an example for callback
...so you're required to send a message for the modal to close?
how can i get a slash command group object by name and add a new command to it
https://discord.com/developers/docs/resources/user#user-object In the Discord docs, the user has a primary_guild. Will the py-cord user also have a primary_guild in the next version?
it will be, though it seems we might need a new pr for this
Need the tag for my feature.
until then, you can get the raw data through await bot.http.get_user
don't want to call this again for every command
you can always build the feature yourself
I think I don't know enough about py-cord for that
then wait until its part of the lib
is it fine for a modal to just never timeout?
you can set timeout=None
ya but is it fine to do so
if it wasn't fine we wouldn't let you do that
(tl;dr yes)
maybe if you have hundreds of modals at once it would theoretically be a memory bloat but that's a pretty peculiar scenario
like i mean, you can set the timeout to none on http requests, yet that's still considered a bad idea
well modals aren't http requests
as in hundreds of different modals or the same modal?
like a hundred users triggered modals at the same time
hmm
(quite frankly modals/views in v2 aren't designed well internally, but it's not gonna blow up your pc or anything)

Was that it?
that should be good enough if you just want it cached
okay than pr?
well an actual PR will have more depth
i'm saying the code you've done there should be enough to have it available on your member cache without needing to fetch
But can I install this branch locally?
oh yeah
something like pip install git+https://github.com/bastigamedc/pycord.git@primary-guild
Okay, I'll try it right away
I also use the containers, is it possible to use both?
Yes because cv2 is on master now
A few days ago? Maybe a week I forgot
Why no #library-updates announcement
oh okay
https://github.com/Pycord-Development/pycord/commit/b5b0bf27f3fe9034d42d347964b434451e666d38 I'm starting to understand it
is this cursed
await (await ctx.author.create_dm()).send(f"submitted splash: {splash_text}")
You should probably not make it a oneliner
you can just do author.send
oh okay
i tried ctx.author.dm_channel.send initially and that gave me an error for none type
it's because User.send calls create_dm if it isn't cached already
fair enough
if i had a shot for every time god damn time i forgot to await a coroutine

if you set PYTHONASYNCIODEBUG to 1 in your env it will warn you when you forget to do so
before or after i run the code
cause it is giving me these
RuntimeWarning: coroutine 'Interaction.respond' was never awaited
splash_interaction.respond("submitting splash", ephemeral=True)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
oh then it's probably already set
maybe by some logging
or by vscode or your ide
that's the default coroutine warning
Hi, I'm giving bot.get_message() a valid message id, but it doesnt return a message
the bot has access to the channel with the message and has all necessary privileges
message isn't cached
so, it’s not guaranteed to work with any message id?
yes
alright, thanks for the help
in such a case you have to await channel.fetch_message(id) if you need to retrieve data from the message
if you only want to edit/delete, you can use channel.get_partial_message
Hi, does anybody know if it is possible to get the Join Method of a member, as shown in the "Members" tab of a server?
This is currently not officially available in the discord api and is thus not available in pycord
I was afraid of that, thanks anyway 🙂
you can use a workaround to get the used invite tho @vital bramble
Yeah with cashing the invites and checking which use has gone up, right? I don't really like that approach and it's also not really that important for me anyways.
Change Theme Guilds Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI. Guild Object Guild Structure Field Type Descri...
this is not guaranteed to work at any time for any reaso but it exists
nice, thanks!
def is_streaming(member: discord.Member) -> bool:
"""Check if a member is streaming on Twitch/YouTube. Must have 'Dino Hub' in stream title..
Args:
member (discord.Member): The member to check.
Returns:
bool: True if the member is streaming, False otherwise.
"""
if not member.activities:
return False
for activity in member.activities:
if isinstance(activity, discord.Streaming):
if activity.platform in ['twitch', 'youtube']:
if activity.name and 'dino hub' in activity.name.lower():
return True
Does this make sense for checking a user's status if they are streaming on twitch/YT and they have a specific keywod, dino hub in the title?
looks fine enough? might need to check the casing for activity.platform
did a check on my members, it returns Twitch and YouTube
could just do activity.platform and activity.platform.lower() in ...
how many servers do my bot have to be in to require sharding?
It's not smart to say that here lol
2.5k
It's when discord tells you to shard
You should probably start sharding before
if i dont it'll experience lag?
You will be forced
Otherwise it won't let you connect
Against tos? There are staff here and people close to it in this server?
How is what working
For what reason
You won't get help on how to build a self bot
Well you're literally asking for help
"How to get user token" -> to put in a self bot -> to break the tos
You're not very smart are you
Doing it for the fun and giggles doesnt make it allowed
Using your user token outside the client itself is against the tos
There's nothing to study or practice about self bots.
So drop it.
You won't receive help about self bots here.
So stop pushing it.
You dont seem to understand that using your user token outside the client is against the ToS. You won't just funnily get your user token to look at it.
Again. Drop it.
The term platform abuse refers to activities that disrupt or alter the experience of Discord users. Sending unsolicited bulk messages or interactions (or spam) is one of the most common ways the user experience is disrupted. Spam can be sent by automated accounts designed for this purpose (spambots), normal user accounts that manually execute spammy actions, as well as by user accounts modified to perform automated actions (self-bots). Making modifications to the Discord client for the purpose of spam or any other reason is not allowed under this policy.
Oh wow!! They said user accounts can't be automated!! What would that mean? That you can't use your user token to perform actions on a code? Maybe!!
-ban 958077120612032612 Intend to selfbot -FO
🔨 Banned kartoshka_ma indefinitely
War schon kurz davor dich einfach mal zu pingen ;3
oh nvm xd
I mean it says it can't
You can see them all here https://discord.com/developers/docs/resources/message#message-reference-content-attribution
WARNING:discord.gateway:Shard ID None has stopped responding to the gateway. Closing and restarting.
Killed
I can't tell if this is the product of the bot itself getting OOM'd, or the gateway no longer responding and something in pycord (or lower-level dpy) churning until death
isn't that a discord thing where is wants you to reconnect or something
yes
So is there a way to have pycord automatically do that?
Does it not? "closing and restarting"
@round heart I've been running into something similar which is why I just joined this server. Are you experiencing bad states with your bot?
I found that someone under discord.py wrote this as an issue
Older ref: https://github.com/Rapptz/discord.py/issues/3994
newer ref with fix:
https://github.com/Rapptz/discord.py/issues/10207
but I am still encountering this issue with py-cord. Anyone ran into this before?
-remindme 30min bad gateway states ?
Set a reminder in 30 minutes from now (<t:1754422585:f>)
View reminders with the reminders command
also.. out of curiosity is py-cord a true wrapper or does it implement discord ? if so what version of discord?
Apologies for dupe questions if these have been asked before
py-cord is a library for interacting with the discord api, just like discord.py and others are. It doesn't "wrap" anything other thant the official discord api. I am not sure if this is your question, but py-cord is on API version 10
ah ok that makes sense. Yes that answers my question thnx @echo wraith
awesome, I can provide more info just lmk
i fixed it on the voice fix pr
Cleared 1 reminders
.tag master
pip install -U git+https://github.com/Pycord-Development/pycord
-# Note: The Master Branch May Have The Newest Features But It May Also Have More Bugs
The docs for the master branch: https://docs.pycord.dev/en/master/
could you try with this ?
yee, gonna try now
perfect
it worked 😭 i could cry irl
thanks ya'll. you guys rock
been debugging this for a while now and couldn't find a way to replicate it, but it's behaving as it should from what I see. I'll drop in here again if I encounter any issues with it
sure no problem
I doubt it’s related to mine, since I don’t use voice chat
No. It just gave me that error, churned, and then got killed by out of memory manager
Is anyone else still occasionally experiencing https://github.com/Pycord-Development/pycord/issues/2799 on master?
Some people mentioned that in the issue
And yet it's been closed and marked as completed. I'll try to get the logs the next time it happens
Any reason why a @bot.command won't get registered? The (changed) bot's been running for a few hours already
I think we misinterpreted it for another issue but there is still a PR open to fix it
Thank you!
Flag 'delete' is required and missing
Appears to be linked to PR #2800 which was merged
Ydah that was a mistake
Which PR is the one that's supposed to solve it?
#2651
Summary
Discord, in all their wisdom, decided to deprecate old encryption modes and have them removed in the span of 3 months.
Untested, please help
Information
This PR fixes an issue.
This PR ...
Thanks
How did they manage to do this?
emoji on the left side of 2 text fields (or maybe one with \n)
also there is another accessor component (which is a button here)
it's four custom emojis
oh now I get it lol
that look fire btw
yup
also messy cuz, u need to maintain emojis
a big image split in 4 parts and uploaded to bot
then merge these 4 in a text field side-by-side to text
eh they can just wrap it into a function and call it a day, easy enough to generate
in terms of pokemon they can upload 500 x 4 to the bot and then split the other 500 across servers. but that bot was only a proof of concept used for CV2 demonstration and not one of the huge pokemon bots
you can read the code for it here https://github.com/DV8FromTheWorld/discord-pokedex/
Why don't modals reset their _stopped future when resending them? Is that a feature or a bug?
modals are such a mess...
So there is no deeper reason behind that design choice?
nobody thought of it most likely
I just don't want to break anything when I change it myself
yeah, probably 🙂
Im not sure if it is intended to reuse a modal instance
Then why is it so difficult to copy them?
Because there are definitely use cases where reusing makes it a lot easier/is necessary
Yeah, I guess there is nothing stopping you from doing that
I guess it was just an oversight :/
Well, there IS the question of WHEN the future should be reset. When the modal is sent or maybe even before that (directly after receiving it?). Maybe that was the problem.
But I also think, that the modals in pycord are not designed to be reused, but they should be.
why is this code throwing a AttributeError: 'NoneType' object has no attribute 'value' error?
what's the full exception
wait that's from multiple reboots
Ignoring exception in on_connect
Traceback (most recent call last):
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\client.py", line 412, in _run_event
await coro(*args, **kwargs)
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\bot.py", line 1214, in on_connect
await self.sync_commands()
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\bot.py", line 742, in sync_commands
registered_commands = await self.register_commands(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
global_commands, method=method, force=force, delete_existing=delete_existing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\bot.py", line 541, in register_commands
desynced = await self.get_desynced_commands(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
guild_id=guild_id, prefetched=prefetched_commands
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\bot.py", line 364, in get_desynced_commands
elif _check_command(cmd, match):
~~~~~~~~~~~~~~^^^^^^^^^^^^
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\bot.py", line 278, in _check_command
as_dict = cmd.to_dict()
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\commands\core.py", line 943, in to_dict
"options": [o.to_dict() for o in self.options],
~~~~~~~~~^^
File "C:\Users\domin\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\commands\options.py", line 358, in to_dict
"type": self.input_type.value,
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'value'
there we go
"many people sharing one physical body" ... I saw a movie about that once >.>
oh please do not bring that movie up
it's such a bad portrayal it's laughable
Oh, I'm talking about the one I found in my dad's room
you didn't type the user argument
(i think)
oh? what's the name of it?
I expected you to be talking about split, everyone brings it up
i.e. either add a full @option decorator or just type it like user: discord.User
Defi...
ohh
😬 Sorry, I'm making an adult joke.
ah, I see.
I've honestly meant to watch this because it's supposed to be related to Unbreakable, which was.. mildly interesting
it's apparently entertaining just, not very good rep for did
Oh, I though it is again some full blown Pokemon bot
well it does as it's designed, but it was something made over an hour or so in a ddevs event stream and only covers the original pokedex
yup I was in the stream ;-;
ah ic www
they were all yapping
It was interesting watching it get built. But sucks they had to be hacky with the images... should've been a learning moment that they should add a large image element on the left.
their reasoning is that they're giving users control over vertical layout, while horizontal layout is strictly on discord
because they want to be somewhat vaguely consistent, though i can understand it being frustrating
The schould actually add 2 more components
- Positionable accessory components in Sections.
- Horizontal text fields, just like fields in embeds.
fields is not happening, they're considering maybe some sort of second column but that's about it
Not a huge fan of horizontal fields but, like it was good feature
cuz on mobile it looks trash
multiplatform is essentially the reason yeah
when devs assume the gonna put 3 text fields horizontally, and later realize they all gonna be vertical and look more ugly on mobile 😔
dv8 is pretty focused on accessibility and so the old methods embeds use is out of the question
Imagine rewriting Dyno for the sake of cv2 💀
not a big deal cuz most of dyno's setting are on Dashboard
eh they could get away with most of it
ah I'm looking for the wrong thing, I'm basically looking to mention myself (user of the slash command), while this is an option selector for a user, what do I use then?
pain will occur in economy and fun type bots, with huge amount of embed styling and emojis
then remove the user arg, you're looking for ctx.author
ah, thanks
allgood
well it's not like embeds are being removed, they just aren't getting new features
- boring, like we're playing the API game since years 💀
we should get some more things to tweak
there will be
huh
As long as they continually update cv2, it's fine. But I will probably continue using Embeds for more simplistic stuff.
no... your function already has ctx as the first argument
you just reference that in your code
yeah LOL
oh my god I'm stupid I'm so sorry lmaoo
no worries
turns out all of this was for nothing, footers can't ping anyway
what the hell, sure
funnily enough my fields are perfect length to be side by side
so even that wouldn't work
new field with name="", value="-# some text"
🙃
true, let me try that
I thought like lets create one )_)
ah no it's cool dw
yeaaaah 
inline=False
and that's perfect, thanks!
allgood
Lmfao
#general message star it to send that to #starboard ;-;
for some reason my embed paginator is returning ‘this interaction failed’ after changing the page? pages work fine but getting that annoying little message for no reason. no error shown in console too. https://paste.centos.org/view/ce36c168
You're not responding to the interaction
do you know there's a prebuilt thing for pagination
thank you both ^
Why is it that when I run
vc = await ctx.author.voice.channel.connect()
The bot just hangs until it eventually times out?
It is probably due to a bug that has been fixed on the master branch
pip install -U git+https://github.com/Pycord-Development/pycord
-# Note: The Master Branch May Have The Newest Features But It May Also Have More Bugs
The docs for the master branch: https://docs.pycord.dev/en/master/
Just installed the master branch version but it still does the same thing, where the bot connects to vc, but does nothing after that and times out
Do you have any errors?
Thanks for wanting to help, I took a break for a while and just came back to it not timing out anymore 😅
I'm not sure why
But I didn't change anything and it just started working
I'm going to keep this link in mind for future reference lol
Thank you
-help
Is there a good way of deleting a small number of messages at once?
There's a channel.purge() but seems to require a check function.. is there any way to pass in a list of message ids or something?
it does not requiered a check
but you could use channel.delete_messages
Ah-hah. Thank you
Is there any way to detect messages from voice channels?
Doesn't on_message detect them?
nop 🙁
Do you have the messages intent enabled?
does pycord even support that yet
or did that release after 2.7
it does not need to support it
it’s just doing VoiceChannel.send
as long as VoiceChannel is a Messageable
For example, if I want to create a command to delete text messages from either normal chat or voice channel chat, should I also include VoiceChannel?
see if voice channels appear that way
Pycord should already support that afaik
and you dont need required= if its true
That work good
does it not show voice channels with just TextChannel?
no because they aren't TextChannel
could you do it with channel_types?
any ideas for features for my bot
Isn't there a generic class that includes TextChannel and VoiceChannel etc? 😐
abc.GuildChannel maybe?
That would include category and more if I am not mistaken
You're right
But they want text channel as well
why is this even still being discussed, the answer is channel_types
I don't even know what the original question was XD
same
Idem
Hey guys, I have something weird going on.
One of my cog's is constantly asking for the ctx parameter when calling the command in discord, but it's not happening for any of my other commands.
It's only happening with this one cog, and I'm not sure what I'm doing to cause it. Source added as image 'cause too poor for Nitro xD
.tag paste
Please copy and paste your code here. This makes it easier for everyone helping you.
Something like that is pretty hard to read ;3
Yeah, sorry. Slow brain in the morning didn't think of that. Link provided 🙂
I see you import CommandGroups from a cog?
Yeah, I didn't know multicog was a thing, so I've been using a little hacky approach. Will be converting to multicog soon.
To split slash command groups across multiple cogs with Pycord, you can use pycord-multicog. Install it via pip install pycord-multicog. Initialize your bot by using from pycord.multicog import Bot. Define command groups in one cog and extend them in others using @subcommand. For example:
# Cog1.py
class Cog1(commands.Cog):
group = SlashCommandGroup("group")
@group.command()
async def subcommand1(self, ctx):
await ctx.respond("This is a normal subcommand.")
# Cog2.py
from pycord.multicog import subcommand
class Cog2(commands.Cog):
@subcommand("group")
@slash_command()
async def subcommand2(self, ctx):
await ctx.respond("This subcommand is in a different cog.")
The issue I found with multicog was adding subcommand groups.
Example:
All RSS related commands are in separate class files within the same module folder.
The rss command group is defined in rss_feeds.py along with a subcommand group, feeds resulting in the command /rss feeds add, etc.
I then want to create, in the template cog, the /rss template subcommand group.
Either way, as far as my understanding goes, I'd still need to import another cog to access the rss command to then add a subcommand group, or is my understanding incorrect?
Unless I define the subcommand group in rss_feeds and then use the @subcommand decorator to add the commands to it, I guess. Brb, giving it a try
Bahahaha
Whats ur issue i dont get it ?
Is it to use group and subgroup ?
If yes you should just do
subcommand(group subgroup) with a space between
Original issue was that commands when used in discord were asking for the ctx parameter (ApplicationContext) but only for the one cog.
Can you show me ur code ?
Are you passing self outside a cog ?
https://mystb.in/819395ea47cfb560d0
Not that I'm aware of. Other than the command methods featuring self as the initial param.
Ur not using the subcommand from the multicog here
I don’t think also at the end you need the bot.add application vommand
If ur using bot.load_extension
I wasn't using multicog at all this morning, so that might be the issue. I'm currently refactoring to use multicog 🙂
Then to use multicog you need to stop importing the group, and just add the subcommand decorator
Create all of ur group in one file which will be run before all the other cog
OKay, I'll give that a try and come back if the problem persists. Thanks.
after i've deferred a response, is it possible to then respond with just a view? (for components v2)
when I try, i get the error about the existence of content / embeds
can you share the error, you should not be having this issue unless you are actually supplying content or embeds
one sec, lemme recreate it rq :)
it sure would be a shame if i messed up the validation somehow
one sec for the code
allgood
im having an issue running the example code on the github page. It doesnt seem to register a command for me. Is there something special I have to do other than run this with the bot in my server?
import discord
bot = discord.Bot()
@bot.slash_command()
async def hello(ctx, name: str = None):
name = name or ctx.author.name
await ctx.respond(f"Hello {name}!")
bot.run("token")
im using python 3.13.5 and created a fresh venv with only pycord installed
did discord break the api recently maybe?
refresh the discord client
i spent..... too long before asking for help
thank you lmao
https://docs.disnake.dev/en/stable/ext/commands/api/app_commands.html#disnake.ext.commands.Param
Please tell me the equivalent of this in pycord. I am writing autocomplete
-# Please ping me when you reply to me. I use a translator and can't see all messages
Here's the slash autocomplete example.
Take a look at the above
Okay.
Thanks.
If there are any other options, please let me know.
-# Please ping me when you reply to me. I use a translator and can't see all messages
can there be two selects in one discord message?
Up to like, 20
thanks
But if you go above 5 selects, the library will switch you to CV2 which will disable content and embeds
alr
embed = discord.Embed(
title=f"[{artist_name} in {ctx.guild.name}]({artist_url})",
url=artist_url,
color=discord.Color(0xFFFFFF),
)
im hoping this is fine? its still dpy but this server is far more helpful than the dpy one
title won't take markdown
breh
you only need the visible text, url will do what you want
consider switching to pycord :>
ye i forgot to remove it, noticed agfter running the command
😭 i would if the bot im working on wasnt too far into its progress
i regret not starting with pycord at the start of it
switching isn't much effort, from experience
😭 ive never switched thats the issue though
all the core stuff is the same, the only difference are command decorators, and maybe options? but not sure there
ayye it works now
oh yea decorators is a thing i rely on
oh you're using a client mod that's why I thought it looked like cv2
well yea but it's basically just changing the name to another if I remember right, and not needing a lot of weird stuff like manual syncing and stuff
ig read the guide and you can tell how much is different, been a long time since I used dpy
i'll def look into it then once im done workjing on this cog (unfortunately might take all day since I have to test it on production instead of my testing bot)
plus everyone here will help you if you have problems switching to pycord :3
_< good to know; this server does seem to have alot better of a community
do you know how to fetch the artist cover art for lastfm? ive never been able to get this to work for some album covers and artist cover art
but fmbot seems to have no issue with it
there's probably an API
ah
well then it's somewhere in there surely :)
it doesnt seem to fetch all the cover arts
part of me wants to look thru lastfms repo and see since its oss but at the same time its .NET and C# and i dont know jack abt either
you are reading their docs right
what are you using LOL
docs are the key to using any API or package
if you don't read docs you're screwed usually
for the music fetching?
yea

i use pylast for the authentication stuff i think thats all though
the rest os their api
yea
so
we'll go through their API docs and you'll find it somewhere 100%
literally one thing uses pylast
self.network = pylast.LastFMNetwork(
api_key=self.api_key, api_secret=os.getenv("LASTFM_SECRET")
)
self.db = None
just this
so like, is the request not returning an image at all or does it return some generic url
😭 my nightmare
well as I said as a developer you read docs or you'll be in huge pain
they have a generic image if the cover isnt fetched properly
one second
i mean lastfm docs are pretty simple https://www.last.fm/api/show/album.getInfo
then you probably can't circumvent it unless you wanna use another service's api
i.e. if lastfm themselves isn't returning it then you kinda just have to roll with it
well if that's the image returned by the API I guess you're out of luck
depends if multiple requests have the right picture sometimes and sometimes default, that'd be something to look into
like for the same song
so i checked the url, and whatever lastfm uses https://i.scdn.co/image/ab67616d0000b2732d4aa8abd5ebeb4657e609e0 is what the url shows for the current song, so its not from lastfm so i guess i'll check that
hmmmm
ion even know what this thing is
that's spotify's cdn LMAO
wow
so chances are the given album is not on Spotify or smth lol
oh
which is the correct cover
my bot on the other hand
it sends this https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png
😭 jus realized thats a really long subdomain
maybe just print the raw request data and see what it looks like
star
are you sure the album has art on lastfm
well there you go
i figured that out after you told me it was spotifys cdn that url belonged to
or
nelo
How do we use the new copy text feature in components v2?
the above
Do we also have Container.copy_text
yes
Oh okay, thank you 😃
View.copy_text will copy the contents of all TextDisplay items in your View, including Containers and Sections
this is the same behaviour as Right Click -> Copy Text on CV2 messages
Ohh
@errant trout can footers have hyperlinks in CV2?
footers don't exist in cv2
oh
also no need to ping Nelo someone will reply
instead you can use the -# syntax
sorryyy 
😭 yea smb just told me the same so'
use this
-# [some link](https://discord.com)
I'm not using CV2 rn so thats why i was asking
in normal embeds you can't
yayay, i finally figured out the spotify api stuff
Compact mode dang
I use compact mode and light mode
by using light mode, you are contributing to global warming
using light theme is a sin
Anyone know how to get everyone in a Discord server with a specific tag / every member who has the server tag applied
bot.http.get_user(uid)["primary_guild") i think
you will need to iterate through everyone, its not in 2.6 (obv), and im not sure if master has it properly built in
but that is the way i did it
Saint if this works- I have a client wondering if he can make giveaways exclusive to server tag holders
Is it available in another branch or PR?
i really dont follow the PRs or what happens on the master branch, no idea
Works with master- ty
well this will also work on 2.6
i just meant on master it might be actually part of a Member object which would make it way easier to use
Easier to select and reroll automatically to avoid ratelimits in that case
yea its not properly on master yet either
yea I think we are just gonna check when they sign up and when the giveaways rolls
Makes sense
Hi, is py-cord compatible to python3.13? Because i had issues with the audioop library being deprecated
You need to use the master branch for 3.13 support. Or you can install audioop-lts
Aight thx, so it will be in the next release?
yes
Im trying to change the message the bot says when it defers a command. is this possible?
@bot.slash_command()
async def defer(ctx):
await ctx.defer()
time.sleep(3)
await ctx.followup.send("Done!")
Right now it says Bot is thinking...
you cannot change this message
also never use time.sleep with a discord bot, you should import asyncio and await asyncio.sleep instead
thank you ill do that
im having trouble using asyncio.to_thread(). I want to make the docker sdk async but just for testing im using still using time.sleep()
@bot.slash_command()
async def defer(ctx):
await ctx.defer()
await asyncio.to_thread(time.sleep(3))
await ctx.followup.send("Done!")
this throws discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: 'NoneType' object is not callable
for to_thread (or run_in_executor under the hood), you do not call the function. you pass the function as the first argument, then its args/kwargs after
e.g. in this example it would be (time.sleep, 3)
thanks again
Wouldn't it be simpler to just use await asyncio.sleep(3) instead?
yes, but they were just using time.sleep as an example here
When using the basic slash commands example no slash commands seem to be available. What am I doing wrong?
@bot.command(description="Sends the bot's latency.") # this decorator makes a slash command
async def ping(ctx): # a slash command will be created with the name "ping"
await ctx.respond(f"Pong! Latency is {bot.latency}")```
.tag slashnoshow
Application Commands Not Showing Up?
- Refresh Discord by restarting or pressing
Ctrl+R(orCommand ⌘ + R) - Uninstall libraries that conflict with the
discordnamespace (e.g.discord.py). - Invite your bot with the
application.commandsscope. - Load cogs before
bot.run()(e.g. not inon_ready). - Do not override
on_connect. - Update to the newest version of
py-cord(see?tag install). - Turn off
User Settings > Accessibility > Chat Input > Use legacy chat input. - Share your code and errors.
Ah, I just needed to refresh discord
Hello !
Is it possible to call something like self.my_function in an autocomplete callback ?
Just make the autocomplete part of the class
okay got it, thanks !
I am trying to do a generic "redo command" view that i can just add to the end of views, and which will just re-call the command. I've got this far
However, the invoke constantly throws this error despite ctx.command being set properly inside of the original command callback. how?
command is a property
save it from the old context and reset it when the button is pressed
save it where? in the init?
👍
now :) next lil problem
the command im invoking may defer at times - but since its intended for a slash command context, it doesnt pass invisible=False
is there a way to force this without changing the command code?
subclass context to do it for you :3
okay erm
it all works like i want now, but i can only re-run the command once x3
the second time around, i get the same error with command being none
How can I make it so I can run a command from my bot in any dm, not just a dm with the bot? Some apps I have installed allow me to run their commands when I’m talking with friends in dms, but mine doesn’t. How do I do this?
you need to install your bot to your user account
make sure it's enabled on dev portal, then grab your bot's install URL and add &integration_type=1
Ok I'll try that
that worked but its not showing up when i type /
in a dm
the bot IS running
reload discord, but you also may need to specify your command can be used on a user installation - in your command or slash_command decorators, you need integration_types
Here's the slash users example.
oh i see
Hi guys, I have a question: how can I get a user's banner in the server where the command is used? In the documentation, it says to use fetch_user() and it works, but it returns the global banner, and I want to get the banner the user has set in the server (in case they have Nitro).
I tried with Member but it returns None Can someone explain this to me better? Or maybe I missed something else in the documentation.
guild_banner and display_banner are available on Master branch (same usage as guild_avatar and display_avatar)
perfect, thank you 
Hi, how we become a new pyxord update wirh the New functilnallyties
Soon ™
Hi guys, is it possible to check if someone has the "guild tag" like in my case in the image "QKZ"
yes
if you're on 2.6 it's a bit hacky tho
bot.http.get_user(id)["primary_guild"] I think
get user
But yeah that's it
where do i put the "timeout=none" thing
if i do discord.ui.View(timeout=none) in the first yellot brackets my bot crashes
sry what?
pass timeout=None to the super init call
so "super(timeout=None).init()"
no, to the init
so after the init
oh thx
also my code crashed and it said it can only have 2 positional arguments but 3 were given
show the traceback and your code
Thats the crash if u mean that:
Ignoring exception in view <Annehmen_Button timeout=180.0 children=1> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='Annehmen' emoji=<PartialEmoji animated=False name='😎' id=None> sku_id=None row=None>:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Roaming\Python\Python313\site-packages\discord\ui\view.py", line 426, in _scheduled_task
await item.callback(interaction)
~~~~~~~~~~~~~^^^^^^^^^^^^^
TypeError: Annehmen_Button.button_callback() takes 2 positional arguments but 3 were given
oh, yea, you are missing the button argument in your callback
it goes between self and the interaction
button argument?
sry i had a break and just came back to my bot
just add it between the self and interaction arguments of the button callback
i mean how do you write this argument
just button or something
the name doesnt matter
you can also name it _ if your IDE says you aren't using the argument
Hello !
About this in the API. Am I wrong or is it just impossible to create a forum thread ?
Here in the docs we have the "content" value : https://docs.pycord.dev/en/stable/api/models.html#discord.ForumChannel.create_thread
I also have this error when I try with "content" variable : In message: This field is required
But if I try with message :
TypeError: ForumChannel.create_thread() got an unexpected keyword argument 'message'.
Am I doing something wrong ?
show your code
can't repro
the argument is indeed content, not message
show your code
if channel.type == ChannelType.forum:
new_thread = await channel.create_thread(
name=translated_name[:100] if translated_name else thread.name[:100],
content=starting_message,
)
else :
# Create the thread in the target channel
new_thread = await channel.create_thread(
name=translated_name[:100] if translated_name else thread.name[:100],
message=starting_message,
auto_archive_duration=thread.auto_archive_duration,
slowmode_delay=thread.slowmode_delay,
invitable=thread.invitable,
type=thread_type,
)
do you have the full traceback/error, and what pycord version are you on
no I don't, I have the HTTPException (I am not at home rn, I will have it later). And I am on pycord 2.6.1
oh wait
what is starting_message
because you're using it in both content and message, which is wrong
content in ForumChannel.create_threadshould just be a string, while message in TextChannel.create_thread is expected to be a full message
(because you don't create forum posts from an existing message)
oh okay !! that's why ! mb
allgood
will check it but it should be it
anyone know how i can shorten this without killing readibility
Also I think master has a bug, I (obviously as you can see) have a banner, but member.display_banner is None for me
does indeed print None when used on me even though i have a banner
I think the issue is that the banner (according to the docs) is only available via Client.fetch_user, and well, that cant work for Member. The lib currently doesnt fetch the user object when realizing there is no guild-specific banner, it just returns it from the user object within member (if you know what i mean) where it is not if it hasnt been fetched
should i make this a github issue
I think it's an API issue. I tried getting the Member object from a server by making a direct request to the Discord API, and the banner is None
I don't understand this 
The guild specific banner is given over the gateway IIRC
the global banner needs to be fetched yes
Yea so first of all discord should get its shit together
but it is a lib oversight that the user isnt fetched before returning the (not cached) banner
The lib shouldn't fetch or cache it when it can't update it imo
So is there a way to get a member's banner? Not the global banner.
member.display_banner
but itll be none if there's only a global banner
yea i think ill make a github issue brb
But it is None, also as I said I tried with the API and it still returns None in the banner, it is very strange or maybe I am doing something wrong, I don't know
You sure the user had a guild specific banner? And did you fetch member or user
fetching member doesn't return the global banner
The banner appears here but it returns None (I tested it with a user who has Nitro)
Do you know about this?
That's Guild.fetch_member yeah
Did you fetch is via pycord?
Use both methods, from the library and using aiohttp
And it doesn't work
I don't understand 
:3
either the library forcefully fetches it when querying display_banner, or the docs need to be updated, or the name should change
pretty sure it's because the member banner is overriding the user banner
wdym?
but avatar is designed in the same way so maybe not...?
remember User.banner is only available on fetch
and as far as i could tell the lib returns member.display_avatar or user.banner (whatever it is called exactly in the code)
and since the banner isnt cached cause it wasnt fetched, 💥
well not boom but None
we will keep display_banner because fetch_member does return user.banner, but add a warning on docs saying the behaviour is different from cached members
then just fix the issue with fetching member not storing user.banner properly
wait so
the intended behavior is now having to fetch the member then?
It does?
Oh it does now
Finally
Is there some more space saving way to do this? I haven't done that much with CV2 yet but I've always done it like this so far, and bigger CV2 views take up quite a lot of space like that
or better, is this even the intended way of using it or is the container.add_x the intended solution
You can use the add methods but imo your current code looks better
view = discord.ui.View().add_item(
ui.Container(color=...).add_text(
"Hello world"
).add_item(
ui.MediaGallery().add_item(
"url here"
)
)
)
Or maybe defining them separately cleans it up a bit
container = ui.Container(...)
container.add_text("...")
gallery = ui.MediaGallery()
gallery.add_item("url")
container.add_item(gallery)
view = ui.View(container)
looks good to me
What is the best way to restart a bot using a command?
Tank you!
the question is why do you want to restart the bot ?
.tag restart-cmd
The only good way to restart your bot is to shut it down and have your process manager handle it. You can shutdown your bot by running Bot.close().
Do use
- Run your bot in a process manager such as:
- Systemd
- Openrc (Gentoo, Devuan)
- Runit (Void Linux)
- Supervisord
- Upstart (Old Ubuntu)
- Docker
- Manually reboot it
Do not use
- A bash loop (it can eat your C-c by rapidly spawning python and if your bot fails it won't stop it from constantly failing)
subprocess.call(you will eat your memory up by not letting your old processes die)os.exec
Tag Credit: discord.py server
Yes, but I use Windows...
No but why
To sync the command ?
because you might not even need to restart te bot to do what you want
I am creating a text-to-speech bot and would like to restart all related programs.
coulnt you do manual restart ?
It's a little difficult to connect to the server running the bot, so I'd like to restart it remotely using a command if possible...
what are you using to run the bot ?
Python v3.12.10-final
py-cord v2.6.1-final
aiohttp v3.12.15
system info: Windows 11 10.0.26100
oh huh I didn't think about chaining it, forgot that works
might become quite spaghetti for a big view tho
why do you need to restart it though? chances are you can do what you want to do without a restart
Run it in docker and just exit(1)
It will detect that it "crashed" and restart it
Systemd works too
OK,I'll try!
Thank you!
Would it cause isses if I called bot.add_view on the same view twice?
.tag tas
as far as I can tell from looking at the library code, the second call should override the first
I have absolutely no fuckery of an idea
the custom ids and the message id are the same so it looks fine?
I basically want to add a command that reloads all persistent views from the database
I still have yet to find out what custom IDs are even for
nope
doing that since a long time and never had any issue with it
That and the component_type is all Discord sends about the component with the interaction create event when someone uses your interactable components
- https://discord.com/developers/docs/components/reference#button-button-interaction
- about custom id: https://discord.com/developers/docs/components/reference#anatomy-of-a-component-custom-id
The lib then needs to find the corresponding item and view with the same id and dispatch it accordingly
so i guess the library tracks which view object was sent with what message, and so that works even if you dont add the view to the bot & set custom IDs?
Yeah the lib stores all views until the timeout
My bot automatically colors embeds (and now CV2 components) via a user's accent color.
Now, i noticed that someone who has an entirely purple profile has this color as accent_color
why is that? doesnt the custom-set theme color override that? second screenshot is their profile
if im not mistaken, accent_color also requires fetching
I want to use message_command on servers where there is no bot. Is this possible, or am I misunderstanding something?
Here's the slash users example.
breh how do you all remember all the examples and tags
eh i just used it the other day
install the bot to your user with integration_type=1 in your oauth url, and refer to the example above to set a command as user installable
ah, accent_color is their banner colour
not profile colors
Yea, but their banner is nowhere near that color either qwq
it may be whatever they have set under their image banner
if you don't have an image banner set
oh right
oof, so discord doesnt use the banner or profile color when you have a custom banner... and to change that color you need to delete your banner.. god that is dumb
yeah it's a tad convoluted
i wish we could just access the profile theme colors
this also returns None if they're using the automatic banner colour based on their PFP
accent_color? oh ffs
yep
if they're a member, you could try fallback to Member.color to get their guild role rolour
or run some img library to pick a colour from their pfp yourself
yea ill have to see if it works for most people or if i need to change it
thx
allgood
can I get help?
discord.ext.commands and discord.commands are very confusing.
When creating a Cog file:
from discord.ext import commands
class Name(commands.Cog):
On the other hand, when creating a slash command in same file:
from discord.commands import slash_command
@slash_command(...)
async def ...
I want to understand the difference between the two.
After reading the docs, it seems that Cogs only exist in discord.ext.commands.
However, slash commands are available in both.
No, cogs work for anything
ext.commands is a legacy part of the library that existed BEFORE discord added slash commands
Slash commands are fully compatible with functions in ext.commands, but it is not required
Here's the slash cog example.
That example, and several of the others in that folder, should demonstrate different usages of slash commands
thanks. so, according to what you said, does that mean I don’t need to use discord.ext?
If you do not want to make prefix commands (e.g. !help) then yes, it is not required
oh yes, I want to use only slash_command. then can I use class Name(discord.Cog): to class, and from discord.commands import slash_command?
Yep (you can also just shorten it to from discord import slash_command)
oh wow, Thanks very much, clear now.

Can I ask one more question?
There is commands.NoPrivateMessage() in my code , but I found in the docs, it seems to exist only in discord.ext. What should I do in this case?
It looks like commands.CommandInvokeError can be replaced with discord.ApplicationCommandInvokeError
you can still use that with slash commands
from discord.ext.commands import NoPrivateMessage etc
...though, that's not a very good answer from me
what you really want is contexts
this will let you restrict it to a certain context, e.g. discord.InteractionContextType.guild
I think there’s really no need to insist on avoiding discord.ext.
That was my mistake. It was helpful, thank you
no worries
I'm trying to convert an automatic slash command generator to using groups
At the end, I have self.bot.add_application_command, do i still need that when i already add it to an existing group?
How do you add it to the group ?
well
well
it is actually erroring tho so 1s
yea i cant do that
do i just need to add the groups as commands, once they're done?
you could do group.add_command(command_function) instead of the self.bot.add_application command
if ur current solution is not working
on my side, im doing that:
nope, doesnt show up
okay hold the phone, i got a 400 error
something is getting to discord
dont do both group command and group.add_command
group command will try to add it too i think
which then
if the 1st one is not working with group.command maybe only the group.add_command
oh fuck yea it works
thx
also something i learnt: if a group has no subcommands, it acts as standalone command
like
command_function.cog = self
command_function.parent = group
group.add_command(command_function)
just for you know its 25 options for each group
component v2 ?
yea its like 15 each
well
its just 3 command groups (i forgot one) that uses the api there to apply all kinds of filters
and well, you only need the url for that
no but ur code is normal
its just that im not used to just sending a view instead of building embed or smth like that
i wonder how it will looks like with view less component
well im constructing the cv2 components inside of the view
yeah ik
tbh i find component v2 a bit wierd
like all you need to do so simple things
embed are so much easier so having to switch make me feel soooo lazy
final result
maybe a suggestion but putting it in grey might look better
since he is in jail

dont make me chain the URLs, its gonna be like 300 chars lol
What extension are u using?
I thought its vscode ;-;
nah toothy hates vsc
maybe you could find an extension that does something like that? but i wouldn't know
Nah I don't mind it
I do all my pycord PRs on github.dev which is a browser version of VSC (vscode.dev) with proper github integration
Too lazy to open a desktop IDE
Vsc also has it
yep got it
option
search of inlayHints in settings, there are many options to tweak for every supported language
Fun. Thanks lol
I am keeping it disabled lol, its making my large codebase look horrible
default ass pycharm that is
it only shows sometimes tho (else it'd be clutter) but I haven't found the rule yet
inlay hints
The one downside is it makes your lines longer than the max line limits, without actually doing so.
@frail kayak What distro are you on ?
windows, not linux
i installed but still
- Did you restart your terminal
If yes and still doesn't work: - Did you restart your computer
also
.tag venv
Sometimes you want to keep libraries from polluting system installs or use a different version of libraries than the ones installed on the system. You might also not have permissions to install libraries system-wide. For this purpose, the standard library (as of Python 3.3) comes with a concept called "Virtual Environment"s to help maintain these separate versions.
The main benefit is to avoid package conflicts and unnecessary packages
Read more in the guide
yeah i hate venv
you should use it, still
venvs are very useful
turned off some programs, restarted terminal and it worked, thanks
i'd go as far as saying they are necessary
not if you only have one project
yes if you only have one project
I do not disagree its useful and necessary just sometimes have troubles with this "concept"
if you use a proper IDE you don't even have to think about it
try taking a look at uv, you might enjoy it
i use one linux daemon (cant use other) that might create its own venv, and might launch .py file with already existing one
and it does it when it wants
if only you've seen my face trying to install packages properly that day I setup it
anyway thanks for help, gotta go enjoy cv2
have fun haha
what
what does that mean/what do i have to change?
discord.errors.ExtensionFailed: Extension 'cogs.sendsomething' raised an error: ValidationError: Command names and options must follow the regex "^[-_\w\d\u0901-\u097D\u0E00-\u0E7F]{1,32}$". For more information, see https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-naming. Received "Send Embed"
Needs to be lowercase I think and no spaces
ok but why
i mean the reason why i used the extra name thing was to make it big and with space
Because discord doesn't allow it to have spaces
and no way to bypass that with unicode or smthing like that?
I didn't think so. You should probably take a look at https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-naming
not without subcommands
and whats the difference of bot.create_group and discord.SlashCommandGroup?
One adds it to the bot the other no
oh ok thx
Hello, i know this question is not directly linked with pycord but did someone had issue with aiohttp blocking the event loop when it raises an aiohttp.ConnectionTimeoutError?
This issue is occurring in production enviroment, initially it happened every 24 hours more or less, to try to solve it i added a custom session:
import aiohttp
_session: aiohttp.ClientSession | None = None
def get_session() -> aiohttp.ClientSession:
global _session
if _session and not _session.closed:
return _session
timeout = aiohttp.ClientTimeout(total=30, connect=10, sock_connect=10, sock_read=20)
connector = aiohttp.TCPConnector(limit=100, ttl_dns_cache=300)
_session = aiohttp.ClientSession(timeout=timeout, connector=connector)
return _session
async def close_session():
global _session
if _session and not _session.closed:
await _session.close()
_session = None
This change seems to work just fine but today the issue appeared again after 5 bot working days
Here you can find the logs: https://pastebin.com/d4E52uEL
After this error occurs it seems like my main loop gots blocked, i can't invoke commands and no errors are shown when i do, the bot responds with interaction error like if the bot is offline, even if so i still got logs from background activities like scheduled cogs and tasks
(More or less the bot sends 80+ request per hour)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Hello !!
Is it possible to connect to a new shard without restarting the bot ?
I saw the AutoShardedClient.get_shard() and the discord.ShardInfo.connect() but if the new shard does not exists when the bot started, the get_shard will just return None. Am I wrong ?
I get a new shard every week / 2 weeks and currently restart the bot after I get a new shard. I would like to avoid the downtime by adding a new shard without restarting the bot
I doubt its possible since you provide the shards amount when connecting to the gateway
Yea I also would think its not possible. But this made me think: How do huge bots like dyno do it? Their growth is quite steep, and they cant be restarting every 1000 guilds (or whatever the shard max is)
So there surely must be a way
Dyno deploys multiple pods
That handle a set of shards
pods
Idk that's what they call them
maybe smth special for them, large bot's have some extras, don't they?
probably just an dyno thing. It’s like youtube calls it subscribers while other platforms calls it something else
¯\(ツ)/¯
The next step after shards is usually "clusters" of shards
once you join 150k servers, Discord give you a number of shards and it does not change
Kubernetes
Yeah i think they're just that lol
But they call them pods
Or i think pods deploy and manage the clusters
Some Kubernetes shit
gesundheit
Do users who use commands in discord.InteractionContextType.private_channel need permissions to view emojis?
Yes, it works correctly on the server, but in private conversations it only works on the button. It's very strange.
thats cv2 right?
there is currently a known bug where bots can use any emoji sent with cv2 buttons
so what you have with the emojis in the text might be a side effect of that
can you try send those exact emojis with a regular text-only response?
and see if it still happens
My emojis are currently uploaded to the server, but my idea is to upload them to the app in the future, where you can have up to 2k emojis. But since it's a bot and not a team, the trial version or stable version remains the same.
I can try it, I guess you mean outside of embed
-Remindme 3d wtf
Set a reminder in 3 days from now (<t:1756135129:f>)
View reminders with the reminders command
you and your reminders
:)
am I safe to do this to generate mock users?
user = discord.User._copy(bot.user)
user.name = "MockUser"
user.global_name = "AmoxMockUser"
