Simple project base
This commit is contained in:
parent
f115b03742
commit
eceb0ecdef
11
go.mod
Normal file
11
go.mod
Normal file
@ -0,0 +1,11 @@
|
||||
module git.directme.in/Joren/SolMonitor
|
||||
|
||||
go 1.22.4
|
||||
|
||||
require github.com/bwmarrin/discordgo v0.28.1
|
||||
|
||||
require (
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
|
||||
)
|
47
main.go
Normal file
47
main.go
Normal file
@ -0,0 +1,47 @@
|
||||
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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user