SolMonitor/main.go

48 lines
795 B
Go
Raw Normal View History

2024-06-18 16:26:10 +02:00
package main
import (
"fmt"
"os"
"github.com/bwmarrin/discordgo"
)
var (
Token string
)
func init() {
Token = os.Getenv("DISCORD_BOT_TOKEN")
if Token == "" {
fmt.Println("No token provided. Please set DISCORD_BOT_TOKEN environment variable.")
os.Exit(1)
}
}
func main() {
dg, err := discordgo.New("Bot " + Token)
if err != nil {
fmt.Println("Error creating Discord session:", err)
return
}
dg.AddHandler(ready)
dg.Identify.Intents = discordgo.IntentsGuilds | discordgo.IntentsGuildMessages
err = dg.Open()
if err != nil {
fmt.Println("Error opening connection:", err)
return
}
fmt.Println("Bot is now running. Press CTRL+C to exit.")
select {}
}
func ready(s *discordgo.Session, event *discordgo.Ready) {
s.UpdateGameStatus(0, "Monitoring addresses")
}