discord: add nosendjoinpart support

This allows the discord bridge to be configured with `nosendjoinpart`,
preventing discord-originating join/part messages from being send to
other bridged platforms.
This commit is contained in:
Sam Willcocks
2022-06-11 16:55:00 +01:00
parent 3819062574
commit 8f646ad3ba
2 changed files with 9 additions and 3 deletions

View File

@@ -171,6 +171,9 @@ func (b *Bdiscord) memberUpdate(s *discordgo.Session, m *discordgo.GuildMemberUp
}
func (b *Bdiscord) memberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd) {
if b.GetBool("nosendjoinpart") {
return
}
if m.Member == nil {
b.Log.Warnf("Received member update with no member information: %#v", m)
return
@@ -192,6 +195,9 @@ func (b *Bdiscord) memberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd)
}
func (b *Bdiscord) memberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove) {
if b.GetBool("nosendjoinpart") {
return
}
if m.Member == nil {
b.Log.Warnf("Received member update with no member information: %#v", m)
return

View File

@@ -197,7 +197,7 @@ ShowJoinPart=false
VerboseJoinPart=false
#Do not send joins/parts to other bridges
#Currently works for messages from the following bridges: irc, mattermost, slack
#Currently works for messages from the following bridges: irc, mattermost, slack, discord
#OPTIONAL (default false)
NoSendJoinPart=false
@@ -496,7 +496,7 @@ RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
ShowJoinPart=false
#Do not send joins/parts to other bridges
#Currently works for messages from the following bridges: irc, mattermost, slack
#Currently works for messages from the following bridges: irc, mattermost, slack, discord
#OPTIONAL (default false)
NoSendJoinPart=false
@@ -830,7 +830,7 @@ RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
ShowJoinPart=false
#Do not send joins/parts to other bridges
#Currently works for messages from the following bridges: irc, mattermost, slack
#Currently works for messages from the following bridges: irc, mattermost, slack, discord
#OPTIONAL (default false)
NoSendJoinPart=false