#Persistant Unique Views
1 messages · Page 1 of 1 (latest)
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/examples/views/persistent.py at master · Pycord-Development/pycord
they should be like this
bot = ...
...
class MyView(...):
...
@bot.slash_command(...)
async def ...:
...
pass it to the view init
mhm
you could also just set the username in the custom id
if that makes stuff simpler
you need to bot.add_view outside the cmd
you should also do this, which allows not using a db
using this self.my_button.custom_id = username in the init
(replace my_button with the function name of your button
and in the callback, use button.custom_id to get the username
.rtfm button.custom
oof
Oof. Then you would need a db
Hmm so store a reference of username with either custom id or message id
I don’t know if this will help. My views were not persistent. But you save the message ID of the view that you send (along with any relevant state information). Upon restart, edit the message with a new View. You don’t need a DB for this. Assuming the data saved is just message IDs, you can probably get away with just pickling the message IDs that you need to edit with a new view upon restart. (I’m sure someone will cry foul and say always use databases to store data, but examine what the most appropriate solution is for your case - all the db overhead might not be needed.)
If this isn’t a valid solution, let me know why. I might need to understand the problem more.
did your issue get solved?