mirror of
https://github.com/Xevion/banner.git
synced 2026-01-31 02:23:34 -06:00
Respond to interaction with error feedback on command handler fail
This commit is contained in:
+3
-2
@@ -307,18 +307,19 @@ func DumpResponse(res *http.Response) {
|
||||
|
||||
// ResponseError responds to an interaction with an error message
|
||||
// TODO: Improve with a proper embed and colors
|
||||
func RespondError(session *discordgo.Session, interaction *discordgo.Interaction, message string, err error) {
|
||||
func RespondError(session *discordgo.Session, interaction *discordgo.Interaction, message string, err error) error {
|
||||
// Optional: log the error
|
||||
if err != nil {
|
||||
log.Err(err).Msg(message)
|
||||
}
|
||||
|
||||
session.InteractionRespond(interaction, &discordgo.InteractionResponse{
|
||||
return session.InteractionRespond(interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: message,
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func GetFooter(time time.Time) *discordgo.MessageEmbedFooter {
|
||||
|
||||
Reference in New Issue
Block a user