#is there a way to disable all the current active buttons
1 messages · Page 1 of 1 (latest)
For ur db operations you should handle that depending on how you are using in it
For the button you could just use the on_interaction and return a message like bot will restart soon
I think they wanna disable the buttons for the downtime but I don't think this is necessary. Bot restarts are rare and fast enough
yes i want to disable all the buttons. There are stuff in my bot for example a "fight". so i just want to disable all of that before the bot closes
im using asqlite
Disabling all the button are not possible
But using on_interaction to act as they are disable is possible
i see. Thanks !
But this will stop every interaction including the current one
What I mean by not possible is that you would need to fetch each message with view and disabled them which will raise really quickly some rate limit
You technically can for non persistent buttons but it's not officially supported
Actually wait. What's the idea here
Do you want to disable the buttons permanently, or do you want to re-enable them on restart (i.e. are you using persistent views)
i want to disable the buttons permanently 
True that might become an issue if the number of messages are large
Do you use persistent views or not ?
no.
Ok lemme take a look rq then I'll give you something. But no guarantee that it will keep working when pycord updates
Thanks !!
Unless Paillat finds smth I'd do it like Luma said
listen to on_interaction and send a response telling them to re-use whatever command caused that view, or whatever
And optionally fetch the message and disable the button, i don't think this would run you into any ratelimit as i doubt it happens that frequently
that's also a good solution
async def shutdown(bot: discord.Bot):
for message_id, view in bot._connection._view_store._synced_message_views.items():
if view.is_persistent():
continue
view.disable_all_items()
target = view.parent or view.message
if not target:
continue
try:
await target.edit(view=view)
except discord.HTTPException:
logging.exception("Failed to disable view for message ID %d", message_id)
Try this
chained private attribute calls, fun
🫠
.tag close
Done with your help thread?
Please close your own help thread by using </close:1009144375709814897> with @daring dome.
Wouldn’t that lead quite quickly to rate limit ?
