GeordieP / LFGBot

(2023) Looking For Group / Inhouse Discord bot
0 stars 0 forks source link

Prevent re-running the setup command in a server #6

Closed GeordieP closed 1 year ago

GeordieP commented 1 year ago

Currently we have protection against registering the same channel more than once, but it would be better to check for the existence of the bot's initial setup message, so a channel isn't "stuck" as registered - ideally, we would be able to re-register if the init message is deleted by a moderator.

registration message:

init command handler changes:

GeordieP commented 1 year ago

There's a snag on this - the API doesn't return a message object for an interaction response.

GeordieP commented 1 year ago

Snag resolved:

After this process, the database keeps track of channels that have had the registration command run in them, as well as the ID of the bot-sent introduction message. We can then use that persisted message ID to ask the API if that message has been deleted, and do logic to prevent unnecessary re-registering as well as any other operations that may need the msg ID (e.g. retroactively editing the init message for all registered channels, to change the text or list new bot features.)