44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package discord
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
)
|
|
|
|
func messageCreateEvt(s *discordgo.Session, evt *discordgo.MessageCreate) {
|
|
guildID := evt.GuildID
|
|
channelID := evt.ChannelID
|
|
uid := evt.Author.ID
|
|
_ = channelID
|
|
_ = uid
|
|
|
|
ginfo, err := s.GuildRoles(guildID)
|
|
// log.Println("get user info :: ", guildID, uid, evt.Author.Username)
|
|
// uinfo, err := s.GuildMember(guildID, uid)
|
|
if err != nil {
|
|
log.Println(err)
|
|
return
|
|
}
|
|
// log.Println(uinfo.Roles)
|
|
for _, it := range ginfo {
|
|
log.Println(":: role :: ", it.ID, it.Name)
|
|
}
|
|
}
|
|
|
|
func guildMemberAddEvt(s *discordgo.Session, evt *discordgo.GuildMemberAdd) {}
|
|
|
|
func guildMemberRemoveEvt(s *discordgo.Session, evt *discordgo.GuildMemberRemove) {}
|
|
|
|
func rateLimitEvt(s *discordgo.Session, evt *discordgo.RateLimit) {}
|
|
|
|
func connectEvt(s *discordgo.Session, evt *discordgo.Connect) {
|
|
log.Println(":: Connect ::")
|
|
client.connected = true
|
|
}
|
|
|
|
func disconnectEvt(s *discordgo.Session, evt *discordgo.Disconnect) {
|
|
log.Println(":: Disconnect ::")
|
|
client.connected = false
|
|
}
|