Files
mautrix-discord/bridge/bot.go
Gary Kramlich 680f7bdbea A ton of work getting towards dms.
This commit also points to my fork of discordgo which makes it look like the
official client which is the only way to get the actually contents of a dm
when not authorized as a bot.
2022-01-25 23:22:20 -06:00

42 lines
772 B
Go

package bridge
import (
"maunium.net/go/mautrix/id"
)
func (b *Bridge) updateBotProfile() {
cfg := b.Config.Appservice.Bot
// Set the bot's avatar.
if cfg.Avatar != "" {
var err error
var mxc id.ContentURI
if cfg.Avatar == "remove" {
err = b.bot.SetAvatarURL(mxc)
} else {
mxc, err = id.ParseContentURI(cfg.Avatar)
if err == nil {
err = b.bot.SetAvatarURL(mxc)
}
}
b.log.Warnln("failed to update the bot's avatar: %v", err)
}
// Update the bot's display name.
if cfg.Displayname != "" {
var err error
if cfg.Displayname == "remove" {
err = b.bot.SetDisplayName("")
} else {
err = b.bot.SetDisplayName(cfg.Displayname)
}
if err != nil {
b.log.Warnln("failed to update the bot's display name: %v", err)
}
}
}