mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-19 17:42:35 +01:00
Check only bridged channels for PermManageWebhooks (discord) (#1001)
* Check only bridged channels for PermManageWebhooks * add note
This commit is contained in:
parent
c0be3e585a
commit
1420f68050
@ -125,12 +125,13 @@ func (b *Bdiscord) Connect() error {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
b.canEditWebhooks = true
|
b.canEditWebhooks = true
|
||||||
for _, channel := range b.channels {
|
for _, info := range b.Channels {
|
||||||
b.Log.Debugf("found channel %#v; verifying PermissionManageWebhooks", channel)
|
id := b.getChannelID(info.Name) // note(qaisjp): this readlocks channelsMutex
|
||||||
perms, permsErr := b.c.State.UserChannelPermissions(userinfo.ID, channel.ID)
|
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
|
manageWebhooks := discordgo.PermissionManageWebhooks
|
||||||
if permsErr != nil || perms&manageWebhooks != manageWebhooks {
|
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
|
b.canEditWebhooks = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user