5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 18:40:25 +00:00

Add more debugging (discord)

This commit is contained in:
Wim 2017-06-26 23:01:35 +02:00
parent c268e90f49
commit 25ac4c708f

View File

@ -109,7 +109,7 @@ func (b *bdiscord) Send(msg config.Message) error {
flog.Errorf("Could not find channelID for %v", msg.Channel) flog.Errorf("Could not find channelID for %v", msg.Channel)
return nil return nil
} }
if b.Config.WebhookURL == ""{ if b.Config.WebhookURL == "" {
flog.Debugf("Broadcasting using API") flog.Debugf("Broadcasting using API")
b.c.ChannelMessageSend(channelID, msg.Username+msg.Text) b.c.ChannelMessageSend(channelID, msg.Username+msg.Text)
} else { } else {
@ -119,10 +119,10 @@ func (b *bdiscord) Send(msg config.Message) error {
b.webhookToken, b.webhookToken,
true, true,
&discordgo.WebhookParams{ &discordgo.WebhookParams{
Content: msg.Text, Content: msg.Text,
Username: msg.Username, Username: msg.Username,
AvatarURL: msg.Avatar, AvatarURL: msg.Avatar,
}) })
} }
return nil return nil
} }
@ -156,7 +156,7 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
if m.Content == "" { if m.Content == "" {
return return
} }
flog.Debugf("Sending message from %s on %s to gateway", m.Author.Username, b.Account) flog.Debugf("Receiving message %#v", m.Message)
channelName := b.getChannelName(m.ChannelID) channelName := b.getChannelName(m.ChannelID)
if b.UseChannelID { if b.UseChannelID {
channelName = "ID:" + m.ChannelID channelName = "ID:" + m.ChannelID
@ -175,6 +175,7 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
} }
} }
flog.Debugf("Sending message from %s on %s to gateway", m.Author.Username, b.Account)
b.Remote <- config.Message{Username: username, Text: text, Channel: channelName, b.Remote <- config.Message{Username: username, Text: text, Channel: channelName,
Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg", Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg",
UserID: m.Author.ID} UserID: m.Author.ID}