change channel struct

This commit is contained in:
2025-03-20 14:40:52 +09:00
parent d510488d3f
commit 5f9b838af5
2 changed files with 8 additions and 6 deletions

View File

@@ -19,11 +19,11 @@ func Discord(token string, channelId string) *discord {
}
}
func (d *discord) BeginRead(tweetchannel chan<- string) {
func (d *discord) BeginRead(tweetchannel chan<- *discordgo.MessageCreate) {
d.read(tweetchannel)
}
func (d *discord) read(tweetchannel chan<- string) {
func (d *discord) read(tweetchannel chan<- *discordgo.MessageCreate) {
dgsession, err := discordgo.New("Bot " + d.Token)
if err != nil {
return
@@ -31,7 +31,7 @@ func (d *discord) read(tweetchannel chan<- string) {
dgsession.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) {
if m.ChannelID == d.ChannelID && m.Author.ID != s.State.User.ID {
tweetchannel <- m.Content
tweetchannel <- m
}
})
d.dgsession = dgsession