mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-12-01 03:03:48 +00:00
diamondburned
aadcbd0767
* Middleware nameflag * Completed M-Middleware feature * Changed Namer/Descriptor API to CanSetup API
40 lines
604 B
Go
40 lines
604 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/diamondburned/arikawa/bot"
|
|
)
|
|
|
|
// 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{}
|
|
|
|
stop, err := bot.Start(token, commands, func(ctx *bot.Context) error {
|
|
ctx.Prefix = "!"
|
|
|
|
// Subcommand demo, but this can be in another package.
|
|
ctx.MustRegisterSubcommand(&Debug{})
|
|
|
|
return nil
|
|
})
|
|
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
defer stop()
|
|
|
|
log.Println("Bot started")
|
|
|
|
// Automatically block until SIGINT.
|
|
bot.Wait()
|
|
}
|