Simple slash commands handler for discordgo
This just wraps functions and is based from the examples provided by discordgo and this is made in order to make its api more readable and easier to maintain.
This is usable for simple and basic commands but is still missing some of other features.
go get -u github.com/TheBoringDude/minidis
You can also use a simple boilerplate generator to kickstart a new discord bot project
go install github.com/TheBoringDude/minidis/cli/minidis@latest
package main
import (
"fmt"
"log"
"os"
"github.com/TheBoringDude/minidis"
"github.com/bwmarrin/discordgo"
)
func main() {
bot := minidis.New(os.Getenv("TOKEN"))
// set intents
bot.SetIntents(discordgo.IntentsGuilds | discordgo.IntentsGuildMessages)
bot.OnReady(func(s *discordgo.Session, i *discordgo.Ready) {
log.Println("Bot is ready!")
})
// simple command
bot.AddCommand(minidis.SlashCommandProps{
Command: "ping",
Description: "Simple ping command.",
Execute: func(c *minidis.SlashContext) error {
return c.ReplyString(fmt.Sprintf("Hello **%s**, pong?", c.Author.Username))
},
})
bot.Run()
}
More examples...
© 2022 | TheBoringDude