initial
This commit is contained in:
commit
7c610d0477
11 changed files with 399 additions and 0 deletions
28
discordBot/messages.go
Normal file
28
discordBot/messages.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package discordBot
|
||||
|
||||
import (
|
||||
"github.com/disgoorg/disgo/bot"
|
||||
"github.com/disgoorg/disgo/events"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"tg-disc-bot/dto"
|
||||
)
|
||||
|
||||
type messageHandler struct {
|
||||
msgChan chan dto.DiscordDTO
|
||||
}
|
||||
|
||||
func (m *messageHandler) OnEvent(event bot.Event) {
|
||||
if e, ok := event.(*events.MessageCreate); ok {
|
||||
if !e.Message.Author.Bot {
|
||||
message := dto.DiscordDTO{
|
||||
AuthorName: e.Message.Author.Username,
|
||||
Content: e.Message.Content,
|
||||
}
|
||||
|
||||
m.msgChan <- message
|
||||
} else {
|
||||
log.Debug("DS | Bot message, skipping")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue