diff options
author | Qais Patankar <qaisjp@gmail.com> | 2020-02-08 14:13:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 15:13:23 +0100 |
commit | 1420f6805070ed70f4bb60b8abafb96541ff6536 (patch) | |
tree | d68d5dcf19d21e1e77b560614a373bf37c205616 /bridge/discord/discord.go | |
parent | c0be3e585a5ef6c6dc4d517e891fd10bc053c195 (diff) | |
download | matterbridge-msglm-1420f6805070ed70f4bb60b8abafb96541ff6536.tar.gz matterbridge-msglm-1420f6805070ed70f4bb60b8abafb96541ff6536.tar.bz2 matterbridge-msglm-1420f6805070ed70f4bb60b8abafb96541ff6536.zip |
Check only bridged channels for PermManageWebhooks (discord) (#1001)
* Check only bridged channels for PermManageWebhooks
* add note
Diffstat (limited to 'bridge/discord/discord.go')
-rw-r--r-- | bridge/discord/discord.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index d247b951..e81d0783 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -125,12 +125,13 @@ func (b *Bdiscord) Connect() error { } } else { b.canEditWebhooks = true - for _, channel := range b.channels { - b.Log.Debugf("found channel %#v; verifying PermissionManageWebhooks", channel) - perms, permsErr := b.c.State.UserChannelPermissions(userinfo.ID, channel.ID) + for _, info := range b.Channels { + id := b.getChannelID(info.Name) // note(qaisjp): this readlocks channelsMutex + b.Log.Debugf("Verifying PermissionManageWebhooks for %s with ID %s", info.ID, id) + perms, permsErr := b.c.State.UserChannelPermissions(userinfo.ID, id) manageWebhooks := discordgo.PermissionManageWebhooks if permsErr != nil || perms&manageWebhooks != manageWebhooks { - b.Log.Warnf("Can't manage webhooks in channel \"%s\"", channel.Name) + b.Log.Warnf("Can't manage webhooks in channel \"%s\"", info.Name) b.canEditWebhooks = false } } |