#Persistent View data

1 messages · Page 1 of 1 (latest)

bronze forge
#

Hello I want to create a logging system so I every time a user sends a message with profanity it'll log an embed with 4 buttons
that do stuff such as kick the user,delete the message etc.
It accepts a user_message,embed as parameter:

class StaffActionsButtons(discord.ui.View):
    def __init__(self, user_message, embed):
        super().__init__(timeout=None)  # Set the timeout to None for persistence
        self.user_message = user_message
        self.embed = embed

So here the problem in order to load the persistent view I need to register the view like so:

@bot.event
async def on_ready():
    bot.add_view(StaffActionsButtons(user_message,embed))

But my view must accept user_message and embed so do I need to save all of the data in a database and then load it in the on_ready function?

unique maple
#

it's possible to store the necessary data inside the embed

#

but you could use a database w/ a persistent view

#

and query it when you get an interaction

bronze forge
unique maple
#

you don't have to

#

you could store it inside the message the buttons are on

#

but i would recommend a database

bronze forge