made simplefun plugin
This commit is contained in:
33
plugin_src/simplefun/cmd_dadjoke.go
Normal file
33
plugin_src/simplefun/cmd_dadjoke.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/disgoorg/disgo/discord"
|
||||
"github.com/disgoorg/disgo/events"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/vaporvee/acecore/cmd"
|
||||
)
|
||||
|
||||
var cmd_dadjoke = cmd.Command{
|
||||
Definition: discord.SlashCommandCreate{
|
||||
Name: "dadjoke",
|
||||
Description: "Gives you a random joke that is as bad as your dad would tell them",
|
||||
Contexts: []discord.InteractionContextType{
|
||||
discord.InteractionContextTypeGuild,
|
||||
discord.InteractionContextTypePrivateChannel,
|
||||
discord.InteractionContextTypeBotDM,
|
||||
},
|
||||
IntegrationTypes: []discord.ApplicationIntegrationType{
|
||||
discord.ApplicationIntegrationTypeGuildInstall,
|
||||
discord.ApplicationIntegrationTypeUserInstall,
|
||||
},
|
||||
},
|
||||
Interact: func(e *events.ApplicationCommandInteractionCreate) {
|
||||
joke := simpleGetFromAPI("joke", "https://icanhazdadjoke.com/").(string)
|
||||
err := e.CreateMessage(discord.NewMessageCreateBuilder().
|
||||
SetContent(joke).
|
||||
Build())
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user