Skip to content

Commit

Permalink
disable #activity relay
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
emidoots committed Sep 27, 2023
1 parent c937d3d commit 1901166
Showing 1 changed file with 39 additions and 40 deletions.
79 changes: 39 additions & 40 deletions internal/wrench/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package wrench
import (
"bytes"
"fmt"
"path"
"strings"

"github.com/bwmarrin/discordgo"
Expand Down Expand Up @@ -69,47 +68,47 @@ func (b *Bot) discordOnMessageCreate(s *discordgo.Session, m *discordgo.MessageC
return nil
}

// Relay all activity to the #activity channel
if b.Config.ActivityChannel != "disabled" {
ref := m.Reference()
messageURL := "https://discord.com/channels/" + path.Join(fmt.Sprint(ref.GuildID), fmt.Sprint(ref.ChannelID), fmt.Sprint(ref.MessageID))
// // Relay all activity to the #activity channel
// if b.Config.ActivityChannel != "disabled" {
// ref := m.Reference()
// messageURL := "https://discord.com/channels/" + path.Join(fmt.Sprint(ref.GuildID), fmt.Sprint(ref.ChannelID), fmt.Sprint(ref.MessageID))

isIgnored := false
ignored := []string{
"rocketshedding",
"offtopic",
"github",
"joins",
"system-messages",
"spam",
}
for _, name := range ignored {
if b.discordIsChannel(ref.ChannelID, name) {
isIgnored = true
break
}
}
// isIgnored := false
// ignored := []string{
// "rocketshedding",
// "offtopic",
// "github",
// "joins",
// "system-messages",
// "spam",
// }
// for _, name := range ignored {
// if b.discordIsChannel(ref.ChannelID, name) {
// isIgnored = true
// break
// }
// }

if !isIgnored {
var embeds []*discordgo.MessageEmbed
embeds = append(embeds, &discordgo.MessageEmbed{
Color: 3134534,
Description: fmt.Sprintf("%s\n\n%s", m.Content, messageURL),
Author: &discordgo.MessageEmbedAuthor{
Name: fmt.Sprintf("@%s", m.Author.Username),
URL: messageURL,
IconURL: m.Author.AvatarURL("32"),
},
})
if len(m.Embeds) > 0 {
embeds = append(embeds, m.Embeds...)
}
err := b.discordSendMessageToChannelEmbeds(b.Config.ActivityChannel, embeds)
if err != nil {
b.idLogf("discord-relay", "unable to relay message: %v", err)
}
}
}
// if !isIgnored {
// var embeds []*discordgo.MessageEmbed
// embeds = append(embeds, &discordgo.MessageEmbed{
// Color: 3134534,
// Description: fmt.Sprintf("%s\n\n%s", m.Content, messageURL),
// Author: &discordgo.MessageEmbedAuthor{
// Name: fmt.Sprintf("@%s", m.Author.Username),
// URL: messageURL,
// IconURL: m.Author.AvatarURL("32"),
// },
// })
// if len(m.Embeds) > 0 {
// embeds = append(embeds, m.Embeds...)
// }
// err := b.discordSendMessageToChannelEmbeds(b.Config.ActivityChannel, embeds)
// if err != nil {
// b.idLogf("discord-relay", "unable to relay message: %v", err)
// }
// }
// }

// Handle !wrench comments
fields := strings.Fields(m.Content)
Expand Down

0 comments on commit 1901166

Please sign in to comment.