First commit

This commit is contained in:
2025-04-23 00:04:00 +00:00
commit 2732420294
7 changed files with 153 additions and 0 deletions

32
main.go Executable file
View File

@ -0,0 +1,32 @@
package main
import (
"log"
"os"
"os/signal"
"syscall"
"git.ewnix.net/phlux/discord-gpt-bot/bot"
"git.ewnix.net/phlux/discord-gpt-bot/config"
"github.com/bwmarrin/discordgo"
)
func main() {
dg, err := discordgo.New("Bot " + config.BotToken)
if err != nil {
log.Fatalf("Error creating Discord session: %v", err)
}
err = dg.Open()
if err != nil {
log.Fatalf("Error opening connection: %v", err)
}
defer dg.Close()
bot.Start(dg)
log.Println("Bot is now running. Press CTRL+C to exit.")
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-stop
}