Closed yfery closed 7 years ago
Please make sure you're on the latest version - do a git pull
, re-run make install
, and restart weechat. I fixed some bugs surrounding this area a week or two ago.
If the problem still persists, please run /discord debug replace
. This lists all IDs and associated names in the weechat core buffer - check if the
I did a git pull
, reinstall the library and restart weechat.
As usual no problem during the first 24 hours.
When an id mention appears, I look for it into /discord debug replace
list and the id wasn't present
Next I /discord disconnect
then /discord connect
, search again in the debug list and found it : @Cil : <@!106486705636286464>
Is this list refreshed or is this a static list from when I connect to discord?
This seems like a bug in discord-rs. I have no idea how to figure out what's happening, but on weechat-discord's end, it does a simple loop over all members that discord-rs is tracking, there's no filtering or other logic that's specific to weechat-discord. So the lack of a name in /discord debug replace
indicates it's actually missing in discord-rs.
As I'm pretty sure it's not a bug in weechat-discord, I don't know how to offer up a solid repro to the authors of discord-rs to make it actually sanely fixable. I have never ran into this (or at least noticed it), so it's difficult for me to debug. Please let me know if you have any ideas, though!
I'll try to debug it myself, and come back to you if I found someting.
So, I'm not 100% sure.
You loop through the server.members provided by discord-rs. But it seems that this list is populated once (and never upadted). So in my case, whenever a new member comes online, and someone mentions him, libweecord can't find him because the list is outdated.
It's possible to update it by using this function or this one, I don't know the difference between them.
As the author gives a warning to only call it when it is needed, I suggest to call it only when, in your function translating mentions, the user isn't found.
The list is updated upon every member joining and leaving. This bit of code handles a new member joining the server.
My guess right now is that there's possibly some quirky issues around large
-marked servers, since it seems like discord's protocol surrounding them is really overcomplicated. I'm really not sure, though.
OK, so I will continue my research :)
After some testing, the ServerMemberAdd
function is only triggered when a new member is registered on the server. So it doesn't update the member list when known user join the channel.
server.members
is populated only once here at startup, and only connected users are added.
I tried to fix this, but I failed :'(
What do you mean by "join the channel"? All members of a server are in all the server's channels, all the time, and weechat-discord reflects that. The member list should only be updated when users join the server. Users can, however, go "online" and "offline". Weechat-discord takes basically zero note of the online-ness status of a user - so mention replacement works for both online and offline users.
My bad, I haven't used the good terms. I used "join the channel" as "going online".
When you're populating server.members
, you're using sync_servers
function. And the doc says /// Requests a download of online member lists.
So if I understand correctly the doc, as my user list contains only online member, when an offline user is going online is not added to my list.
Aah crap, I typed 21 instead of 27 in that commit. Sorry about that.
That commit was actually intentional :)
I have absolutely no idea what's happening, so I tried a thing, maybe that will help, I don't know. (See the commit message).
When I load plugin, for a couple hours there's no problem, mentions are displayed correctly with @nickname.
But a few hours later, mention came back with <@number>
Is there an option that I missed?
Anyway, thanks for your great job!
PS: my weechat runs for days