Fix update ghost info on reaction

This commit is contained in:
Tulir Asokan 2023-02-23 15:09:19 +02:00
parent 4676ec98c4
commit a6c3b84db5
3 changed files with 8 additions and 8 deletions

2
go.mod
View file

@ -34,4 +34,4 @@ require (
maunium.net/go/mauflag v1.0.0 // indirect
)
replace github.com/bwmarrin/discordgo => github.com/beeper/discordgo v0.0.0-20230215201850-32771907474d
replace github.com/bwmarrin/discordgo => github.com/beeper/discordgo v0.0.0-20230223130830-7848603fe535

4
go.sum
View file

@ -1,6 +1,6 @@
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/beeper/discordgo v0.0.0-20230215201850-32771907474d h1:PndQKe7wiuQuVIWepQksfaRWUxZcoh6GWLXfWbdAN3g=
github.com/beeper/discordgo v0.0.0-20230215201850-32771907474d/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
github.com/beeper/discordgo v0.0.0-20230223130830-7848603fe535 h1:xBf8EQ7gMd01Gk9/e5dSrVyJsVkYgqk0Bih5RcRKCUs=
github.com/beeper/discordgo v0.0.0-20230223130830-7848603fe535/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

View file

@ -513,9 +513,9 @@ func (portal *Portal) handleDiscordMessages(msg portalDiscordMessage) {
case *discordgo.MessageDelete:
portal.handleDiscordMessageDelete(msg.user, convertedMsg.Message)
case *discordgo.MessageReactionAdd:
portal.handleDiscordReaction(msg.user, convertedMsg.MessageReaction, true, msg.thread)
portal.handleDiscordReaction(msg.user, convertedMsg.MessageReaction, true, msg.thread, convertedMsg.Member)
case *discordgo.MessageReactionRemove:
portal.handleDiscordReaction(msg.user, convertedMsg.MessageReaction, false, msg.thread)
portal.handleDiscordReaction(msg.user, convertedMsg.MessageReaction, false, msg.thread, nil)
default:
portal.log.Warnln("unknown message type")
}
@ -1929,10 +1929,10 @@ func (portal *Portal) handleMatrixReaction(sender *User, evt *event.Event) {
}
}
func (portal *Portal) handleDiscordReaction(user *User, reaction *discordgo.MessageReaction, add bool, thread *Thread) {
func (portal *Portal) handleDiscordReaction(user *User, reaction *discordgo.MessageReaction, add bool, thread *Thread, member *discordgo.Member) {
puppet := portal.bridge.GetPuppetByID(reaction.UserID)
if reaction.Member != nil && reaction.Member.User != nil {
puppet.UpdateInfo(nil, reaction.Member.User)
if member != nil {
puppet.UpdateInfo(user, member.User)
}
intent := puppet.IntentFor(portal)