#Basic Pycord Help
1 messages · Page 74 of 1
hm
@ivory beacon what is ur message for the rate limit ?
is it a global rate limit or a rate limit under the bucket ...
under a bucket ig
cz everything is working fine, without the fetch invite thing
do you have the message ? to see under which one
cant you just occasionally refetch the data, and trust all invites in there to be active, at least at the time of getting new data from the API
so, user can filter expired invite links
gonna rate limit myself to find the limit
idk how
when you get rate limit usually pycord let you know it with a warning
ig it's under a bucket
or does dank memer not clean out invalid invites
so you dont have the message ?
do you have logging enabled ?
they don't
sadly, no
also a 0.5 limit between each request might just be a global one
because you can only do 50 request in 10s
i'll check
got unbanned
.tag 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...
in case this can help
sure, I will explore it
its just enable pycord logging so it tells you when ur rat elimit etc
oke, let me explore
@fresh sierra which logging level should i use btw ?
warning is the one needed if you want to see the rate limit
just did a 1000 requests to the endpoint without no rate limit thats strange
💀
seems that maybe if i use the same url it get cached or smth like that
@bot.event
async def on_ready():
for i in range(10000):
await bot.fetch_invite("pycord")
because no rate limit wiht that
ahh ? sure ?
let me use my spamming tool on replit
well im testing again with random url now
def random_invite_code(length=6):
return "".join(random.choices(string.ascii_letters + string.digits, k=length))
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
for i in range(10000):
try:
await bot.fetch_invite(random_invite_code())
except discord.NotFound:
pass
print(f"[{i+1}] ✅ Success")
but still not rate limit
well
now im banned
pff
so yeah its a global one
<title>Access denied | discord.com used Cloudflare to restrict access</title>
you should just make sure that you dont do more than 50requests per second
always the case when global
they said they had like a 1.5s delay between each
he said 0.5
but the thing is 0.5 between each for this might be ok, but since he got other thing on that ip that also do requests it leads to issue
so make sure ur ip doesnt do more than 50 requests per second else cloudfare ban
btw the bot running on a Pterodactyl panel
what you could do then is just use more ip
" Because of this, I won’t be able to process all invite links at once. Instead, invite link data will be updated gradually during each discovery refresh "
i made this announcement 🙂
and I'm chilling
IP addresses that make too many invalid HTTP requests are automatically and temporarily restricted from accessing the Discord API. Currently, this limit is 10,000 per 10 minutes. An invalid request is one that results in 401, 403, or 429 statuses.
no one's hitting 50 per second unless their bot is exceedingly active, i wouldn't worry
well he got rate limit under fetch_invite, so strange
how many bot do you have under the same ip d1p
i am using bot hosting
so idk about that
is it paid at least
so you are using a shared thing ?
its not only for u ?
no
well that can be the issue
if 1 person get rate limit then everyone will be
but the thing is i got rate limited only for invites endpoint
Except if you have ur own ip
i am going to load test ngl
yes, ik about that
im pretty sure its global
cos i just did the test
and i didnt get any rate limit from discord
maybe you can just buy an ip, this should solve the issue of rate limit
it's irrelevant if the rest of their bot wasn't affected
it was from what i understood
that's not a major issue
was ur bot completly blocked ?
no
thats mb then, i misunderstood
0.5 delay
as long as you've set up logging you'll get proper warnings on the ratelimit
I'd, let's see 🥳
maybe
how does ur script works ?
is it also new invite code ?
checkout my github profile (not promoting)
let me try
and which one ?
Blaze Hammer
because i think it will not make again the request for the same invite code
there's a decent chance the ratelimit is different authenticated vs unauthenticated
or did you pass the token and such in
I'd request with unauth
try your test with the Authorization header set to f"Bot {token}"
is that possible to POST request ?
oke
and also generate new invite code each time, when its with the same it does not change
sadly my script can't do with url :(
you can't post to that endpoint, creating invite is under channels
no idea, i tried from the bot because that's what is important in that case
got no rate limit using 1 sec delay and bot token
same as for 0.5
yeah i think there is just no bucket and its global
i think we should move on, that's a major issue 🥳
so using the same invite i dont get rate limit
but i got rate limit 🥳
i was spamming the endpoint 🤣
and when using different one i get rate limit at
[250] ✅ Success | Elapsed: 77.15s
so yeah after 250 requests in 77.15s the bot is not happy
Are there plans for a View.from_dict() function for components V2? (Or something similar to Embed.from_dict())
I want to load components dynamically from a JSON file
mayb
added
Good afternoon, I'm making the version jump from 2.4.1 to 2.6.1. I've mainly seen changes in the groupSlash, but do you recommend that I check out something special?

only thing I know of is bridge changes
if you don't use bridge just update and see if everything works still
how can you specify the name and description of a command in a slashcommandgroup?
foo = discord.SlashCommandGroup("bar", "baz") # works
@foo.command(...)
``` like this i mean
oops yeah i forgot to put guild ids
so it worked but it didnt update instantly
my bad
thx
on another note, if i have guild_ids now specified in the 'foo', do i need to specify it in the command decorator too, or does it inherit?
inherits
alright awesome thats all thanks
Note: that subcommands cannot have different guild_ids, defualt_member_permissions, etc. Discord limitation
Hello, I'm making my own discord.Bot class and I want my discord server to be an attribute of it how can I do it at init ? should I play with the discord.Client object ?
class MyBot(commands.Bot):
def __init__(self, *args, **kwargs):
log.debug("MyBot is starting up...")
super().__init__(*args, **kwargs)
self.main_guild: Guild = #??????????????
self.database = Database(str(settings.postgres_url))
log.info("Successfully connected to the database")
log.info("Loading cogs...")
self._load_cogs() # function to load my cogs
Why?
and why discord.Client if you already use discord.Bot?
That's an example of a cog using what I'm trying to achieve but on init I need my bot to have main_guild setup:
class Special(commands.Cog):
def __init__(self, bot: MyBot):
self.bot = bot
self.role_special: Role = bot.main_guild.get_role(settings.special_role.id)
@commands.Cog.listener()
async def on_member_update(self, before: Member, after: Member):
if self.role_special not in before.roles and self.role_special in after.roles:
log.info(f"{after.display_name} was given the special role")
await self._add(after.guild, after)
elif self.role_special in before.roles and self.role_special not in after.roles:
log.info(f"{after.display_name} was removed from the special role")
await self._remove(after.guild, after)
def setup(bot):
bot.add_cog(Special(bot))
Uhm, first what is "MyBot"?
This is #1132206148309749830 message
So you imported your bot from a another file?
I'll add details so you understand better
is it better now ?
It's a cog for my bot (at least an exmaple to not paste all the code ^^")
my recommendation is using property py @property def guild(self): return self.get_guild(my_guild_id)
OOOOOOOOOOOOOH haven't thought about that ! I'll try it thank you
allgood
sadly it doesn't work
it seems that when the cog is loaded the get_guild returns none 😦
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.
"When you restart your bot the cache will be empty"
just fetch it on startup and save it
HOOO ok thank you ! will try it !
or add the line to fetch it here if get is none
Thank you all
properties solved it cause I didn't go through inits to call those properties
and I didn't even have to use fetch so it's even better
Yeah, the init of the bot is run before the code connects to discord.
I already used all commands with slash, the only_server() I have seen that it changed. But usually fine. You scared me when with changes haha

I just said bridge lol
Is there a way to get the guild_id to the autocomplete function of a slash_command?
oh i didnt see the interaction attribute on ctx. thanks
somehow it doesnt get triggered 🤔
class Tags(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def autocomplete_tag_id(self, ctx: AutocompleteContext):
tags: list[Tag] = await self.bot.db.get_all_tags(ctx.interaction.guild.id)
return [tag.id for tag in tags]
@slash_command(name="tag", guild_ids=[937023432929988638])
async def tag(self, ctx: ApplicationContext, tag_id: Option(str, autocompete=basic_autocomplete(autocomplete_tag_id), description="The ID of the tag to show.")):
....
autocompete
you're missing an l
also this isnt necessary or anything but i just personally suggest you use the decorator to define options instead of the typehint, especially if you have many commands / many options
its a lot cleaner
oh yeah right looks better.
now i get an error about the self argument:
Traceback (most recent call last):
File "/home/mcbabo/tagger/.venv/lib/python3.12/site-packages/discord/bot.py", line 891, in callback
return await command.invoke_autocomplete_callback(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mcbabo/tagger/.venv/lib/python3.12/site-packages/discord/commands/core.py", line 1105, in invoke_autocomplete_callback
result = await result
^^^^^^^^^^^^
File "/home/mcbabo/tagger/.venv/lib/python3.12/site-packages/discord/utils.py", line 1373, in autocomplete_callback
_values = _values(ctx)
^^^^^^^^^^^^
TypeError: Tags.autocomplete_tag_id() missing 1 required positional argument: 'ctx'
It would need to be a staticmethod
yea but they need / want the bot var
ctx.bot exists tho so you should be fine
oh yeah u right, thanks!
.
In my log it says gateway-prd-us-east1-b-fcm4. Does that mean it connects to an us server? Are there no eu servers?
20.05.25 - 17:39:53 [INFO] [gateway.py] Shard ID 0 has connected to Gateway: ["gateway-prd-us-east1-b-fcm4", ....
where is your VPS running
should be frankfurt/de
The discord API servers are in the US east region
I think voice servers are distributed across the globe, but not API
thats some crazy shit
east1 yeah
Hey, stupid sanity-check.
I have a slash command that normally I just invoke, .defer(), do some work in another class, and then ctx.respond()
If I want to provide some sort of progress message (e.g. "Step 1 complete", etc etc), will I have to change this setup in some way? Like my progress messages would 'respond' but then I'd have to then edit the message afterwards or something, yeah?
And if so, how can I tell if I need to edit vs straight respond - I thought there was an 'is_responded' flag, but can't find it on ApplicationContext
respond handles send vs edit for you.
followups as well!
So I could just ctx.respond() my progress, and then my ending ctx.respond() will simply handle it all?
wait i might be wrong
you are right wolfy
defer -> respond -> respond would result in 2 messages tho
For the second part of your question it is avalivle in the InteractionResponse object https://docs.pycord.dev/en/master/api/models.html#discord.InteractionResponse.is_done
Oh, yuck. What about for a single message. (Discord dropped the ball here; sharing what the progress is seems kind of basic, vs simply "bot is thinking")
You want
defer -> respond -> edit_original_response
Why do I always get None when I try to access bot emojis with emoji = bot.get_emoji(emoji_id) ?
application emojis aren't supported yet
you can still just use them via the markdown tho
Does that mean I have to implement Markdown in the code?
copy the markdown from the dev portal and paste it into your bot response
Okay thanks
Can I also set them as button emoji?
no idea
Yeah probably w/ PartialEmoji
Okay thanks
If I simply send the markdown on the server into the chat, the emoji is displayed briefly and then immediately afterwards only :invite:
I do.
It works here on the server. Not on my test server 😄
:invite:
Oh, but not
show your code
:invite:
that is not the markdown the dev portal gives you
But I am in the Dev Portal and click on “Copy Markdown”
show the actual code
It does not work with any Markdown from the Dev Portal, not even with other emojis from bots
you cant use other bots' emojis..
It's my own bot
async def send_test_embed(channel):
embed = discord.Embed(
title="Test Embed",
description="This is a test embed with a markdown emoji from the Dev Portal :invite:",
color=0x3498db
)
await channel.send(embed=embed)```
The Markdown is always reformatted directly
you need the full emoji
dude
i said to use the markdown you copy from the dev portal
not that shorthand form
This is what I send and then it is reformatted directly to when I send it.
Yes, but it is reformatted directly
that is normal because the client does that
are you 100% sure you uploaded it to the right application
Yes
I have an idea.
I'll test it tomorrow.
Thank you
does somebody uses docker to host the bot? i like the container principle but then i cant reload cogs :/
Why?
what why
oh wait, container you mean the new discord stuff or what was again?
no a docker container. the bot as a docker image
that is not what they're asking lol
Kinda defeats the purpose of docker as a whole but you could make a "dev image" which straight up attaches your src folder as a volume
Would also have the benefit of not having to build it again and again
Right
pycord can handle slash commands right? but why arent my commands poping up on discord when i run it?
https://docs.docker.com/compose/how-tos/file-watch/
This, or mounting the src folder in the container
.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.
Is this a known issue?
Discord doesnt display the possible values like for discord.TextChannel
I am sure that the command is up to date and I am running this exact code.
I am not running multiple instances of the bot.
It’s not an issue
Threads are just considered «subchannel » and so cannot be just shown like this
To see all of the thing you can use you should check this
discord.SlashCommandOptionType
discord.SlashCommandOptionType.attachment
discord.SlashCommandOptionType.boolean
discord.SlashCommandOptionType.channel
discord.SlashCommandOptionType.integer
discord.SlashCommandOptionType.mentionable
discord.SlashCommandOptionType.number
discord.SlashCommandOptionType.role
discord.SlashCommandOptionType.string
discord.SlashCommandOptionType.sub_command
discord.SlashCommandOptionType.sub_command_group
discord.SlashCommandOptionType.user
discord.SlashCommandGroup.integration_types
That’s a channel type, not a slashcommandoptiontype
Then that’s mb
For as far as I know thread cannot be used as option
Let me check
channel_types: list[:class:discord.ChannelType] | None
A list of channel types that can be selected in this option.
Only applies to Options with an :attr:input_type of :class:discord.SlashCommandOptionType.channel.
If this argument is used, :attr:input_type will be ignored.
^^^^^
from the docstring
public thread seems to work for me so its a bit strange
maybe i do confuse the public thread and the private one tho
Could you please try that exact line of code? (@discord.option(...))
well neither work
for me
Yeah no clue then
are you sure you dont have another process active ?
and are you on master or 2.6?.1 ?
master
.
do you restart ur client between the change ?
Ping me later if this is confirmed to be an issue with the lib, I'll take a look
"I am sure that the command is up to date"
yeah no idea, we have the same code
i dont think it is, its working great on my side
might be the lib, also happens for someone else on a different device / client
same command
Could you try with a non modified library version?
just did
and working great
import discord
bot = discord.Bot(command_prefix="!", intents=discord.Intents.all())
@bot.command()
@discord.option("test", channel_types=[discord.ChannelType.public_thread])
async def test(ctx: discord.ApplicationContext, test: discord.Thread): ...
working great too
Hmm
I'll try it too
You can't set command_prefix on discord.Bot
works for me
ik, i just edit the thing quickly to test his thing
@manager.command(name="regenerate-commission-type-post", description="Remakes the post for a commission type.")
@discord.option(name="thread", description="The post to regenerate.", channel_types=[discord.ChannelType.public_thread], required=True) async def regenerate_ticket_category_post(self, ctx: CustomApplicationContext, thread: discord.Thread):
This MRC reproduces my issue
import discord
import os
__import__("dotenv").load_dotenv()
bot = discord.Bot(intents=discord.Intents.all())
@bot.slash_command(name="test", description="Test command")
@discord.option(name="option", description="Test option", channel_types=[discord.ChannelType.public_thread])
async def test(ctx: discord.ApplicationContext, option: discord.Thread):
await ctx.respond(f"Test command with thread: {option.name}")
@bot.listen("on_ready")
async def on_ready():
print(f"Logged in as {bot.user.name} - {bot.user.id}")
print("Bot is ready.")
bot.run(os.getenv("TOKEN"))
doesnt even need the group
let me try this
Oh f
wait i was in the wrong guild
same issue on master
forum channels only have public threads
and the forum channel is public too, just to make sure
can youinvite me
in the guild where the bot is ?
to test if it can be a client issue
oh what the fuck
it works for normal threads
but not for post threads
probably a discord issue then?
maybe
Could you please test and confirm?
.tag ddevs
The only response I'll get there is "use d.js"
Or kids spamming . in the thread
Well do they have the issue or not w/ djs
To test i need you to invite me
So I can try using the same thing as you
With your bot I mean
With my bot it’s working
I only tried this one
dm-d then
@frail basin The issue is it can't show forum posts ? If that is the issue I can't reproduce.
Note that it only shows posts that are open for you
My test code:
import logging
import os
from dotenv import load_dotenv
import discord
load_dotenv()
logging.basicConfig(level=logging.DEBUG)
TOKEN = os.getenv("TOKEN_3")
bot = discord.Bot(intents=discord.Intents.all())
class MyCog(discord.Cog):
manager = discord.SlashCommandGroup("manager", "Commands for managing the bot.")
@manager.command(name="regenerate-commission-type-post", description="Remakes the post for a commission type.")
@discord.option(name="thread", description="The post to regenerate.", channel_types=[discord.ChannelType.public_thread], required=True)
async def regenerate_ticket_category_post(self, ctx: discord.ApplicationContext, thread: discord.Thread):
await ctx.respond(f"{thread.mention}")
bot.add_cog(MyCog(bot))
bot.run(TOKEN)
we tried with luma
seems to be a client issue
What's your client ? Maybe try with canary
trying to narrow down to specific versions right now
up to date firefox, browser client
Toothy is gonna be happy
what
Whatever
thanks ill look into it
reloading cogs for code changes literally defeats the entire purpose of docker
It's fine if it's only while developing
Why is that an issue to reload cog when using docker ?
because the entire purpose of docker is to ship an immutable and static environment that you can 10000% rely on once you tested it, because nothing changes
if you just change stuff in the same container regularly just dont use docker
How would you do then if there is a code change ? Restart the whole container ?
Im not familiar with docker even tho i think ptero uses it
build a new image and put it in the container
or whatever the exact terminology is
it's like versioning
you dont change the files of an existing version, EVER
So like docker is not really somewhere where you put ur code
Is more like a image I see
luma please just look up docker
Don’t really need to, this explanation is enough for me
im 98% sure you misunderstood
And I do like the human contact when it comes to learning things
Docker should be static like an image
Since I’m not using it that’s ok, if one day I need to use it ofc I’ll documente myself more
I do know what it’s an image dw, but thanks still
the point is just, if you want / need to change stuff in a docker container, you dont need docker
Docker is very overused (and overhyped, and overvalued)
the world runs on it for a large part tho
That's a stretch. Is it often used? Yes... but "the world runs on it" is a bit exaggerated.
?tag install
1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y
2a. Install py-cord
python -m pip install py-cord
2b. Update py-cord
python pip install -U py-cord
Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.
Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
Is it possible to integrate a custom listener in the bot and trigger it at a certain event?
of course
How can I do this?
@discord.Cog.listener()
async def eventname(...):
And how can I trigger the event so that the bot listens to it?
oh you mean a non discord event?
Yes
do you have two seperate things running on your server or
where does the second event come from
e.g. when I receive a webhook on an integrated web server. Can I then trigger an event "receive webhook" and the bot listens to it?
so its two different processes on your vps?
No, I have a very simple aiohttp web server integrated in a cog. So theoretically I have the possibility to access the bot.
Ah okay, I got the idea myself.
I can access the bot directly then I don't need a custom event 😄
so then just call the function lol
nvm
Using dispatch
bot.dispatch(ur_event), and then just do async def on_ur_event()
why would you ever do that instead of just calling the function tho
it doesn't wait
its threaded?
hm
The same reason the lib uses the event system lol
Hey all - For some reason my slash command is not appearing, I've waited for around an hour but still not appearing. I cant see anything wrong with it any advice would be great -
@bot.slash_command(description="Show recent entries in the command log (admin only).")
async def logo_tool_show_log(ctx: discord.ApplicationContext, lines: int = 10):
if get_user_privilege(str(ctx.author.id)) != "admin":
await ctx.send("🚫 Only admins can use this command.")
return
try:
with open("command_log.txt", "r") as log_file:
entries = log_file.readlines()[-lines:]
await ctx.send(f"📄 Recent Log Entries:")
except FileNotFoundError:
await ctx.send("⚠️ Log file not found.")
.tag commandnoshow
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.
also slash commandsare using ctx.respond and not ctx.send
Thanks - I'll take a look now
you should use @discord.default_permissions to check for the invoking user's permissions instead of the way you do
especially because it hides the command from everyone else
and if you log every command invokation you should definitely use an async file handler and also put it into a util function so you don't duplicate it everywhere
FYI the 1 hour thing is outdate information. Both global and guild commands register almost instantly. You just need to refresh your discord client cache with ctrl+r
Thanks for the update, turns out I didn't define my bot properly and all good now thanks all
you should use aiofile instead of file since file is blocking
or use the logging module
thanks for repeating what I said
im sorry but could you show me in which message you talk about aiofile ?
.
just couldn't remember the name
sigh
so thanks you for the unnecessary yapping ;)
I think something is wrong with the view timeout
I set it to 10 minutes, but when someone respond to the view, the timeout extends
so I have a view and about 30 different people clicked on the view, have been 20 minutes since and it still did not timeout
thats expected and by design
wdym
huh
it's just how its supposed to work
it's been more than 10 minutes since the last player who clicked the button
so how long are we talking if 30 people clicked the button?
yeah i know but it's been more than 10 minutes
and if you click the button?
Is the only way to have a callback on a button to subclass it?
Like you can't self.add_item(discord.ui.Button(...)) in the view and have a callback function?
I mean you could assign the function manually
Button.callback = my_function
I used to do that in an old project where the callback behaved almost the same in every button so they shared the same func
That makes sense. Thank you.
just note that when you aren't using the decorator, the only argument callback takes is interaction
Hm. Why is my View not getting the message (where many of my other VIews reference self.message just fine)?
Ah, okay. It must populate it afterwards. I can't reference it in the constructor (to to my Button)
(This must also explain why I've had inconsistent referencing of self.view; just depends on where)
How do I actually invite my bot to a server?
You generate an oauth url on the dev portal
It requires a redirect link, but it seems I have to have my own redirect because my bot isn't public?
Do I have to host my own website to have a private bot?
what are the oauth scopes?
You've overcomplicated it, disable the url options on dev portal
Oh weird. I didn't realize the URl disappears if you want any scopes other than bot & application commands
which git repo should i pull to get the container components working?
.tag cv2
Components V2 are under development in pycord and aren't yet included in the official releases on PyPI or the master GitHub branch. However, you can access the features now by installing directly from the pull request #2707. To do this, use the following command: pip install git+https://github.com/Pycord-Development/pycord.git@refs/pull/2707/head Please be aware that this is a development version and may contain bugs, feel free to report them by adding a comment to the pull request.
oh okay so not git+https://github.com/NeloBlivion/pycord@components-v2?
I think that should also work ? They're equivalent afaik
hi friends, why do i get an ModuleNotFoundError: No module named 'audioop' error when trying to import discord? maybe lacking dependencies?
.tag audioop
Pycord 2.6.1 may work with Python 3.13, but it is not officially supported and can cause various issues. Until Pycord 2.7 includes official support for Python 3.13, it is recommended to use a previous version.
For voice features in Pycord versions before 2.7, you might need to run pip install audioop-lts. Some users have reported issues with voice features when using Python 3.13, so ensure that you clear the __pycache__ and .pyc files before running your bot.
sure, what version do you use?
either pip install audioop-lts or use python 3.9-3.12
makes sense, one last thing: can you guide me to somewhere i can learn about taking input in slash commands?
Here's the slash basic example.
@stable coyote take a look at the examples
@errant trout what do you say? (sry for ping)
You can use that one if you want it shouldn't change anything, it references the same code since the pr is from that branch
Yeah it works
is ctx.member not a thing anymore?
Don't think it was ever a thing, it's ctx.author
Or do you mean the bot member? That's ctx.me
oh god, i've really forgotten everything. thanks bud
Allgood
Apparently the issue was that I am not "subscribed" to the forum post
That’s strange
Note that it only shows posts that are open for you
:)
nw at least now you found out why
Any workarounds other than @everyone?
Autocomplete
wdym to make everyone be in the post or to make it show up for everyone ?
2nd
yeah autocomplete
Here's the slash autocomplete example.
the people can always put in the thread ID 
UX nightmare
Wdym by enforce that ?
like they do with choices
you can enter any value, not just the ones I return with the autocomplete
Yerah unfortunately there isn't really any other solution :/
Is this documented anywhere btw?
Ooo I see
That’s annoying I agree with you
You can still take whatever input the user gives and double-check it in your code, and return errors or warnings indicating that a bad value was presented. I think the real issue isn't in the autocomplete itself, but in the way that the Discord App displays those textbox inputs. It's strictly one kind of input box, say a standard Textbox as opposed to a Combobox with limited dropdown options.
how was it that we do the response only visible to the author again?
ephemeral=True
yay!
Hi, have pycord added components v2?
.tag cv2
Components V2 are under development in pycord and aren't yet included in the official releases on PyPI or the master GitHub branch. However, you can access the features now by installing directly from the pull request #2707. To do this, use the following command: pip install git+https://github.com/Pycord-Development/pycord.git@refs/pull/2707/head Please be aware that this is a development version and may contain bugs, feel free to report them by adding a comment to the pull request.
is it possible to set different Rich Presence(s) texts for different Discord servers? For example, having one text on 50 servers and another on the other 50?"
Nope
you can set it by shard
so i've done some analysis about the high ram usage by sorting out gc.collect(), and this is the result i get, is this normal?
there are about 326k objects during the time i start my bot, and rises to 500k+ in 24 hours
How many guilds is the bot in
How much ram is actually being used?
3gb
overtime i mean
1gb when it's low
i just threw a bunch of data into chatgpt and they said it's a clear memory leak but they did not provide a solution
I'm not sure it's a clear memory leak
i didn't know my bot was this complicated?
yea dict objects increased by 15.7k in garbage collector in mere 10 minutes
i think there are like 100+ active users rn
it's an economy bot though i understand the frequency of commands used causes more ram usage but that's just too much
That's weird... It's possible that something is wrong in pycord internals but tbh I wouldn't know where to start looking. Would you mind sharing what some of those dict objects look like ?
one sec i really need to find a way to look through 360k objects
Just print 10 random ones
Should be enough to see if there's a pattern
alr im restarting my bot now, one moment
im assuming it's the user data from my database tho
because that's the only place i can think of that contains a large amount of dict and lists
but aren't variables getting deleted after the function finishes running?
uh most of them are just discord's stuff
one sec, i'll print the variable that gets accumulated over time instead of random picked variables
got this in one file:
random_commands_group = discord.SlashCommandGroup("random")
and this inside cog in different file:
@random_commands_group.command(
name="advancements",
description="Returns random advancement that matches the parameters"
)
async def random_command(self, ctx: discord.ApplicationContext, title: str)
...
but I don't see the command, found this issue https://github.com/pycord-development/pycord/issues/2429, but got this error
Ignoring exception in on_connect
Traceback (most recent call last):
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\client.py", line 412, in _run_event
await coro(*args, **kwargs)
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\bot.py", line 1214, in on_connect
await self.sync_commands()
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\bot.py", line 742, in sync_commands
registered_commands = await self.register_commands(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\bot.py", line 595, in register_commands
data = [cmd["command"].to_dict() for cmd in filtered_deleted]
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\commands\core.py", line 1341, in to_dict
"options": [c.to_dict() for c in self.subcommands],
^^^^^^^^^^^
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\commands\core.py", line 943, in to_dict
"options": [o.to_dict() for o in self.options],
^^^^^^^^^^^
File "C:\Users\skyreed\PycharmProjects\BACAP_Bot\.venv\Lib\site-packages\discord\commands\options.py", line 358, in to_dict
"type": self.input_type.value,
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'value'
just don't know how to fix it
you cant do that by default, spreading a commandgroup across different files
there is an extension for that but I'd honestly just recommend doing it in one file
use pycord multicog then
I have a question, would putting the “context” and the decorator “@guild_only” be repetitive?
yes
I understand that it is a discord problem, because without the tag “guild_only” I can see the command in private bot_dm
You may have misspelled 'oops, thank you'
thxx
I do sometimes find py-cord use of **kwargs annoying. Especially because I can not spell ephermerial any time I try.
ephemeral
learning how to pronounce words helps
Pretty sure it is ephermeral /j
eh-phe-mer-al
ephemereal
This is actually true, no idea how it is said aloud.
and then I sit there and just let copilot write it for me xD
I change everything except ephermeral
had trouble with this one for a longggggg time, ephemeral or emepheral (my brain was just not connecting it to éphémère (french ))
ephemeral
How exactly can I ignore this warning?
DeprecationWarning: interaction is deprecated since version 2.6, consider using interaction_metadata instead. See https://discord.com/developers/docs/change-log#userinstallable-apps-preview for more information.
if message.interaction.type == 2:
DeprecationWarning: interaction is deprecated since version 2.6, consider using interaction_metadata instead. See https://discord.com/developers/docs/change-log#userinstallable-apps-preview for more information.
if message.interaction.name == command:
I understand the nature of this warning; I already added some lines to attempt to filter those warnings out but they still print to the console
def is_dank_slash_command(message: discord.Message, command: str):
if message.author.id == dank_memer_id:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
if message.interaction is not None:
if message.interaction.type == 2:
if message.interaction.name == command:
return True
return False
Monkey patching my beloved
but why not use interaction_metadata ? does it lack information that you need ? (it does lack name)
Can you try something like that ?
class IgnoreDeprecatedInteractionFilter(logging.Filter):
def filter(self, record):
if "interaction is deprecated" in record.getMessage():
return False
return True
logger.addFilter(IgnoreDeprecatedInteractionFilter())
Yep I need .name to figure out the command a user is running on another bot
Trying this out but I doubt it works for me since I don't use the logging module
Actually
maybe it wil;
the warning you getting is not the one from pycord ?
It is
I forgot discord.py/pycord uses the logging module
never mind, didn't work
but py-cord needs you to activate logging for it to work
so that mean its a real error
Like this, right?
import logging
logger = logging.getLogger('discord')
class IgnoreDeprecatedInteractionFilter(logging.Filter):
def filter(self, record):
if "interaction is deprecated" in record.getMessage():
return False
return True
logger.addFilter(IgnoreDeprecatedInteractionFilter())
yep, but it just mean the warning is python warning and not logging.warn, that's mb
nw
But yeah the warnings are still showing
it might be beause pycord use stderr and not warning module
well it does use warnings for this part
For what do you even need that?
@little cobalt
I saw that
idk how accurate this is but this would explain why the with warnings.catch_warnings(): does not work
then i dont understand what you dont get
I mean the "message.Interaction"
"Yep I need .name to figure out the command a user is running on another bot"
because interaction metadata does not have this info
the best solution is to not ignore deprecation warnings at all kekw
^^ the field is deprecated for a reason
And discord doesn't want to expose the name for interaction_metadata
Find other ways to detect the command or just don't lmao
why do py-cord is blocking the warning message ignore ?
Probably just how deprecation warning is set up.
Because deprecation warnings shouldn't be ignored?
yeah but if the user ignore it that on him and means he knows that
It's warning you to stop using it over removing it directly and potentially breaking thousands of bots
No it doesn't, it means you're using a feature that might stop working at sime point
Who in their right mind would to that ?
if you cannot change it at the moment, having ur console flod might be inconvenient
That's on you for not reading the changelog of a major update or docs for the attr/meth and just blindly updating
Im not saying that, lets say he needs right now to use the name and he doesn’t have any other solution
Having his console full of warning when he already knows that it’s gonna be depreciated can be annoying
He can just not use it?
It's not supported (anymore)
No one needs to rely on checking another bot's command
I do get the initial warning but forcing the user to not be able to easily ignore it I don’t really get that

and breaking semver
there are use cases for that
imo discord is at fault here for just removing info from the API
I use the field too for something completely different
Other than sending "omg! Thank you for doing that!!"?
Oh definitely
it has nothing to do with another bots command or anything
And their reason to not document is stupid
Now, I don't agree on that, I have heard of some use cases that seem legitimate to me, however, I agree that there is no justification for using a deprecated feature
What are these cases 👀
If the feature is deprecated you should just not use it.
IE if you want only one command to be able to be used in a channel nevermind you can do that with integration settings
That doesn't include the reason lol
But ig command usage tracking for the server is a good one
ctx.channel moment
Yeah, in any case the feature should just not be used
whatever going to go back to doing integrals
yikes
I just looked up what that is.. goodluck 💀
thanks 😭
My bot uses message.interaction in on_message, resulting in many logged DeprecationWarnings. I understand the implications of continuing to use .interaction, my intent in suppressing them wasn’t to ignore best practices but to reduce noise while retaining this feature temporarily
It allows my bot to perform actions based on specific user interactions with another bot, this would be degraded if I removed message.interaction prematurely.
That’s on you for not reading the changelog of a major update or docs for the attr/meth and just blindly updating
I did look out for problems when updating and read the relevant documentation when I discovered this, including the linked API reference in the DeprecationWarning. I also asked about it previously here. I made a deliberate decision to upgrade for the improvements in 2.6 and accept the warnings as a tradeoff.
I find it unfair and patronising to assume I updated “blindly” based on a few messages without the full context. I already looked into everything I could find regarding this change before deciding to proceed.
He can just not use it?
It’s not supported (anymore)
I fully understand what deprecation means. I left the usage of .interaction in my bot with full awareness, not ignorance. Until discord removes it entirely or provides an alternative I need it to maintain accuracy for a live feature.
uhhh idk what issues you're having with suppressing the warnings, but if you really want you can fully override the function
def some_func(*args, **kwargs):
return None
discord.utils.warn_deprecated = some_func
```run it after your imports in your main bot file
(this is pretty silly, but eh if you're that desperate then it's not the worst thing i've ever seen)
alternatively, instead of accessing message.interaction you can fetch the raw data -> access the ["interaction"] key
(on master/next release, this would be message._raw_data["interaction"])
@errant trout this didn’t work basically
Like it had no effect
yeah i backread
I’ll try this
Thank youu
idk much about filter but this silly override method should work if you want to break the deprecation warnings entirely
It’s fine, I’d rather go for accessing the raw data directly, gives me more flexibility especially if it’s removed without warning
fair
Wouldn’t want to accidentally erase any other future deprecation warnings either
but yeah staff was pretty adamant on not documenting interaction_metadata.name https://github.com/discord/discord-api-docs/pull/6734
so we can't either
Yep I fully understand that, I recall seeing that gh thread before
Hello everyone, I'm currently getting this error in my terminal even tho the ID's are all correct. I have the same logic for 2 other ticket systems that take place in a different server but I dont get this issue whereas in an another server with 2 ticket systems I'm getting this issue:
Ignoring exception in modal <discord.ui.modal.Modal object at 0x00000242B22B6F90>:
Traceback (most recent call last):
File "D:\test\tutorial-env\Lib\site-packages\discord\ui\modal.py", line 341, in dispatch
await value.callback(interaction)
File "D:\test\deep.py", line 218, in modal_callback
ticket_channel = await interaction.guild.create_text_channel(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
)
^
File "D:\test\tutorial-env\Lib\site-packages\discord\guild.py", line 1223, in create_text_channel
data = await self._create_channel(
~~~~~~~~~~~~~~~~~~~~^
name,
^^^^^
...<4 lines>...
**options,
^^^^^^^^^^
)
^
File "D:\test\tutorial-env\Lib\site-packages\discord\guild.py", line 1102, in _create_channel
"id": target.id,
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'
I think it's saying that your variable target is None at the point where you attempt to retrieve the value of target.id
To clarify: "Your" variable target is actually in py-cord by the time the NoneType exception is raised. You would want to examine your own code in (it looks like) deep.py starting on line 218. One of those 4 lines of code is passing on a value which is ultimately turning into the target var a couple of calls later.
Check all your overwrites are valid users/roles
I was poking into those functions in guild.py and the overwrites is the only possible place for that issue to arise, I think.
pretty much
It's a category ID under which a new channel opens up after a user fills out a modal
i mean just check that you didn't pass None as a key
I honestly can't figure out the problem as 2 of my other systems follow the same suit and work perfectly fine
Nope
show your overwrites dict
Is it better if I store ID's like
example = [1234567889010, 09876543231241]
or in a dictionary
I didn't think this would be a problem because other ticket systems work
For what?
did you actually check your overwrites dict
I did
https://docs.pycord.dev/en/stable/api/models.html#discord.Guild.create_text_channel
I think this shows that the overwrites parameter to Guild.create_text_channel is expected to be a dict, by Py-Cord itself.
Models are classes that are received from Discord and are not meant to be created by the user of the library. Attributes key, url. Methods def is_animated, async read, def replace, async save, def ...
They're talking about something else
So I posted this code: #1377282622647963689 message
You can just import this code-file and then instance the Log class and call iter_full, passing your overwrites as 'iterable_thingy.' It will explode the whole iterable and drill into additional iterable-elements found inside, listing off the data type and content of each element in each iterable.
I'm using a list and all all variables are given a value
Your initial call to Guild.create_text_channel is passing 'overwrites' unmodified and untested to Guild._create_channel. At that point, Guild._create_channel is running tests against each 'Permission' member of your 'overwrites' iterable. The permission itself is passing all the tests, verifying that each element is in fact an instance of PermissionOverwrite. This occurs in a for target,perm in overwrites.items() loop. Shortly after, the 'target' parameter (which is totally untested in both calls) is called for its id attribute, and at that point the 'target' is None.
So there's something hinky with your overwrites. It doesn't matter if everything looks right to your eyes. Something isn't right and it's in your KEYS, not in your VALUES.
I cannot believe how stupid the mistake was
Thank you @tidal pecan and @errant trout
allgood
My best suggestion for avoiding issues like this is to teach yourself how to Rubber Ducky. Also, I'm a big fan of "The Mentor's Manifesto" which states: I made a discovery today. I found a computer. Wait a second, this is cool. It does what I want it to. If it makes a mistake, it's because I screwed it up. Not because it doesn't like me... Or feels threatened by me... Or thinks I'm a smart ass... Or doesn't like teaching and shouldn't be here... Damn kid. All he does is play games. They're all alike.
Traceback (most recent call last):
File "C:\Users\basti\BastiGame\Development\DevHQ\InternalBot\.venv\Lib\site-packages\discord\ui\view.py", line 540, in _scheduled_task
await item.callback(interaction)
File "C:\Users\basti\BastiGame\Development\DevHQ\InternalBot\cogs\experiments.py", line 284, in callback
await interaction.response.edit_message(content=f"Message scheduled for `{self.schedule_time}` UTC!", view=None)
File "C:\Users\basti\BastiGame\Development\DevHQ\InternalBot\.venv\Lib\site-packages\discord\interactions.py", line 1198, in edit_message
await self._locked_response(
...<10 lines>...
)
File "C:\Users\basti\BastiGame\Development\DevHQ\InternalBot\.venv\Lib\site-packages\discord\interactions.py", line 1365, in _locked_response
await coro
File "C:\Users\basti\BastiGame\Development\DevHQ\InternalBot\.venv\Lib\site-packages\discord\webhook\async_.py", line 225, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.content: The 'content' field cannot be used when using MessageFlags.IS_COMPONENTS_V2
await interaction.response.edit_message(content=f"Message scheduled for `{self.schedule_time}` UTC!", view=None)
How can I edit the message so that it's no longer MessageFlags.IS_COMPONENTS_V2? I just want to have a message at the end.
what if you only edit the view away
Once you send cv2 you cannot remove them
I didn't work with CV2 yet but can't you just edit it to be a completely unstyled text area
You can't use content, the best you can do is a View with a single TextDisplay
But I don't want to have a container in the message anymore, it should just be a small text message
How do we add permissions to slash command groups?
like if I add perms to individual command using @discord.default_permissions it won't work, users can still use the command
in the group definition
what's the param?
group = discord.SlashCommandGroup(default_member_permissions=)
.
can we add individual command perms in groups?
This doesn't work
by using check yes
its default_member_permissions not default_permissions
works tysm
your welcome
This could benefit a pr changing it's name
One or the other
default_member_permissions is the API name, default_permissions is the decorator name (and decorators generally don't have to follow the API, they're for convenience)
the decorator should be renamed then imo
v3 
Is it preferred to enable standard type checking in project?
I personnaly have strict type checking setup with basedpyright, although I have to ignore some stuff often because the project isn't fully typed
ye I use strict in my own cli app
but here in pycord showing many issues on enabling
Should I do for pycord?
You could and it would give you some benefits, you can still ignore project wide some issues (e.g. untyped decorator, missing generics, whatnot) and keep the rest. If you want here is my config for basedpyright project wide:
[tool.pyright]
venvPath = "."
venv = ".venv"
reportAny = false
reportUnusedCallResult = false
reportUnknownMemberType = false
reportMissingTypeStubs = false
pythonVersion = "3.12"
then I ignore a bunch of stuff inline as needed when the errors don't matter
but idk what type checker you use
pyright
and ruff as linter and formatter
then you can try this (btw basedpyright is imo way better than just pyright)
I am planning to use ty after a stable release
me too, but I would also want it to have some more features I feel like will take more than a stable release to arrive, so I'm probably gonna stay w/ basedpyright for some time
u saw fb's pyrefly?
again a rust tool 😎
now-a-days new rust tools more than C lol 😂
Seems nice although I reall like the many rules basedpyright has and I feel like it has quite less (as in that one only and only type checks whereas basedpyright hast stuff e.g. to differentiate Any and explicitAny, reportInvalidCast and a bunch others), errors seem less specific too
rust isn't great for everything, but one thing it is always great for is cli apps/tools imo
rust is great for apps even, just bad for game dev
like there is tauri, electron replacement
better performance
tauri has its own issues tho, I wouldn't have taken that as an example
lol yes but we can consider
we can take example of discord, backend is using rust after 2020
they ditched go
bcz of grabage collector
makes sense
Discord does not allow you to have different permissions for subcommands.
tq for this help too ❤️
With pycord I don’t think
Because too much issue like ctx.guild.id raising an error even tho you set the command as guild only etc
Are you jsing vsc ?
That's not a pycord problem, that's a limitation of type cheking
we ain't gonna make command generic + overloads type checkers are either gonna give up or developers that would be mantaining ts
just check if it exists that's it it's one line
Any fix for this?
then?
What is your goal? and can you show surrounding code
Is there a reason why role.edit is type hint as returning Role|None ? Because ho would this never return None
Have to do everytime if ctx.guild is not None when we know for sure it will never be None is useless in my opinion
Then don't type check your code, but that's not a pycord issue
Means type checker can't well understand the type
Vincent told me that the decorator could fix this
If you don't know how type checking works you should probably not use a type checker, pycord or not
So maybe it could be fix inside pycord
Even tho yeah there is limitation and I’m not blaming pycord for that
ik used it in my own libs, but others idk 💀
yeah but it would complexify the code, it's just not the priority
It could be possible with generics
and overloads
ye this too
Also is there a reason to use Optinal instead of | None ?
depreciated
And also this, so I know if I need to pr that
Wdym
I thought u meant Union lol
Optional and union are deprecated after 3.10
but now-a-days I prefer doing | None and more usage of | instead of typing classes
old codebases use typing classes much
like for tuples
Tuple instead of default tuple
etc...
For all builtins
So I should not use it
not sure abt any
wdym
any is just not the same at all as Any
that's different
?
idk man, not much familiar with types in python
I learnt py, then learnt js/ts, liked types, switch back to pythoon and used there
Any is a type
Whereas e.g. Tuple tuple, one is a type the other a builtin but both represent the same thing
btw any fix for this?
It is because commands can also be ran in dms
add this
if isinstance(ctx.author, discord.User): return
at the top of your command
it will fix it
there is also issue for this in my cog listeners also in purge, do I need to do this everywhere? 💀
wdym in purge
show the code please
ok, tmr morning, gonna sleep 🥱
tysm guys for helping me out for today!!
❤️
in what condition can interaction.user be None ?
i think None, that might be an issue on pycord
** member is sent when the interaction is invoked in a guild, and user is sent when invoked in a DM
Guys what orm du perfer in python?
Never rlly used any ORM in python so confuse, in node there're many like drizzle, kysely etc...
I want something like that
paillat advise me to use tortoise orm
and it seems nicz
ye
ping
but this doesnt return an interaction no ?
ping interactions from discord exist, which have no user attached
regardless, if discord's spec says it's nullable then we will also type it with None
i thought about interaction.response.ping, that's on me
that's the thing by checking on the doc i didnt find it nullable (or i didnt understand that)
** member is sent when the interaction is invoked in a guild, and user is sent when invoked in a DM
so for me it meant it will either be member or user
@errant trout Any thoughts about Tortoise ORM?
never used it
dont know that
but idk if the benchlark is really important
Hmm these all things are not much popular and not well supported in python lol
for our usage
Ru interested in open-source contrib?
i used to just do raw sql query, i never used any orm in prod
if i can help why not but i doubt that i'll be able
also, inside a interaction check, can i have a ping interaction ? or its only in a particular context
See this is my project
https://github.com/swayam25/Square-Bot
Also my first proj, likr 4yo code in some places, I update it but just like stack on old code, didn't update much core stuffs, like the music player and the db
uh generally you don't need to worry about it, the library handles them at the base level
that time I was unknown abt these dbs, so just used json files
and ik how bad it is
now trying to shift that to proper db
if ur able to, can u help?
i mean migrating from json to db isn't too hard?
Less exp in db
I am comfortable in using drizzle orms
basically node
then I am planning to fix type errors, I am scared to enable standars/strict type checking in pyright it throws huge no of errors
so planning to first migrate then solve these
i sadly already have a bot i need to maintain and i dont have time
so i dont think i willhave time
but if you have question about specifc thing tell me
Take a look at tortoise, it's easy, async ready and typed correctly
Same here
Plus exams
exams are in the head
i got my first pr merge, i think i will make the 30 of may a dya off
(just realize 30 of may is the birthday of my ex)
Bruh
do you know by any chance if there is a way to correct typehint with tortoise when it can be nullable ?
Wait you aren't typing them
though it was handle, gonna typehint them rn
sad tho that some functions are notreally type proof
Here you should use cast then
it will always be fields.Field[...] for the typehint ?
im gonna take a look at that
or should i do like int | None
Yes except for enums I think
Reverse..[...] | None I think
Try putting the none inside
But I don't think that would work, it doesn't put it outside
List should not be left like that
Never
Nowhere
@echo wraith What's ur age? How du manage ur coding + study?
i'll put list[int]
18, I don't manage it and that's a problem.
More seriously, I have in general some ease in my studies which allows me to take some time to do other things. And I try to still block as many distractions as I can when I'm studying
That would work
the usage of fields.Field isnot thebest in my side because then i cannot do int + 1, i'll justuse normal typehint : int instead of field.Fields[int]
Problem here is coding is disctraction in my study 😔. Getting poor grades bcz of that only
Wdym
Yes you should be able to
Any time I see new tech stuffs, or something to code, then code all day and at the end I fk
Try not to code as much, well remove your distractions etc. Rn I have exams, what I did is I literally unplugged my PC at home, and put a 0min screentime limit on ytb Instagram and a bunch of other things
using pylance
It uses pyright
Insane
Oh yeah 
I'm cheating a little
All of my study notes are backed up to GH every 10 min or so
and that becomes more for me leading to get fked before exam night
So in reality more like 2/3 of these are actual contributions
I have module test on 2nd June and I am still coding 💀
Then don't
i used basedpyright and same issue
Im checking rn
that's a known issue, https://github.com/DetachHead/basedpyright/issues/960
@fresh sierra ¯_(ツ)_/¯
bizrre
show me where you import Field from
Ok si it seems that it works when using an instance and not the class
yeah of course
when using the class it should not work you shouldn't use it that way
It was just to check ofc I’m not using it
how should ths be type this i dont know the arg / kwargs ?
where is this
what class
This is inside a database model
Check the types in super().delete and use these
also seems like it doesn't want *args at all
so i should maybe just do async def delete(self, using_db: BaseDBAsyncClient | None = None) -> None:
well that's pretty logical after all
yes
Does anyone know if it's currently possible to do
@discord.option(input_type=discord.TextChannel | discord.VoiceChannel)
As in using | instead of Union ?
Using channel_types
ok thanks much
wait wdym
like here but instead of thread you put text and voice channel
ok
Any
from typing Import Any
Sorry for not formatting, on mobile atm
tuple[Any, …]
In your case
You only type the value, so just Any is correct there
what is more correct, use the same thing as the original function or args and kwwargs typeed as any ?
Same thing as original is better but Any if ur lazy
gl
ignore it
especially with all those particular case
that one you can ignore
