Vencord icon indicating copy to clipboard operation
Vencord copied to clipboard

feat(plugin) allCallTimers: adds timers to all users in guild voice calls

Open Max-Herbold opened this issue 1 year ago • 21 comments

Builds on the idea of the callTimer plugin but adds timers to all users in guild voice calls.


VIEW

image image image

Settings

image

This does not modify any network behavior of Discord it simply grabs updates as they are naturally informed to the client. There is a toggle, Watch Large Guilds to subscribe to all guilds (large guilds are not subscribed automatically), when this is disabled large guilds are usually updated roughly every 7-15 minutes (through passive updates). Since a user naturally subscribes to a guild when they interact with it, if the toggle Watch Large Guilds is enabled, on client load, it acts as if all guilds have been interacted with by a user.

Please let me know if you have any questions or suggestions for improvement.

fixes https://github.com/Max-Herbold/AllCallTimersDiscordPlugin/issues/22

Max-Herbold avatar Jan 27 '24 12:01 Max-Herbold

I think you could use IPC events instead of the interval to handle users joining/switching channels

How it is at the moment works; given it's never necessary to update this more than once a second. I agree it could definitely be run less often to fit more with the theme of Vencord. Where could I find some example how to do/use this? I have 0 experience with IPC events, especially within discord.

As per looks I think it looks kinda bad as the red color doesn't fit very well and it overlaps other things

I also agree. It's less than ideal to move elements around; there is very limited space. When it is inline, a long username will cause ellipsed usernames. Under the username makes it too confusing about who the timer belongs to. There is not enough space to the left of the user image. Where it is now is conditionally free when there are no rendered icons. The icons can still be seen. As for the red, again I agree but if the element doesn't fit cleanly why not go all out?

Max-Herbold avatar Jan 27 '24 13:01 Max-Herbold

For the looks maybe use a clock icon and then put the time in the tooltip if it's okay to be only visible on hover

image (mouse is hovering on the user's clock icon)

Also implemented with a toggle switch setting (because I like not having to move my mouse to see the times). The default setting is with the icon + tooltip.

Max-Herbold avatar Jan 27 '24 16:01 Max-Herbold

I think the default UI/UX is fine now but you should probably make the other view look good too. Maybe make it smaller or somehow integrate it without overlapping and better text color.

Are you working on the IPC implementation? Or should I do it? And a quick heads-up the README.md is still missing

D3SOX avatar Jan 27 '24 16:01 D3SOX

Are you working on the IPC implementation? Or should I do it? And a quick heads-up the README.md is still missing

I was planning to have a look tomorrow but I would love to see what you can do!

Max-Herbold avatar Jan 27 '24 17:01 Max-Herbold

Done: https://github.com/Max-Herbold/Vencord/pull/1

D3SOX avatar Jan 27 '24 18:01 D3SOX

It occurred to me previously but I only realised it was an issue now. VOICE_STATE_UPDATES does not dispatch updates for users in a guild that has not been opened (literally viewed on the client side). This plays into the issue I was trying to fix with https://github.com/Vendicated/Vencord/pull/2132/commits/5ebc2c8819b3fa489ce5e3bcaaa8083d00d65d33. I guess on the first open of a guild discord client bulk updates all users in the guild and then updates them when something actually happens. Essentially; if a guild hasn't been opened and a user moves/joins this is not tracked by VOICE_STATE_UPDATES. (Potentially also there is an issue after a certain period of time of a guild being unopened events stop being dispatched but this is only an intuitive guess that should be checked)

Is it reasonable to use VOICE_STATE_UPDATES to read users in voice channels using the original method?

Max-Herbold avatar Jan 28 '24 00:01 Max-Herbold

Oh yes good catch haven't noticed that. Analyze the format when the client is loaded I don't think the way you do it right now is necessary.

D3SOX avatar Jan 28 '24 00:01 D3SOX

Potentially also there is an issue after a certain period of time of a guild being unopened events stop being dispatched but this is only an intuitive guess that should be checked

I don't think so as this worked for me image

D3SOX avatar Jan 28 '24 00:01 D3SOX

I don't think the way you do it right now is necessary.

True. I think that change (https://github.com/Vendicated/Vencord/commit/5ebc2c8819b3fa489ce5e3bcaaa8083d00d65d33) simply made the issue more complicated.

I can't think of how to track an upopened guild's users

Max-Herbold avatar Jan 28 '24 00:01 Max-Herbold

Hm but it does seem to work for me

D3SOX avatar Jan 28 '24 00:01 D3SOX

Hm but it does seem to work for me

There is the case where a user joins/moves channel that hasn't been opened and they end up without a time (in the userJoinTimes) and therefor no visual timer. ex: image image

Max-Herbold avatar Jan 28 '24 00:01 Max-Herbold

reverted the change to use VoiceStateStore but kept everything else.

https://github.com/Max-Herbold/Vencord/pull/2

Max-Herbold avatar Jan 28 '24 05:01 Max-Herbold

VOICE_STATE_UPDATES does not dispatch updates for users in a guild that has not been opened (literally viewed on the client side)

There is the case where a user joins/moves channel that hasn't been opened and they end up without a time (in the userJoinTimes) and therefor no visual timer.

I can't reproduce this issue with the state of my PR. Can you give me more detailed instructions on how to reproduce it? I have two Discord accounts open. With the Vencord one I'm just at the friends tab and when I log the voice state updates and search for my user ID I can clearly see the update looking fine on initial load (without oldChannelId) and when switching channels

Edit: I could reproduce it now with a large server, investigating

D3SOX avatar Jan 28 '24 12:01 D3SOX

I can't reproduce this issue with the state of my PR. Can you give me more detailed instructions on how to reproduce it? I have two Discord accounts open. With the Vencord one I'm just at the friends tab and when I log the voice state updates and search for my user ID I can clearly see the update looking fine on initial load (without oldChannelId) and when switching channels

After restarting Discord directly into DM's (somewhere other than a guild); I had added a console debug in the IPC only really to look at when it occurrs. Without opening any guilds it never occurred (other than the initial startup). Although this test case was probably exclusive to 10+ servers with 100+ users in voice calls. After opening some of the guilds and returning to DM's updates could then be seen flowing in the console.

Max-Herbold avatar Jan 28 '24 13:01 Max-Herbold

soz for force - wrong branch

Max-Herbold avatar Jan 28 '24 13:01 Max-Herbold

I think I definitely know why it happens and can fix the IPC implementation. Are you on Discord btw?

D3SOX avatar Jan 28 '24 14:01 D3SOX

This is ready to merge.

Max-Herbold avatar Apr 05 '24 14:04 Max-Herbold

Damn, and here was me thinking that I committed a lot

Inbestigator avatar Apr 05 '24 16:04 Inbestigator

This is ready to be merged.

Max-Herbold avatar Apr 25 '24 07:04 Max-Herbold

image did i do something wrong because the build still doesn't work

6faw avatar Aug 19 '24 12:08 6faw

did i do something wrong because the build still doesn't work

Hi, @6faw it looks as though you have copied across the folder AllCallTimers. Unfortunately, this is not sufficient because some changes (refactoring/improvements/additions) were made to internal helper functions. Still waiting for some review/merge from @Vendicated.

You may check here (https://github.com/Max-Herbold/AllCallTimersDiscordPlugin/issues/22) for a temporary solution but this method is probably more effort to maintain for users than it is worth.

Max-Herbold avatar Aug 19 '24 12:08 Max-Herbold