Skip to content

Commit

Permalink
add help to slash commands
Browse files Browse the repository at this point in the history
  • Loading branch information
inciner8r committed Mar 3, 2024
1 parent ff59e0c commit 2633a04
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
4 changes: 4 additions & 0 deletions app/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func RegisterCommands() []*discordgo.ApplicationCommand {
},
},
},
{
Name: "help",
Description: "Display available commands",
},
}
return commands
}
36 changes: 18 additions & 18 deletions app/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ func AddHandlers(sess *discordgo.Session) {

}
},
"help": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
helpMessage := "Available commands:\n" +
"1. /generate <prompt>: Generates text based on the provided prompt.\n" +
"2. !airbot upscale <number> (in reply to an image): Upscales the replied image by the specified factor.\n" +
"3. !airbot variation <number> (in reply to an image): Creates variations of the replied image.\n" +
"4. !airbot subtle (in reply to an image): Creates a subtly varied version of the replied image.\n" +
"5. !airbot region (in reply to an image): Creates a regionally varied version of the replied image.\n" +
"6. !airbot strong (in reply to an image): Creates a strongly varied version of the replied image.\n" +
"7. !airbot upscaleSubtle (in reply to an image): Upscales the replied image subtly.\n" +
"8. !airbot upscaleCreative (in reply to an image): Upscales the replied image creatively." +
"9. !airbot gpt <prompt> : Generates a response using GPT based on the provided prompt.\n"
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: helpMessage,
},
})
},
}
const prefix = "!airbot"
sess.AddHandler(func(s *discordgo.Session, i *discordgo.InteractionCreate) {
Expand Down Expand Up @@ -204,23 +222,5 @@ func AddHandlers(sess *discordgo.Session) {
return
}
}

if args[1] == "help" {
const helpMessage = "Available commands:\n" +
"1. /generate <prompt>: Generates text based on the provided prompt.\n" +
"2. /gpt <prompt>: Generates a response using GPT based on the provided prompt.\n" +
"3. !airbot upscale <number> (in reply to an image): Upscales the replied image by the specified factor.\n" +
"4. !airbot variation <number> (in reply to an image): Creates variations of the replied image.\n" +
"5. !airbot subtle (in reply to an image): Creates a subtly varied version of the replied image.\n" +
"6. !airbot region (in reply to an image): Creates a regionally varied version of the replied image.\n" +
"7. !airbot strong (in reply to an image): Creates a strongly varied version of the replied image.\n" +
"8. !airbot upscaleSubtle (in reply to an image): Upscales the replied image subtly.\n" +
"9. !airbot upscaleCreative (in reply to an image): Upscales the replied image creatively."

reply := &discordgo.MessageReference{
MessageID: m.ID,
}
s.ChannelMessageSendReply(m.ChannelID, helpMessage, reply)
}
})
}

0 comments on commit 2633a04

Please sign in to comment.