continued working on forms
This commit is contained in:
31
cmd_form.go
31
cmd_form.go
@@ -101,22 +101,34 @@ var form_command Command = Command{
|
||||
},
|
||||
})
|
||||
case "add":
|
||||
var optionName string = i.ApplicationCommandData().Options[0].Options[0].Name
|
||||
var optionValue string = i.ApplicationCommandData().Options[0].Options[0].StringValue()
|
||||
if optionName == "" { // handling optional empty
|
||||
optionName = "General"
|
||||
var title string
|
||||
var optionValue string
|
||||
if len(i.ApplicationCommandData().Options[0].Options) == 0 {
|
||||
optionValue = "template_general"
|
||||
} else {
|
||||
optionValue = i.ApplicationCommandData().Options[0].Options[0].StringValue()
|
||||
}
|
||||
switch optionValue {
|
||||
case "template_feedback":
|
||||
title = "Submit Feedback"
|
||||
case "template_ticket":
|
||||
title = "Make a new ticket"
|
||||
case "template_url":
|
||||
title = "Add your URL"
|
||||
case "template_general":
|
||||
title = "Form"
|
||||
}
|
||||
s.ChannelMessageSendComplex(i.ChannelID, &discordgo.MessageSend{
|
||||
Embed: &discordgo.MessageEmbed{
|
||||
Color: hexToDecimal(color["primary"]),
|
||||
Title: optionName,
|
||||
Title: title,
|
||||
Description: "Press the bottom button to open a form popup.",
|
||||
},
|
||||
Components: []discordgo.MessageComponent{
|
||||
discordgo.ActionsRow{
|
||||
Components: []discordgo.MessageComponent{
|
||||
discordgo.Button{
|
||||
CustomID: "form:" + optionValue,
|
||||
CustomID: "form:", //add formID
|
||||
Label: "Submit",
|
||||
Emoji: discordgo.ComponentEmoji{
|
||||
Name: "📥",
|
||||
@@ -126,6 +138,13 @@ var form_command Command = Command{
|
||||
},
|
||||
},
|
||||
})
|
||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: "Successfully added form button!",
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
ComponentIDs: getFormIDs(),
|
||||
|
@@ -29,11 +29,15 @@ func initTables() {
|
||||
PRIMARY KEY (form_id, guild_id)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS formbuttons (
|
||||
form_manage_id TEXT NOT NULL,
|
||||
form_id TEXT NOT NULL,
|
||||
overwrite_title TEXT NOT NULL,
|
||||
message_id TEXT NOT NULL,
|
||||
channel_id TEXT NOT NULL,
|
||||
guild_id TEXT NOT NULL,
|
||||
PRIMARY KEY (form_id, guild_id, channel_id)
|
||||
result_channel_id TEXT NOT NULL,
|
||||
accept_channel_id TEXT NOT NULL,
|
||||
PRIMARY KEY (form_manage_id, form_id)
|
||||
);
|
||||
`
|
||||
|
||||
@@ -175,3 +179,7 @@ func removeSticky(guildID string, channelID string) {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
func addTemplateForm(guildID string, channelID string, formID string, overwriteChannelID string, resultChannelID string, acceptChannelID string) {
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user