becca-lyria
becca-lyria copied to clipboard
[FEAT] - Add `post` commands
What feature would you like to see?
We want to add a couple of commands that allow server managers to create a post (such as a rules post) through Becca.
The purpose of this is to allow server managers to edit that post, rather than having a user post it and have the user be the only one who can edit it.
We'll need a /post create
command, which takes a channel parameter and the message to post, and a /post edit
command which takes the message link to edit and the new content.
This is unfortunately blocked, until Discord completes the slate2 update and allows multi-line inputs in slash commands.
Additional information
No response
I am unblocking this to take a new approach - rather than waiting for multi-line inputs, these commands should respond with a modal to take the content of the message.
The /post create
command should generate a new message in the provided channel, using the modal response as the content.
The /post edit
command should take a message link argument, confirm that link resolves to a message authored by Becca, then update the message content with the modal response.
Permission Validation:
The permission validation should confirm that the user has the Manage Guild
permission.
This is quite large in scope, as Becca doesn't have an event listener for modals yet - I'm going to open it up for contribution, but feel free to ask questions here or in our Discord server if you get stuck!
I'd like to work on this(haven't worked with a modal yet so this would be kinda fun)
All yours!
For permission validation, would the use of the .setDefaultMemberPermissions()
method in the SlashCommandBuilder
constructor be less preferred to doing a permission check while executing the command and returning an appropriate response from the becca?
We should definitely not set permissions on the command. These can be changed by a server, so we want to validate in the command execution.
I'm having some issues working on the /edit
command.
Should the bot store a link to the message that needs editing inside the modal it sends to the user for the updated content input?
Or is there a way to listen for the modal response inside the same control flow as the /post edit
command handler?
Or maybe it can be stored in the customId for that modal?
Like: edit-content-<MESSAGE-ID>
Yeah - we could shorten the customId to something like pe-12234567687