2020-11-19 20:03:14 +00:00
|
|
|
// Package main demonstrates an advanced bot that uses the bot router library to
|
|
|
|
// make commands.
|
2020-01-19 06:06:00 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
|
2021-06-02 02:53:19 +00:00
|
|
|
"github.com/diamondburned/arikawa/v3/bot"
|
2020-01-19 06:06:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// To run, do `BOT_TOKEN="TOKEN HERE" go run .`
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var token = os.Getenv("BOT_TOKEN")
|
|
|
|
if token == "" {
|
|
|
|
log.Fatalln("No $BOT_TOKEN given.")
|
|
|
|
}
|
|
|
|
|
|
|
|
commands := &Bot{}
|
|
|
|
|
2021-02-24 05:40:44 +00:00
|
|
|
bot.Run(token, commands, func(ctx *bot.Context) error {
|
2020-04-06 20:25:42 +00:00
|
|
|
ctx.HasPrefix = bot.NewPrefix("!", "~")
|
2020-05-15 01:52:15 +00:00
|
|
|
ctx.EditableCommands = true
|
2020-01-24 03:17:03 +00:00
|
|
|
|
|
|
|
// Subcommand demo, but this can be in another package.
|
|
|
|
ctx.MustRegisterSubcommand(&Debug{})
|
|
|
|
|
2020-11-19 20:03:14 +00:00
|
|
|
// The bot package will automatically derive out Gateway intents. It
|
|
|
|
// might not catch everything though, so a ctx.Gateway.AddIntents is
|
|
|
|
// always available.
|
|
|
|
|
2020-01-19 06:06:00 +00:00
|
|
|
return nil
|
|
|
|
})
|
|
|
|
}
|