Call b.getAllowedMentions on each webhook to allow config hot reloading

This commit is contained in:
Reach
2021-05-05 01:58:30 +02:00
parent b8876523d6
commit a1ee74ad09
2 changed files with 1 additions and 5 deletions

View File

@@ -32,8 +32,6 @@ type Bdiscord struct {
userMemberMap map[string]*discordgo.Member
nickMemberMap map[string]*discordgo.Member
allowedMentions *discordgo.MessageAllowedMentions
// Webhook specific logic
useAutoWebhooks bool
transmitter *transmitter.Transmitter
@@ -45,8 +43,6 @@ func New(cfg *bridge.Config) bridge.Bridger {
b.nickMemberMap = make(map[string]*discordgo.Member)
b.channelInfoMap = make(map[string]*config.ChannelInfo)
b.allowedMentions = b.getAllowedMentions()
b.useAutoWebhooks = b.GetBool("AutoWebhooks")
if b.useAutoWebhooks {
b.Log.Debug("Using automatic webhooks")

View File

@@ -66,7 +66,7 @@ func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordg
Content: msg.Text,
Username: msg.Username,
AvatarURL: msg.Avatar,
AllowedMentions: b.allowedMentions,
AllowedMentions: b.getAllowedMentions(),
},
)
if err != nil {