30 lines
545 B
Go
30 lines
545 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"git.kmsign.ru/royalcat/konfachcloud-discord-bot/src/bot"
|
|
)
|
|
|
|
func main() {
|
|
botToken, ok := os.LookupEnv("DISCORD_BOT_TOKEN")
|
|
if !ok {
|
|
panic("DISCORD_BOT_TOKEN env var is not set")
|
|
}
|
|
b, err := bot.Run(bot.Settings{
|
|
BotToken: botToken,
|
|
HashLength: 1,
|
|
DistanceThreshold: 4,
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer b.Close(context.Background())
|
|
|
|
sc := make(chan os.Signal, 1)
|
|
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
|
|
<-sc
|
|
}
|