add commands model
This commit is contained in:
@@ -1,28 +1,38 @@
|
||||
package discord
|
||||
|
||||
import (
|
||||
dsmodel "dorisbot/models/discord"
|
||||
"log"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func messageCreateEvt(s *discordgo.Session, evt *discordgo.MessageCreate) {
|
||||
// skip bot message
|
||||
if evt.Author.ID == client.ID {
|
||||
return
|
||||
}
|
||||
if len(evt.Content) == 0 {
|
||||
return
|
||||
}
|
||||
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)
|
||||
server, err := dsmodel.GetDiscordServerByID(guildID)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
log.Println("get server err :: ", err)
|
||||
return
|
||||
}
|
||||
// log.Println(uinfo.Roles)
|
||||
for _, it := range ginfo {
|
||||
log.Println(":: role :: ", it.ID, it.Name)
|
||||
|
||||
cmd, keyword, payload := parseTextMessage(evt.Content)
|
||||
|
||||
_ = cmd
|
||||
_ = payload
|
||||
if !keyword && server == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user