main.go
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
)
var (
Token string = ""
)
func main() {
dg, err := discordgo.New("Bot " + Token)
if err != nil {
fmt.Println("error creating Discord session,", err)
return
}
dg.AddHandler(listning)
dg.Identify.Intents = discordgo.IntentsGuildMessages
err = dg.Open()
if err != nil {
fmt.Println("error opening connection,", err)
return
}
fmt.Println("+++")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
dg.Close()
}
event handler
package main
import (
"log"
"time"
"github.com/bwmarrin/discordgo"
)
var (
spamChannelId string = ""
botId string = ""
spamStart string = "start listning events..."
)
func listning(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
log.Println("test")
}