@ -7,6 +7,10 @@ import (
)
)
func ( b * Bdiscord ) messageDelete ( s * discordgo . Session , m * discordgo . MessageDelete ) { //nolint:unparam
func ( b * Bdiscord ) messageDelete ( s * discordgo . Session , m * discordgo . MessageDelete ) { //nolint:unparam
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring messageDelete because it originates from a different guild" )
return
}
rmsg := config . Message { Account : b . Account , ID : m . ID , Event : config . EventMsgDelete , Text : config . EventMsgDelete }
rmsg := config . Message { Account : b . Account , ID : m . ID , Event : config . EventMsgDelete , Text : config . EventMsgDelete }
rmsg . Channel = b . getChannelName ( m . ChannelID )
rmsg . Channel = b . getChannelName ( m . ChannelID )
@ -17,6 +21,10 @@ func (b *Bdiscord) messageDelete(s *discordgo.Session, m *discordgo.MessageDelet
// TODO(qaisjp): if other bridges support bulk deletions, it could be fanned out centrally
// TODO(qaisjp): if other bridges support bulk deletions, it could be fanned out centrally
func ( b * Bdiscord ) messageDeleteBulk ( s * discordgo . Session , m * discordgo . MessageDeleteBulk ) { //nolint:unparam
func ( b * Bdiscord ) messageDeleteBulk ( s * discordgo . Session , m * discordgo . MessageDeleteBulk ) { //nolint:unparam
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring messageDeleteBulk because it originates from a different guild" )
return
}
for _ , msgID := range m . Messages {
for _ , msgID := range m . Messages {
rmsg := config . Message {
rmsg := config . Message {
Account : b . Account ,
Account : b . Account ,
@ -37,6 +45,10 @@ func (b *Bdiscord) messageEvent(s *discordgo.Session, m *discordgo.Event) {
}
}
func ( b * Bdiscord ) messageTyping ( s * discordgo . Session , m * discordgo . TypingStart ) {
func ( b * Bdiscord ) messageTyping ( s * discordgo . Session , m * discordgo . TypingStart ) {
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring messageTyping because it originates from a different guild" )
return
}
if ! b . GetBool ( "ShowUserTyping" ) {
if ! b . GetBool ( "ShowUserTyping" ) {
return
return
}
}
@ -52,6 +64,10 @@ func (b *Bdiscord) messageTyping(s *discordgo.Session, m *discordgo.TypingStart)
}
}
func ( b * Bdiscord ) messageUpdate ( s * discordgo . Session , m * discordgo . MessageUpdate ) { //nolint:unparam
func ( b * Bdiscord ) messageUpdate ( s * discordgo . Session , m * discordgo . MessageUpdate ) { //nolint:unparam
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring messageUpdate because it originates from a different guild" )
return
}
if b . GetBool ( "EditDisable" ) {
if b . GetBool ( "EditDisable" ) {
return
return
}
}
@ -67,6 +83,10 @@ func (b *Bdiscord) messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdat
}
}
func ( b * Bdiscord ) messageCreate ( s * discordgo . Session , m * discordgo . MessageCreate ) { //nolint:unparam
func ( b * Bdiscord ) messageCreate ( s * discordgo . Session , m * discordgo . MessageCreate ) { //nolint:unparam
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring messageCreate because it originates from a different guild" )
return
}
var err error
var err error
// not relay our own messages
// not relay our own messages
@ -144,6 +164,10 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
}
}
func ( b * Bdiscord ) memberUpdate ( s * discordgo . Session , m * discordgo . GuildMemberUpdate ) {
func ( b * Bdiscord ) memberUpdate ( s * discordgo . Session , m * discordgo . GuildMemberUpdate ) {
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring memberUpdate because it originates from a different guild" )
return
}
if m . Member == nil {
if m . Member == nil {
b . Log . Warnf ( "Received member update with no member information: %#v" , m )
b . Log . Warnf ( "Received member update with no member information: %#v" , m )
}
}
@ -171,6 +195,13 @@ func (b *Bdiscord) memberUpdate(s *discordgo.Session, m *discordgo.GuildMemberUp
}
}
func ( b * Bdiscord ) memberAdd ( s * discordgo . Session , m * discordgo . GuildMemberAdd ) {
func ( b * Bdiscord ) memberAdd ( s * discordgo . Session , m * discordgo . GuildMemberAdd ) {
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring memberAdd because it originates from a different guild" )
return
}
if b . GetBool ( "nosendjoinpart" ) {
return
}
if m . Member == nil {
if m . Member == nil {
b . Log . Warnf ( "Received member update with no member information: %#v" , m )
b . Log . Warnf ( "Received member update with no member information: %#v" , m )
return
return
@ -192,6 +223,13 @@ func (b *Bdiscord) memberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd)
}
}
func ( b * Bdiscord ) memberRemove ( s * discordgo . Session , m * discordgo . GuildMemberRemove ) {
func ( b * Bdiscord ) memberRemove ( s * discordgo . Session , m * discordgo . GuildMemberRemove ) {
if m . GuildID != b . guildID {
b . Log . Debugf ( "Ignoring memberRemove because it originates from a different guild" )
return
}
if b . GetBool ( "nosendjoinpart" ) {
return
}
if m . Member == nil {
if m . Member == nil {
b . Log . Warnf ( "Received member update with no member information: %#v" , m )
b . Log . Warnf ( "Received member update with no member information: %#v" , m )
return
return