some small code improvements
This commit is contained in:
@@ -173,7 +173,9 @@ var cmd_form Command = Command{
|
|||||||
Style: discordgo.SuccessButton,
|
Style: discordgo.SuccessButton,
|
||||||
Label: "Submit",
|
Label: "Submit",
|
||||||
Emoji: discordgo.ComponentEmoji{
|
Emoji: discordgo.ComponentEmoji{
|
||||||
Name: "📥",
|
Name: "anim_rocket",
|
||||||
|
ID: "1215740398706757743",
|
||||||
|
Animated: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -27,28 +27,7 @@ var cmd_sticky Command = Command{
|
|||||||
Interact: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
Interact: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
switch i.ApplicationCommandData().Options[0].Name {
|
switch i.ApplicationCommandData().Options[0].Name {
|
||||||
case "add":
|
case "add":
|
||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
jsonStringShowModal(i.Interaction, "sticky_modal", "sticky_modal")
|
||||||
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: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
case "remove":
|
case "remove":
|
||||||
if hasSticky(i.GuildID, i.ChannelID) {
|
if hasSticky(i.GuildID, i.ChannelID) {
|
||||||
s.ChannelMessageDelete(i.ChannelID, getStickyMessageID(i.GuildID, i.ChannelID))
|
s.ChannelMessageDelete(i.ChannelID, getStickyMessageID(i.GuildID, i.ChannelID))
|
||||||
|
35
cmd_tag.go
35
cmd_tag.go
@@ -52,40 +52,7 @@ var cmd_tag Command = Command{
|
|||||||
case "get":
|
case "get":
|
||||||
GetTagCommand(i, i.ApplicationCommandData().Options[0].Options[0])
|
GetTagCommand(i, i.ApplicationCommandData().Options[0].Options[0])
|
||||||
case "add":
|
case "add":
|
||||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
jsonStringShowModal(i.Interaction, "tag_add_modal", "template_general")
|
||||||
Type: discordgo.InteractionResponseModal,
|
|
||||||
Data: &discordgo.InteractionResponseData{
|
|
||||||
CustomID: "tag_add_modal" + i.Interaction.Member.User.ID,
|
|
||||||
Title: "Add a custom tag command",
|
|
||||||
Components: []discordgo.MessageComponent{
|
|
||||||
discordgo.ActionsRow{
|
|
||||||
Components: []discordgo.MessageComponent{
|
|
||||||
discordgo.TextInput{
|
|
||||||
CustomID: "tag_add_modal_name",
|
|
||||||
Label: "Name",
|
|
||||||
Style: discordgo.TextInputShort,
|
|
||||||
Required: true,
|
|
||||||
MaxLength: 20,
|
|
||||||
Value: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
discordgo.ActionsRow{
|
|
||||||
Components: []discordgo.MessageComponent{
|
|
||||||
discordgo.TextInput{
|
|
||||||
CustomID: "tag_add_modal_content",
|
|
||||||
Label: "Content",
|
|
||||||
Placeholder: "Content that gets returned when the tag will be run",
|
|
||||||
Style: discordgo.TextInputParagraph,
|
|
||||||
Required: true,
|
|
||||||
MaxLength: 2000,
|
|
||||||
Value: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
case "remove":
|
case "remove":
|
||||||
removeTag(i.GuildID, i.ApplicationCommandData().Options[0].Options[0].StringValue())
|
removeTag(i.GuildID, i.ApplicationCommandData().Options[0].Options[0].StringValue())
|
||||||
respond(i.Interaction, "Tag removed!", true)
|
respond(i.Interaction, "Tag removed!", true)
|
||||||
|
12
form_templates/sticky_modal.json
Normal file
12
form_templates/sticky_modal.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"form_type": "template_general",
|
||||||
|
"title": "Add a Sticky message",
|
||||||
|
"form": [
|
||||||
|
{
|
||||||
|
"label": "Content",
|
||||||
|
"is_paragraph": true,
|
||||||
|
"required": true,
|
||||||
|
"max_length": 2000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user