Change activity to per-channel

This commit is contained in:
Kufat
2022-09-05 20:36:53 -04:00
parent 26bda54e16
commit edbf9c310b
5 changed files with 76 additions and 65 deletions

View File

@@ -36,9 +36,6 @@ type Bdiscord struct {
userMemberMap map[string]*discordgo.Member
nickMemberMap map[string]*discordgo.Member
noEmbedPartUrls bool
noEmbedUrls bool
// Webhook specific logic
useAutoWebhooks bool
transmitter *transmitter.Transmitter
@@ -60,12 +57,6 @@ func New(cfg *bridge.Config) bridge.Bridger {
b.nickMemberMap = make(map[string]*discordgo.Member)
b.channelInfoMap = make(map[string]*config.ChannelInfo)
b.noEmbedPartUrls = b.GetBool(("NoEmbedPartUrls"))
b.noEmbedUrls = b.GetBool(("NoEmbedUrls"))
if b.noEmbedPartUrls && b.noEmbedUrls {
b.Log.Info("NoEmbedUrls supersedes NoEmbedPartUrls")
}
b.useAutoWebhooks = b.GetBool("AutoWebhooks")
if b.useAutoWebhooks {
b.Log.Debug("Using automatic webhooks")
@@ -278,10 +269,6 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
msg.Text = "_" + msg.Text + "_"
}
if b.noEmbedUrls || (msg.Event == config.EventJoinLeave && b.noEmbedPartUrls) {
disableEmbedUrls(&msg.Text)
}
// Handle prefix hint for unthreaded messages.
if msg.ParentNotFound() {
msg.ParentID = ""

View File

@@ -233,11 +233,6 @@ func (b *Bdiscord) splitURL(url string) (string, string, bool) {
return webhookURLSplit[webhookIdxID], webhookURLSplit[webhookIdxToken], true
}
func disableEmbedUrls(msg *string) {
regex := regexp.MustCompile(`(\w+://\S+)`)
*msg = regex.ReplaceAllString(*msg, "<$1>")
}
func enumerateUsernames(s string) []string {
onlySpace := true
for _, r := range s {