some small code improvements

This commit is contained in:
2024-03-10 11:22:03 +01:00
parent 044eeddb64
commit c5603e2cc0
4 changed files with 17 additions and 57 deletions

View File

@@ -27,28 +27,7 @@ var cmd_sticky Command = Command{
Interact: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
switch i.ApplicationCommandData().Options[0].Name {
case "add":
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseModal,
Data: &discordgo.InteractionResponseData{
CustomID: "sticky_modal",
Title: "Sticky message",
Components: []discordgo.MessageComponent{
discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.TextInput{
CustomID: "sticky_modal_text",
Label: "Text",
Style: discordgo.TextInputParagraph,
Placeholder: "The message you want to stick to the bottom of this channel",
Required: true,
MaxLength: 2000,
Value: "",
},
},
},
},
},
})
jsonStringShowModal(i.Interaction, "sticky_modal", "sticky_modal")
case "remove":
if hasSticky(i.GuildID, i.ChannelID) {
s.ChannelMessageDelete(i.ChannelID, getStickyMessageID(i.GuildID, i.ChannelID))