1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-19 05:12:48 +00:00
arikawa/_example/advanced_bot/main.go

36 lines
505 B
Go
Raw Normal View History

2020-01-19 06:06:00 +00:00
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 = "!"
return nil
})
if err != nil {
log.Fatalln(err)
}
defer stop()
log.Println("Bot started")
// Automatically block until SIGINT.
bot.Wait()
}