#Basic Pycord Help
1 messages · Page 58 of 1
if they remove the usage its normal
I think what's going on is that you lack permission to use and thus see the command, but your client still shows it (because of cache)
so a restart should fix it
is it a user app, btw? or a guild installed one
they say it doesnt
maybe app command still show if the channel has an overwrite
yea i know
app commands on desktop are still buggy
@meager token can you try the same thing on mobile?
hodl on
I made it join a different server (on pc) and used it there
and it worked fine
guild
yea okay but what if you try the thing it errored on, on mobile
my phones still starting
lol
thanks!
same error
hm, then you should be able to use any command regardless
can you try clearing your custom role permission for that command and re-set it?
if roleid not in ctx.user._roles:
await ctx.respond("You must have the role to use this command", ephemeral=True)
return
``` its not the discord role permmision thing
cuz I didnt know it existed
and now im stuck with py c = bot.get_channel(1231437560790781962) c.send(content="test") where c is allways none even though teh channel exists and the bot can see it
lol
where do you call that
in a command
what are your intents?
.all()
it miss await
and if you view the server via the bot's role, you can see it?
doesnt matter for now, if the get returns none
but yea
.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.
oh cache
Generally you should be able to rely on the cache having all channels in it
I found fetch_channel but it gives me a malloc error
yea because you arent awaiting it
like your send
fetches are API actions and need to be awaited
but your get still shouldnt return none if you didnt mess with cache and your bot can definitely see the channel
probably didnt tick the right box then when making the invite link
I add it to the guild and others can use it??
its really not weird
its basic scoping
there are a lot more apps than bots you can make on discord
as you can tell by the sheer amount of scopes
everything works now I think thankyou
np
does someone else have some audit log issue ?
some of my listener about on_raw_audit_log_entry will not get trigger in some cog
found why i think the on_raw_audit_log_entry will not get trigger when its updating the raw audit log
how can i get the update of an audit log entry
for exemple when a member disconnect a member it will just update the count of the number of disconnected member
not sure if you can get updates of an existing entry
if we cant that stupid...
audit log are stupid in a lot of way
not giving all info etc
i mean, role assignments by bots arent even logged anymore
what ????
try it :)
is that a bug or a new feature ?
my guess is as good as yours
hm then it's limited to some conditions
but i've noticed it and there's been other people here complaining about it
add role doesnt seems to trigger it
does the addrole and the edit member are under the same route ?
i dont think
add role doesnt trigger the audit log
edit member trigger the audit log
i hope it will come back
discord is already aware
they are aware of a lot of bugs judging by their responses to bug reports
but that, from my experience, means you cant expect a fix
so its a bug and not a new feature
api team =/= client team
idk what fucked up client you have to have disasterous bugs every day but api stuff is handled very differently
No, the bugs i report are persistent across literally all branches, on desktop and web
i test my shit before i bug report
damn that's crazy 
its just that i have a natural skill for finding bugs in every program i use
and yea, not sure if i ever reported an API issue
but the client team is complete shit
I have a problem that after a while the button stops working. The bot does not restart, it happens after 5-15 minutes. The timeout is set to None, and no errors appear in the console either. Just Interaction failed
i think views need to be persistent to react after that long
so i have to use bot.add_view() even if im not restarting the bot?
For a view to be persistent all buttons/selects need to have a custom_id as well as setting timeout to None
The custom_id is automatically set unless you are doing somthing weird though.
You should not need to use add_view unless the bot restarts
Is the view in a ephemeral message? Also can you post the full error
nah stop, If I restart the bot, they will be added via bot.add_view(), and they work again for a while, and then they stop again
button has custom_id and timeout is set to None
otherwise I wouldn't be able to use bot.add_view()
i have no errors in the console, it is empty
all that i see is Interaction failed
and its not ephemeral
can you show the code of your view, at least the vital bits
^ this
and It seems like you have some error handling that is eating some of the important information
this button doesn`t have an error handler
just discord.ui.View(Button(), timeout=None)
so the button has no function? lol
callback function .-.
But you are creating a new Button object in the view args
i highly recommend subclassing the view class instead of doing it like this, btw
its extremely messy
Button() is my class
yea you also shouldn't shadow built-in names
please just show your actual code
is there no bot.fetch_message? the cache is for some reason to unreliable for me
it says there isnt a bot.fetch_message
channel.
.tag partial-objects
Partial Objects
These can be used to make API calls when you have channel id and/or message id, and you don't want to rely on the cache to have their objects.
Methods which can be used on them are
Example Usage:
async def star_message(channel_id: int, message_id: int):
# Get Partial Messageable object
partial_channel = bot.get_partial_messageable(channel_id)
# Get Partial Message
partial_message = partial_channel.get_partial_message(message_id)
# Add a reaction
await partial_message.add_reaction(":star:")
that could also help
Note that you can get a full message from a partial channel.
You can use a normal channel if you already have it as well. You just need to call it off a channel object instead of a bot object
I have the problem that as soon as I execute a slash command, they suddenly disappear, even after I've restarted my Discord.
that is one complicated starting sequence
Make sure you are not starting the same bot 2 times. IE if you have it deployed and running on your PC
But im bot starting the bot 2 times
what command are you running that does this?
With each command, this happens
why tf cant i do this. discord.ui.button takes no argument url
class AdvertisementButtons(discord.ui.View):
def __init__(self, bot):
self.bot = bot
@discord.ui.button(label="Invite PartnerPal", style=discord.ButtonStyle.link, url="https://partnerpal.nziie.xyz/invite")
async def invite_button(self, button, interaction):
return
@discord.ui.button(label="Report", style=discord.ButtonStyle.red, custom_id="REPORTSERVERBUTTON")
async def report_server_button_callback(self, button, interaction):
await interaction.response.defer(ephemeral=True, invisible=False)
await interaction.followup.send("Coming soon.", ephemeral=True)
Cause link buttons don't have a callback
I do admit we could just make it ignore the callback at all
So what should I do
I tried doing self.add_item after super().__init__ but it doesn’t always show up
does anyone bot.description return None even if its not None ?
like, the about me?
yeah we can say that
even if bot doesnt really have an about me but its located in the same place
because im able to edit it without issue but the bot.description is still None
yeah
ah
and i didnt edit it through a command for that bot so its just a pycord/api issue
well id help but the doc search is literally broken
irrelevant i dont see how edit it through the api will change anything
im trying to find it inside the github but i dont find anything
maybe they forgot, before it was summary i think
yea but the doc search is just broken 100% for me
same
oh i'm smart. I deprecated it without actually implementing it
oh wait it is tehre
because i remember i tested for this
yeah probably something with the api
it's returning the correct value for me
bot.description works for u ?
or you are using something else
because for me bot.description return None
does appinfo and bot are the same ?
no
the Bot's 'description' is the docstring attached to the class
bot.description return None even if my bot has a description visible
Client.application_info
Bots: Attributes activity, allowed_mentions, application_flags, application_id, auto_sync_commands, cached_messages, cogs, debug_guilds, default_command_contexts, default_command_integration_types,...
thanks, i was in the wrong place
ok
Nope. I always figured it was an aio loop thing; I've got a couple of different things hooking into it (db, 20 different non-Discord websocket connections)
I feel like an idiot rn, but how the hell do i get sentry to works properly with pycord? I tried using the sentry sdk as well as the discord-sentry-reporting package, didn't work, in the code i tried to override the on_application_command_error and on_error but they didn't help either, none of the exception are reaching Sentry
Maybe it is
.tag blocking
In asynchronous programming a blocking call is essentially all the parts of the function that are not await. Do not despair however, because not all forms of blocking are bad! Using blocking calls is inevitable, but you must work to make sure that you don’t excessively block functions. Remember, if you block for too long then your bot will freeze since it has not stopped the function’s execution at that point to do other things.
A common source of blocking for too long is something like time.sleep(). Don’t do that. Use asyncio.sleep() instead. Similar to this example:
# bad
time.sleep(10)
# good
await asyncio.sleep(10)
Just an idea idk if it's actually that
Unlikely, I'm already doing test commands to raise the exception, as well as print() ing a message in log after the sentry capture_exception line is run, but sentry's side is not getting anything
That's what's making me confused
Would you mind have a minimal reproduction coffee and share it here
@bot.event
async def on_application_command_error(ctx: discord.ApplicationContext, error):
#send the error to sentry
sentry_sdk.capture_exception(error)
print("Error occured in on_application_command_error, sending to sentry")
raise error
@bot.event
async def on_error(event, *args, **kwargs):
#send the error to sentry
sentry_sdk.capture_exception(sys.exc_info())
print("Error trigged in on_error, sending to sentry and rasing")
raise
and command to raise that error is
@bot.slash_command()
async def crashtest(ctx: discord.ApplicationContext):
if ctx.author.id != 419742289188093952:
await ctx.respond("You don't have permission to use this command")
return
await ctx.respond("Crash Test", ephemeral=True)
raise Exception("Crash Test")
What happens if you move the print before the sentry thing
.tag Blocking is the issue imo
Tag not found.
reading then
..
okay i feel like an idiot there
of course there's an asyncio integration
Idk if that's the issue but it really might be imo
might as well try
Yeah
Doesn't seem to work...
I don't see an event fired on sentry
Where should I init sentry at, actually
Just out of curiosity what happens if you capture a random belly created exception in the command code itself ?
I have no idea, never used that
should i just init at the start of the program or on on_ready
uh>
Start of the program probably
Like
sentry_sdk.capture_yadayada(ValueError("AAAAAA")) in the crashtest command itself
uh, sure.. let me try that
Try with ValueError I wanna see what it does
Hm.. nothing
@bot.slash_command()
async def crashtest(ctx: discord.ApplicationContext):
if ctx.author.id != 419742289188093952:
await ctx.respond("You don't have permission to use this command")
return
await ctx.respond("Crash Test", ephemeral=True)
sentry_sdk.capture_exception(ValueError("Crash Test From Within The Function"))
raise Exception("Crash Test")
@bot.event
async def on_application_command_error(ctx: discord.ApplicationContext, error):
#send the error to sentry
sentry_sdk.capture_exception(error)
print("Error occured in on_application_command_error, sending to sentry")
raise error
@bot.event
async def on_error(event, *args, **kwargs):
#send the error to sentry
sentry_sdk.capture_exception(sys.exc_info())
print("Error trigged in on_error, sending to sentry and rasing")
raise
it's now this but
nothing either
Are you able to have logs sent to sentry in a basic script WITHOUT loisirs py-cord ?
Uh, yea, I actually just tried that a few seconds ago
it shows up on sentry
Maybe delete that
Ok I don't really know how save that has to be
everything can be swapped out at a click of a button
but, yea..
I'm so confused..
It's definitely possible too.. I've seen a few msg in this server talking about using Sentry
That might need to use some debugger to see what's happening. Just one last thing, try this around the sentry capture thing
.tag rie
You can run blocking code (such as PIL/Pillow) in an executor to run it in a separate thread: ```py
def my_blocking_func(*args):
...
@bot.command()
async def test_command(ctx):
ret = await bot.loop.run_in_executor(my_blocking_func, 'put', 'args', 'here')``` See the python documentation for more info.
I actually also tested that with an eval command that runs in a second executor
well..
didn't send either
wait actually no
Like with the "run in executor" from asyncio?
the eval didn't use second executor
why would synchronously executed code be the issue, just wondering
or is it timing out somewhere
(i didnt read this in huge detail)
it's just
fn_name = "_eval_expr"
try:
cmd = cmd.strip("` ")
# add a layer of indentation
cmd = "\n".join(f" {i}" for i in cmd.splitlines())
# wrap in async def body
body = f"async def {fn_name}():\n{cmd}"
parsed = parse(body)
body = parsed.body[0].body
insert_returns(body)
env = {
'bot': botobject,
'discord': discordobj,
'commands': commandsobj,
'ctx': ctxobj,
'__import__': __import__
}
exec(compile(parsed, filename="<ast>", mode="exec"), env)
result = (await eval(f"{fn_name}()", env))
except:
result = format_exc()
# convert result from binary to string
if isinstance(result, bytes):
result = result.decode("utf-8")
return result
so
I'll try the second one ig
what is that?
From some random thing I saw online, sentry Spawn a thread by itself so it might be hiding the errors it runs in.
It feels weird to me that that line isn't awaited and it might cause issues imi
Do this as well pls https://docs.python.org/3/library/asyncio-dev.html#debug-mode
A log collection service
This might maybe give more output and info in the stdout
Okay, just tried this.. waiting a few seconds to see if it shows up
hm.. nothing
Print statements shows that the command did go though
I'll setup debug logging
okay that's a eff lot of logs
should work out of the box. Sentry spawns a background thread for sending outbound http requests. This generally works out fine regardless of whether your own code is async vs not. It is hard to tell whether this approach will have to change in the future, but if it will and we need specialized code for uvicorn, it will be part of a respective integration.
https://forum.sentry.io/t/does-sentry-honor-asynchronous-code-python-asyncio/14171
Also
well that explains a lot.
doesn't.. make much sense though
the sentry-cli on the same machine with the same credential and everything is sending though the event just fine
I.. can't seem to find where it'd be helpful for me rn
Since, isn't that the purpose of the asyncio integration?
well.. any idea for these?
Hm..
I have a feeling this have to do with the ipv6 networking..
will try something on that and report back
ipv6 only.
well, the host is ipv4 and 6
but sentry is v6 only, (though it's also in front of cloudflare before but that didn't help)
There we go
I enabled ipv6 networking for the default network in docker and all is well now
thanks a lot for the help!
🎉
Definitely find it odd that Sentry does not raise any error for not being able to connect
I think that is worth opening an issue on gh
Ye, I think it definitely is worth opening
v6 only is odd
a hint of modernity in this utter ipv4 world with some DS sprinkled in
ipv4 addresses are not exactly cheap =[
lmfao imagine
here its the absolute default
I still find it slightly odd at one point though
Ah.. i should prob clarify a bit
the VPS is technically a proxmox VM
and the proxmox host only get 1 ipv4, and a /64 ipv6 block
extra ipv4 are like 5$
tf
per month
the domain used to be behind cloudflare
so it should be supported on both v4 and v6
so.. i don't know what happened there
I removed it off cloudflare to check if it's cloudflare itself blocking the request but
eh
Anybody knows how to solve the
Task was destroyed but it is pending!
task: <Task pending name='pycord: on_ready' coro=<Client._run_event() done, defined at D:\Documents\bot discord\timed_role\.venv\Lib\site-packages\discord\client.py:401> wait_for=<Future pending cb=[Task.task_wakeup()]>>
I remember seeing that as a GitHub issues at some point. I thought it got fix
upgrading from 2.6.0 to 2.6.1 fixed my issue 😄
You don’t do anything
It will appear sometime and sometime not u can’t do really anything. It will need a thing in pycord to solve that
except blocking code, is there any reason for that :
2024-10-08 06:13:44 [WARNING] : Can't keep up, shard ID 3 websocket is 10.1s behind.
is already implemented in the latest pycord dev version Soundboard
don't think bots can use soundboards
because they can already play whatever audio they want
how can i get the current bot activity
This is it working. When it doesn't the image in the embed doesn't load
@sage tendon
The image url and all is the same
Its there, discord just pretty much, ignores it?
bot.user.activity ? Probably
Return None for me
I think it’s only the one that u pass in the client
bot.activity no?
You might need the intent
uhh, what about .activities?
No attributes
U never need intent for ur own thing
You do for messages lol
Not to check ur own attribute
Well can you check if ur return another thing that none ?
And I’m not sure about that, it seems strange
guild.me.activity works
Looks like bot.status and bot.activity don't change at all once the bot starts
can you actually show how the embed looks when it doesnt work
It would show like this, just the image wouldnt load
on mobile as well?
Yeah
and you're 100% sure the link is always sent with the embed?
On some rare instances, I saw the image appear for like, 0.2 seconds and then disappearing
might be a ratelimit/cache issue between discord <=> bluesky
If anything it sounds like a client issue though
but usually those are limited to either mobile or desktop
Its weird because if you try again it works
And its ONLY in DMs
The same command, which is a user install, if I use it anywhere else, that never happens
and its always on the second time that it works?
Yeah, usually I delete the first response and try it again and it works
can you try not send an embed at all and just send the image link in the message content
to see if the image loads at all
how do i use user apps with pycord
@commands.user_command(name="Test")
async def user_bot_test(self, ctx, teststuff: str):
await ctx.respond(teststuff)```
this wont work after i auth
this is not a user app, that is a user command
very different concepts
explain please
user commands are commands that appear in a user's context menu
user apps are bots you add to your account
read the example i sent for how to use them
Need to try it
Sometimes the embed works on the first try as well. Really weird.
and your bot must also be set to be user-installable in the dev portal, and ofc you need to actually authorize it on your account to see its commands
Extension 'cogs.DontLook' raised an error: AttributeError: module 'discord' has no attribute 'InteractionContextType'
this i did
which pycord version are you on
2.4.1-1
You're kinda supposed to update your library if you wanna use new features.
linux being wacky, it's not updating lul
Linux is quite a thing
did you add the upgrade flag?
show the error
i have a suspicion
wdym "no command"
did you pass the integration type to the command?
yes
Did you load the cog
remove the context
yes
unless you only want that command to work in the bot's DMs which is pointless
or nvm, DMs at all, but still, try remove it to make sure there's no other issue
and restart discord when doing any changes to your commands
If you are adding new commands reload your discord with ctrl R. It usually does the trick
Thanks man
@ivory blaze Do you have the guild members intent?
yeah I got it all working dw
got it working
thx friendlies
what would be the equivalent of images: discord.Option(discord.Attachment, "Images to upload", required=True, max_length=10?
because AttributeError: Option does not take min_length or max_length if not of type str
cant
that's impossible?
thats what i just said yes
k
either do multiple options or accept a zip
When i press a button, i will get a user by id but idk
await rating_sender(user, interaction.channel.id, interaction.guild.id, embed, view)```
def __init__(self):
super().__init__(
label="Schließen",
style=discord.enums.ButtonStyle.green,
custom_id="interaction:ConfirmButton",
emoji=":heavy_check_mark:"
)
async def callback(self, interaction: discord.Interaction):
...
user: discord.User = self.client.fetch_user(ticket_open_from)
await rating_sender(user, interaction.channel.id, interaction.guild.id, embed, view)
await interaction.channel.delete()```
interaction.user
I will get a user by id
ah i see, then you need to await fetch_user
also make sure the ID is an int
hasn't interaction.user been deprecated?
...no...?
huh
I've switched interaction.user over to interaction_metadata.user.id some time ago
mustve had a reason
Tf
my bot detect some blocking code around 3s, do you have any idea of thing that i should look around ?
user: discord.User = await self.client.fetch_user(ticket_open_from)
^^^^^^^^^^^
AttributeError: 'ConfirmButton' object has no attribute 'client'```
where do you define ConfirmButton
send the code
class ConfirmButton(discord.ui.Button):
def __init__(self, client):
super().__init__(
label="Schließen",
style=discord.enums.ButtonStyle.green,
custom_id="interaction:ConfirmButton",
emoji=":heavy_check_mark:"
)
self.client = client
but now i need to give this to this class
Yeah. Where do you use your button ? In your code ?
You do ConfirmButton(client)
instead of ConfirmButton()
ok thx
Why when i rate on a button its delete the link button?
view.add_item(TranscriptButton(f"x"))
channel1 = self.bot.get_channel(data[0])
await channel1.send(file=file, embed=embed, view=view)
user: discord.User = self.bot.get_user(ticket_open_from)
await rating_sender(user, ctx.channel.id, ctx.guild.id, embed, view)
await ctx.channel.delete()
# Setup
def setup(bot):
bot.add_cog(ticketsv2(bot))
async def rating_sender(user, channel, guild_id, embed, view):
rating_view = RatingView(channel, guild_id)
for item in rating_view.children:
view.add_item(item)
await user.send(embed=embed, view=view)
class RatingView(View):
def __init__(self, channel, guild_id):
super().__init__()
self.channel = channel
self.guild_id = guild_id
@discord.ui.button(row=2,
label="1",
style=discord.ButtonStyle.red,
emoji=":star:",
custom_id="rating_1")
async def Rating1(self, button, interaction):
await ticket_db.update_rating(1, self.guild_id, self.channel)
self.disable_all_items()
await interaction.edit(view=self)
@discord.ui.button(row=2,
label="2",
style=discord.ButtonStyle.red,
emoji=":star:",
custom_id="rating_2")
async def Rating2(self, button, interaction):
await ticket_db.update_rating(2, self.guild_id, self.channel)
self.disable_all_items()
await interaction.edit(view=self)
@discord.ui.button(row=2,
label="3",
style=discord.ButtonStyle.blurple,
emoji=":star:",
custom_id="rating_3")
async def Rating3(self, button, interaction):
await ticket_db.update_rating(3, self.guild_id, self.channel)
self.disable_all_items()
await interaction.edit(view=self)
@discord.ui.button(row=2,
label="4",
style=discord.ButtonStyle.green,
emoji=":star:",
custom_id="rating_4")
async def Rating4(self, button, interaction):
await ticket_db.update_rating(4, self.guild_id, self.channel)
self.disable_all_items()
await interaction.edit(view=self)
@discord.ui.button(row=2,
label="5",
style=discord.ButtonStyle.green,
emoji=":star:",
custom_id="rating_5")
async def Rating5(self, button, interaction):
await ticket_db.update_rating(5, self.guild_id, self.channel)
self.disable_all_items()
await interaction.edit(view=self)```
"rate on a button"?
i dont even see a link button in your code
and what is this..? why are you doing this?
if your transcriptbutton is the link button, then its deleted because in your RatingView, you edit the message's view to "self", which is your RatingView, and your RatingView doesnt have a link button in it
Could anyone help me with this Problem
do you manually sync your commands anywhere
i check and didnt see anything strange
Noooo
This wierd because my commands will be invisible After run any command
does it happen to anyone else
I dont know anyone else they Programm Discord bots
Im from germany, no one Programm bots Here HAHAHAH
you just need someone else to use a command.
if you use another bot token does it do the same ?
and did you check if you only have 1 instance of that bot running, if there is many bot it can create conflit and remove them
That has always been the case for me
I understand but no i only run once
its not really my question ;)
can you try with another bot, it with the other bot everything works fine we know that 2 instance might be running
i think its a client problem tbh
Okay i Check
well actually you can even start 2 directly from ur code
so might even with another token do it twitch
Ahhh u only run 1 bot but they run on multiple Servers
what
This my output
no i just check ur code and this should not occurs
can you invite me in a discord where there is the bot
i will check if it disappear for me too
it does the same for me
why are you setting debug guilds btw
why dont you let your commands sync globally naturally
well i have no idea
why not... ?
why are you doing it?
because they want to
because i get ratelimitet
yea, but time and time again it leads to issues
you really shouldnt
because i only need to servers
But if i sync my commands... then my bot takes toooo long to go online
so you do manually sync them? or what
i dont sync...
my bot is in 3 guilds with about 50 commands and starts in 4 seconds so idk why it would take long for you
and ~500 members
okay my bot takes up to 5 mins if i sync my commadns
wtf
okay i will automatically
just remove the debug guilds and try if you still get the issue
okay i do
okay i do no i show you what happen... wait
ahh wait
Okay here. after i reload discord streamer mode goes on but this happend:
"The Programm doesnt respond"
that error just means your bot never responds to the interaction
yeahh but whhyyy
await ctx.respond
await interaction.response.send_message
await interaction.response.edit_message
etc
huh ?
Traceback (most recent call last):
File "/home/glitchy/.local/lib/python3.12/site-packages/discord/ui/view.py", line 422, in _scheduled_task
allow = await self.interaction_check(interaction)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/glitchy/puppeteer-lmao/terminator/cogs/KirkaInfo.py", line 410, in interaction_check
await self.next_page(interaction)
File "/home/glitchy/puppeteer-lmao/terminator/cogs/KirkaInfo.py", line 384, in next_page
await interaction.response.edit_message(content=f"Clan {self.clan_data['name']} info:\nDiscord link: <{self.clan_data['discordLink'] if self.clan_data.get('discordLink') else 'None'}>", attachments=[file], view=self)
File "/home/glitchy/.local/lib/python3.12/site-packages/discord/interactions.py", line 1074, in edit_message
payload["attachments"] = [a.to_dict() for a in attachments]
^^^^^^^^^
AttributeError: 'File' object has no attribute 'to_dict'```
What's file?
Also at least say "hey I'm having this error" gawd, we ain't chat gpt where you just slap the errors into the chat
file is a discord.File()
you use the files kawrg to upload files
Use files
Goddamit squid
banned
then use an empty array
but i bypassed that error by setting attachements=[] and file=file
now im getting a new error so progress
Traceback (most recent call last):
File "/home/glitchy/.local/lib/python3.12/site-packages/discord/ui/view.py", line 422, in _scheduled_task
allow = await self.interaction_check(interaction)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/glitchy/puppeteer-lmao/terminator/cogs/KirkaInfo.py", line 417, in interaction_check
await self.next_page(interaction)
File "/home/glitchy/puppeteer-lmao/terminator/cogs/KirkaInfo.py", line 385, in next_page
await interaction.edit_original_response(attachments=[])
File "/home/glitchy/.local/lib/python3.12/site-packages/discord/interactions.py", line 513, in edit_original_response
data = await adapter.edit_original_interaction_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/glitchy/.local/lib/python3.12/site-packages/discord/webhook/async_.py", line 222, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
interaction.edit_original_response() wont work
we need more code to diagnose the issue
Please copy and paste your code here. This makes it easier for everyone helping you.
Tag names alzheimer
sometimes i dont remember my own command names
Did you switch interaction.response.edit_message to interaction.edit_original_response?
neither do
Otherwise you wouldn't be responding to the interaction
await interaction.response.edit_message(attachments=[])
await interaction.edit_original_response(content=...)
responding to the interaction doesn't necessarily mean sending a message
Editing a the message is also a response
k
this worked
but any idea why an image would display as 0 bytes?
image = generate_profile_image(member_data)
imageBytes = BytesIO()
image.save(imageBytes, 'PNG')
print("DEBUG: Profile image generated")
file = discord.File(imageBytes, filename="profile.png")
print("DEBUG: Discord file created")
await interaction.response.edit_message(attachments=[])
await interaction.edit_original_response(content=f"Profile of {selected_member['user']['name']} ({selected_member['allScores']:,})", file=file, view=self)
the image is a PIL image
uhh you literally just put 0 bytes?
image.save(imageBytes, 'PNG')
yes the image is generated correctly
oh fuck
i didnt seek bruh
fml
This is a list of Frequently Asked Questions regarding using Pycord and its extension modules. Feel free to suggest a new question or submit one via pull requests. Coroutines: Questions regarding c...
aight
Apps are allowed to send polls, right ?
yes
Is that bad to defer before every command ?
if you dont need it, theres no point
I do it because my Internet can be really slow at every day
Some command need it some other doesn’t, if I put defer in the command invoke I can control first every ephemeral or not and defer everywhere
And you have no issue by doing that ?
I HATE MY INTERNET
I cannot even open Google
oh
nvm Its google which got a problem
lol
now its working
wtf
hello, this is tech support. we can fix your computer for free if you just install this anti virus
/j
why...?
what why ?
overcomplicated for no gain
how is that overcomplicated ?
@commands.Cog.listener()
async def on_hybrid_command(self, ctx: LumabotContext):
if not await is_command_allowed(ctx):
return
elif not ctx.is_app:
await ctx.trigger_typing()
else:
await ctx.defer()
i mean that
and why again do you want to defer every command
2 reasons:
- first i dont have to check for each command that need
- i can put every response in ephemeral or not depending on the guild choice
you should do it on a per-command basis
if for exemple a guild doesnt want that command to be visible they can choose that it will be ephemeral
because some commands require it, while for others its completely pointless
my bot is blocked because of that:
[ERROR] : Event loop was blocked for 1.92 seconds because of:
File "/usr/local/lib/python3.11/subprocess.py", line 2011, in _try_wait
(pid, sts) = os.waitpid(self.pid, wait_flags)
any idea of what this is ?
because i dont really use that
well i have found
i got a function callback a subprocess.call to udpate my bot using git
its i think not the only blocking thing but thankfully i finish my blocking code detector and so it give me the line of the issue
AttributeError: 'Bot' object has no attribute 'slash_command'
Why? I was trying to reinstall pycord
I use commands.Bot
use a venv it will help
i don't want to use venv
did you ever install any other discord libraries
discordlogger
this can be the issue ig
.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
also try that
nah, it doesn't use bot
if not, just reinstall py-cord
i still have the problem after reinstalling
Traceback (most recent call last): File "timer.py", line 2, in <module> from discord.ext import commands, tasks ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)
That's... a different error entirely
Are you sure it actually installed
Or do you perhaps have a folder called discord
Take a look at the file which got sended here and look for the Letter P
.
`ls /usr/local/lib/python3.8/dist-packages/discord/
application_role_connection.py iterators.py sinks
bot.py monetization.py _typed_dict.py
cog.py onboarding.py types
commands pycache ui
ext scheduled_events.py _version.py
`
I'm aware www, but didn't really feel the need to point it out
xd
did you name a folder commands?
uh wait
nope, i just installed it
You use Python 3.8
eh... is that meant to be the entire folder? It's missing a lot
🤣
How did you install it
python3.8 -m pip install -U py-cord
Try uninstall, make sure the folder doesn't exist, then install again
wtf now it works
Nice
But i got this error PyNaCl library needed in order to use voice
i already have py-cord voice
python3.8 -m pip install "py-cord[voice]"
you should think about upgrading your python somewhat soon
3.8 is out of support this month i believe
i already upgraded but i'm lazy to reinstall all libraries to python3.11
but then using that command installs it to the wrong dir..
i see
wtf
hmm
nope it doesn't work f
you can just create your own file with all the stuff
THE COMMAND > r.txt
why does adding a ctx.defer give me that error ?
Application Command raised an exception: ValueError: I/O operation on closed file
too vague, look at your full traceback
here is the full traceback if you want
but i dont really understand anything of why does that occur tbh
well
it seems that when i put an asyncio.sleep(1) it doesnt give me that error
i think i might have an idea
glancing through, py File "/home/container/Slashs/Casino/flip.py", line 100, in flip await ctx.respond(embed=embed, view=view, file=file)this caused it
...probably
you fucked up something with the file
fair enough
this
@commands.Cog.listener()
async def on_hybrid_command(self, ctx: LumabotContext):
if not await is_command_allowed(ctx):
return
elif not ctx.is_app:
await ctx.trigger_typing()
else:
await ctx.defer()
fuckup
because i think the await ctx.defer() is reach after the real command already start
oh yeah you're defering after respond lol
yeah i think the flip command goes too fast
just dispatch the event earlier no?
so its already invoke before
the on_hybrid_command is dispatch before the command run
eh....
just before the invoke
this
if not await is_command_allowed(ctx):
return
takes too much time i think
it's because events run in async
and because of that the command is invoke before the await ctx.defer()
it would be better to run this function directly
instead of dispatching an event for it
otherwise you've created a race condition
yeah i might create a function instead of dispatch and call it inside the invoke command
i thought about a bot_check like so:
async def bot_check(self, ctx: LumabotContext):
if ctx.is_app:
await ctx.defer()
else:
await ctx.trigger_typing()
return True
however i get for every slash command
Application Command raised an exception: InteractionResponded: This interaction has already been responded to before
full traceback :
but the thing that i dont really understand is that i only defer once in the bot check, so why does it dont send the command as a followup ?
nope only 1 time
can the issue be it update the ctx only in this functiopn
do you have any other bot checks
and so in the invoke it will keep the old one
does it run once for the group/parent and once for the child?
if im not mistaken it shouldn't, and seemingly he's already tested it to run once
so adding print in the bot check only print 1, and also the sub command ping is not even invoke
how can i check tht ?
In your command callback are you using followup? Because defer would count as a response
command is not even invoke
it fail during the invoke
Ah, ok, I thought my answer seemed too simple 
so i did stop to be dumb and yeah its doing the check multiple time
rip
and this is true
bot
test
True
bot ping
test
async def bot_check(self, ctx: LumabotContext):
print(ctx.command.qualified_name)
print("test")
if ctx.is_app:
await ctx.defer()
else:
await ctx.trigger_typing()
print(ctx.response.is_done())
return True
async def bot_check(self, ctx: LumabotContext):
if isinstance(ctx.command, discord.SlashCommandGroup):
return True
if ctx.is_app:
await ctx.defer()
else:
await ctx.trigger_typing()
return True
ehhhhhhh perhaps but that might have an unexpected impact on other commands
maybe, idk, go for it if you want
i'd just check if not ctx.response.is_done()
so this is better ?
i will do that then
how cna i check if the bot is typing already N
i thought ctx.guild.me.is_typing but thats only for DMs i think
like user.is_typing
i wish the doc search would work..
works fine on my end?
Doesn't for me, everything disabled, i'm on the stable docs
since a few days or a week now
try hard refresh
#discussion message
idk what happened but never ran into it myself
nice
i dont think there is a rate limit for the trigger typing so it should not be an issue if its double
glancing around i don't think it exists, but i also don't think there's any errors for doing it multiple times
yeah
Happened to me the other day, idk what would cause it
If I had to guess some docs build caused a desync with whatever version you have cached
Hard refresh is always handy if you run into some inexplicable issue
it still says v0.1 too lol
Yeah versioning broke at some point
Didn't we fix that once already?
Error
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\discord\client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2-PY\cogs\dev\ticketsv2.py", line 47, in on_ready
self.bot.add_view(RatingView())
File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\discord\client.py", line 1972, in add_view
raise ValueError(
ValueError: View is not persistent. Items need to have a custom_id set and View must have no timeout
Code
...
@commands.Cog.listener()
async def on_ready(self):
view = discord.ui.View(timeout=None)
view.add_item(Tickets(self.bot))
view.add_item(CloseButton())
view.add_item(ClaimButton())
view.add_item(CloseReasonButton())
view.add_item(ConfirmButton())
view.add_item(UserSys())
self.bot.add_view(view)
self.bot.add_view(RatingView())
...
class RatingView(View):
def __init__(self, channel=None, guild_id=None, url=None):
super().__init__(timeout=None)
self.channel = channel
self.guild_id = guild_id
self.add_item(TranscriptButton(url))
def disable_rating_buttons(self):
for item in self.children:
if isinstance(item, discord.ui.Button) and item.custom_id and item.custom_id.startswith("rating_"):
item.disabled = True
@discord.ui.button(row=4,
label="1",
style=discord.ButtonStyle.red,
emoji=":star:",
custom_id="rating_1")
async def Rating1(self, button, interaction):
await ticket_db.update_rating(1, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="2",
style=discord.ButtonStyle.red,
emoji=":star:",
custom_id="rating_2")
async def Rating2(self, button, interaction):
await ticket_db.update_rating(2, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="3",
style=discord.ButtonStyle.blurple,
emoji=":star:",
custom_id="rating_3")
async def Rating3(self, button, interaction):
await ticket_db.update_rating(3, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="4",
style=discord.ButtonStyle.green,
emoji=":star:",
custom_id="rating_4")
async def Rating4(self, button, interaction):
await ticket_db.update_rating(4, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="5",
style=discord.ButtonStyle.green,
emoji=":star:",
custom_id="rating_5")
async def Rating5(self, button, interaction):
await ticket_db.update_rating(5, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
class TranscriptButton(discord.ui.Button):
def __init__(self, url):
super().__init__(
label="View Online Transcript",
emoji=":scroll:",
style=discord.enums.ButtonStyle.url,
url=url,
custom_id="interaction:TicketTranscriptButton",
)
When i remove the Transcript button from the ratingView all works without errors
remove custom_id from your URL button
and it's likely you're not passing url at all
if you have an option for url, you shouldn't accept None for it
i edit it so, but the same error
def __init__(self, url=None):
super().__init__(
label="View Online Transcript",
emoji=":scroll:",
style=discord.enums.ButtonStyle.url,
url=url,
)```
are you 100% sure you are actually passing a URL to it that isn't None
async def on_ready(self):
view = discord.ui.View(timeout=None)
view.add_item(Tickets(self.bot))
view.add_item(CloseButton())
view.add_item(ClaimButton())
view.add_item(CloseReasonButton())
view.add_item(ConfirmButton())
view.add_item(UserSys())
self.bot.add_view(view)
self.bot.add_view(RatingView(url=None))```
class RatingView(View):
def __init__(self, channel=None, guild_id=None, url=None):
super().__init__(timeout=None)
self.channel = channel
self.guild_id = guild_id
self.add_item(TranscriptButton(url))
def disable_rating_buttons(self):
for item in self.children:
if isinstance(item, discord.ui.Button) and item.custom_id and item.custom_id.startswith("rating_"):
item.disabled = True
@discord.ui.button(row=4,
label="1",
style=discord.ButtonStyle.red,
emoji="⭐",
custom_id="rating_1")
async def Rating1(self, button, interaction):
await ticket_db.update_rating(1, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="2",
style=discord.ButtonStyle.red,
emoji="⭐",
custom_id="rating_2")
async def Rating2(self, button, interaction):
await ticket_db.update_rating(2, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="3",
style=discord.ButtonStyle.blurple,
emoji="⭐",
custom_id="rating_3")
async def Rating3(self, button, interaction):
await ticket_db.update_rating(3, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="4",
style=discord.ButtonStyle.green,
emoji="⭐",
custom_id="rating_4")
async def Rating4(self, button, interaction):
await ticket_db.update_rating(4, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
@discord.ui.button(row=4,
label="5",
style=discord.ButtonStyle.green,
emoji="⭐",
custom_id="rating_5")
async def Rating5(self, button, interaction):
await ticket_db.update_rating(5, self.guild_id, self.channel)
self.disable_rating_buttons()
await interaction.edit(view=self)
def __init__(self, url=None):
super().__init__(
label="View Online Transcript",
emoji=":scroll:",
style=discord.enums.ButtonStyle.url,
url=url,
)```
this is all
Yeah?
you have to have a url for it to be persistent
why would you even make a url button without a url
but for the start i dont need a url
you need it for the view to exist at all
I don't think I understand you, so what exactly should I do now?
pass a valid URL.........
oh okaysry fpor my bad
(ok tbf, there's not really any reason for is_persistent to require a set URL, but that's besides the point since it's not like we're gonna change that behavior this very instant)
anyway havefun
ok
is it possible to convert a guild name to a id?
if the guild is cached, yes
first question, why do you only have the name?
I send a dm to a user and it only show the name and not the id
if you included it in a formatted string, it'll only show the name
it's likely still a full guild object
i found this idea
guild_name = self.message.embeds[0].author.name
guild_id = discord.utils.get(self.bot.guilds, name=guild_name)
return guild_id```
can you show what you mean
i find a solution
def __init__(self, channel=None, guild_id=None, url=None, guilds=None):
super().__init__(timeout=None)
self.channel = channel
self.guild_id = guild_id
self.guilds = guilds
self.add_item(TranscriptButton(url))
def disable_rating_buttons(self):
for item in self.children:
if isinstance(item, discord.ui.Button) and item.custom_id and item.custom_id.startswith("rating_"):
item.disabled = True
def get_id(self):
return self.message.embeds[0].fields[0].value
def get_guild_id(self):
guild_name = self.message.embeds[0].author.name
guild_id = discord.utils.get(self.guilds.guilds, name=guild_name)
return guild_id
@discord.ui.button(row=4,
label="1",
style=discord.ButtonStyle.red,
emoji=":star:",
custom_id="rating_1")
async def Rating1(self, button, interaction):
ticket_id = self.get_id()
guild_id = self.get_guild_id()
print(guild_id.id)```
what is self.guilds
self.guilds is self.bot
that isn't confusing at all
` @commands.Cog.listener()
async def on_ready(self):
view = discord.ui.View(timeout=None)
view.add_item(Tickets(self.bot))
view.add_item(CloseButton())
view.add_item(ClaimButton())
view.add_item(CloseReasonButton())
view.add_item(ConfirmButton())
view.add_item(UserSys())
self.bot.add_view(view)
self.bot.add_view(RatingView(guilds=self.bot))`
yeah :/
that was an or question
yeah works fine
oh nice
is the url button the last one in the view?
your disable_rating_buttons function is correct because it's editing self.children, but you went in the opposite direction with change_url
if it's the last item, just update self.children[-1].url
the first i mean self.message.components[0].to_dict()
link = url_button["components"][0]["url"]
whichever button it is, just update the necessary index
-1 is last item, 0 is first item etc.
okay i need it to add it to the disable or change url function
wherever you want
okay thx works fine
sick
@lethal loom Can you send the code of TranscriptButton ? Also, use syntax highliting like this please
```python
your_code_here
```
or paste your entire file here
.tag paste
yeah wait
Anyone experiencing this weird bug ?
interactions dead rn
Welcome to Discord's home for real-time and historical data on system performance.
Ok thanks
how should i do to remove the error raise by the paginator timeout trying to update a message that's got deleted ?
What is the error traceback ?
I wanna look into it
i just need to get it again and then i can ;)
just edit the timeout function
do i need to fork to do that ?
nah just override it in your paginator object
similar to how you'd subclass Bot, View and override that stuff
if you don't want to subclass, you could just do paginator.on_timeout = new_timeout_func
i will look at that because it might be interesting to change my paginator
like custom button, adding the view only if there is more than 1 page etc
thanks
and if you don't feel like doing completely new logic you could just try: await super().on_timeout() -> except: pass to completely ignore it
yeah go for it
lol awesome
I've got a discord.Bot subclass. Is it possible to have ApplicationContext.bot be a subclass instead of the Bot superclass, for type checking purposes?
you can create a custom context
and override the return type manually
Here's the custom context example.
Would it be as simple as:
class MyAppCtx(ApplicationContext):
bot: MyBot
?
(and then overriding the method in the bot)
(Looks like yes. Sweet!)
I can’t host my bot cause I keep getting this error ImportError: cannot import name ‘PartialMessageable’ from ‘discord.channel’ (/home/container.local/lib/python3.8/site-packages/discord/channel.py)
What's your py-cord version?
i think the newest version of py-cord and typing-extensions version 3.10.0.2 were the conflict
i just removed specific version for typing-extensions==3.10.0.2 from my requirements.txt file
and that worked
Well, the console literally says that
what can be the cause of
2024-10-12 10:02:10 [WARNING] : Can't keep up, shard ID 3 websocket is 42.0s behind.
Why doesnt the WebAPI cog get loaded?
the setup func in the cog never gets called
This fixes the issue, not sure why
Does the html file really mess everything up?
should not
thats the only thing I've changed since it broke
there is also an s
I was using the folder (s) version before
you wrote self.load_extensions() and not extension()
notice the difference between the string I am passing
One is a folder and one is a file
Either properly read what I send, or let someone who actually cares reply please
dont think it change anything
Well it definetly did, as I said, loading the folder doesnt load any cogs, loading the file works
can you try with
self.load_extension("cogs", recursive=True) ?
doesnt work
but still to your answer
Either properly read what I send, or let someone who actually cares reply please
bot.load_extension has always no s if you are passing only 1 name
and it does not matter that you pass a forlder or not
and since cogs is not *names there should not be an s
cogs is not multiple name so it should not have an s still
so it was still an error even if the other doesnt work
all the s does is loop over it
names would be a list containing a single item
thats not the issue
it shouldve still worked
it doesnt
and I dont even want to argue about it, since its pointless
it would have done each letter of the thing as far as i know
thats not how * works...
also can you try to do
src.cogs ?
because it might try to take it from the root rather than the relative
@frail basin Just to be clear, in what file is your load_extensions located ?
bot class
classes.py is where the bot class is
what error ?
Ok. Where is your client.run() or equivalent located respective to your project root ?
ok thx
remvoe the src. part
you should only need the second line of this
bot.load_extension("src.cogs", recursive=True)
Well it doesnt work for some reason, even though it did before
works for me as long as the main is in the root
yeah exactly what I was thinking
this is how i load my cogs
@frail basin What command do you use to run the bot ?
py main.py
k
It works in the docker container still
can you just try load_extensions("cogs") without recursive? you dont have any folders inside anyway
tf
self.load_extensions("cogs", recursive=True, package=".")
or
self.load_extensions(".cogs", recursive=True)
what happens ?
This one works
do you have an init in one of ur folder ?
no
shouldn't matter
ty 👍
that makes no sense that this works
trying to know why the recursive doesnt work for him without the package
because i tried to reproche the same tree file and it was working without
It does make sense to me
it already uses the path relative to the main file
can you develop ?
Since it runs in src, . references src/. In this case it was trying to load from cogs/ instead of src/cogs/ (ModuleNotFoundError). Vscode gave me similar problems in the past. I thought that explicitly stating that the package we want to import from is . relative to main.py would make it understand it has to look in the src/ folder instead of ./
because he put as cwd with is the root src and not . ?
It's the kind of thing you shouldn't have to do and the computer should do itself so it feels wierd when you do it
during a rate limit, if the bot continue to send requests does that matter ?
Yeah you'll get CF banned
i do think im already cf banned
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.
ok thanks
If you keep spamming requests in this state, discord will CF ban you for 1(?) hour
i'll just stop the vps then
i think i made a too big clear
i should add some lower limit
I mean, the lib handles ratelimits fairly well
Unless you messed with that you shouldnt get CF banned
CF bans are more common on shared hosts
its a first time that i get compltetly kick so i dont really know why rn
If you have multiple bots (shards?) on the same IP
i do have around 10 bots on that ip
and one of them has 4 shards
@fresh sierra use some kind of code profiler and see what function are called the most, to find out what is really using that much, and add some caching wherever possible, ie with redis or smth.
Could be just the fact that he is hosting 10 bots on the same IP
Thats 5 req / second / bot
Which is not much
no i think i found it
in case of an error my bot log a webhook
i forgot that i did put that log to test something
so it did just spam without any handle
v4 IPs are like 2$/IP so you should just buy one from your host tbh
was wanting to check if that was the reason of the blocking code
Even if that wasnt the cause now
im using pterodactyl so i dont really know how i should implements multi ip and if its even possible
i will look at that after
It is
how many ip should i use per bot ?
We generally recommend 20 bots / IP for hobby bots, 10 / IP for small public bots and 1 IP / Bot for medium - large bots
generally
ok so rn 1 ip should be good since i have 1 bot public with around 2k, and 9 others with less than 10 guild each
but i will look at it, maybe put the public bot on another ip
will also have to make some conf for the other ip also refer to the same ndd
You could also buy your /29 since most hosts support BYOIP
It costs like 3-5$ per month which is not that much
Just out of curiosity, ipv6 as well right ?
Well v6 IPs are cheap, but most uplinks do not have their IPv6 infa built out properly
It's just that I can have unlimited free ipv6 with my hosting provider
Again, the only issue with v6 is that its not widely adopted yet
which is a fucking shame because its twenty five years old
its older than fucking 1080p as a resolution
Blocking code
well in my case no blocking code has been detected so you do know other possibilities ?
i have a blocking detector and i got no blocking code detected for 50ms block
shouldnt purge handle itself when trying to delete a message that has already been delete ?
for when we try to clear 100 messages it doesnt stop directly
Would this code work for deleting messages from DMs?
await self.bot.http.delete_message(channel_id=Partial(id=user_id), message_id=Partial(id=message_id))
Partial is just discord.Object
@sage tendon how do you catch error that occurs during an event ?
on_error
in my case it doesnt give me any info, like i got only the name of the event
async def on_error(self, event_method, *args, **kwargs):
print("event:", event_method)
print("args:", args)
print("kwargs:", kwargs)
this only give me trhe event method, arg and kwargs are always emty
not, lol
you dont want to tell me or you dont ?
