Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 79 commits into from

Conversation

Max-Herbold
Copy link

@Max-Herbold Max-Herbold commented Jan 27, 2024

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 Max-Herbold/AllCallTimersDiscordPlugin#22

@Max-Herbold Max-Herbold changed the title Add custom allCallTimers plugin feat(plugin) allCallTimers: adds timers to all users in guild voice calls Jan 27, 2024
Copy link
Contributor

@D3SOX D3SOX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use IPC events instead of the interval to handle users joining/switching channels.
As per looks I think it looks kinda bad as the red color doesn't fit very well and it overlaps other things
Also your plugin is missing a README.md

The data is lost on restart because the plugin is restarted btw :)

@Max-Herbold
Copy link
Author

Max-Herbold commented Jan 27, 2024

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?

Copy link
Contributor

@D3SOX D3SOX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more suggestions:

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

For the IPC implementation just look into other plugins. For example

VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[]; }) {
const myGuildId = SelectedGuildStore.getGuildId();
const myChanId = SelectedChannelStore.getVoiceChannelId();
const myId = UserStore.getCurrentUser().id;
if (ChannelStore.getChannel(myChanId!)?.type === 13 /* Stage Channel */) return;
for (const state of voiceStates) {
const { userId, channelId, oldChannelId } = state;
const isMe = userId === myId;
if (!isMe) {
if (!myChanId) continue;
if (channelId !== myChanId && oldChannelId !== myChanId) continue;
}
const [type, id] = getTypeAndChannelId(state, isMe);
if (!type) continue;
const template = Settings.plugins.VcNarrator[type + "Message"];
const user = isMe && !Settings.plugins.VcNarrator.sayOwnName ? "" : UserStore.getUser(userId).username;
const displayName = user && ((UserStore.getUser(userId) as any).globalName ?? user);
const nickname = user && (GuildMemberStore.getNick(myGuildId, userId) ?? user);
const channel = ChannelStore.getChannel(id).name;
speak(formatText(template, user, channel, displayName, nickname));
// updateStatuses(type, state, isMe);
}
},

The Plugin name doesn't need to be camelCase (also see other plugins for reference)

@Max-Herbold
Copy link
Author

Max-Herbold commented Jan 27, 2024

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.

@D3SOX
Copy link
Contributor

D3SOX commented Jan 27, 2024

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

@Max-Herbold
Copy link
Author

Max-Herbold commented Jan 27, 2024

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!

@D3SOX
Copy link
Contributor

D3SOX commented Jan 27, 2024

Done: Max-Herbold#1

D3SOX added 2 commits January 27, 2024 20:10
component gets remounted so the timer needs to use a fixed start time
@Max-Herbold
Copy link
Author

This is ready to be merged.

Copy link

@kittygirlyy kittygirlyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meow

@6faw
Copy link

6faw commented Aug 19, 2024

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

@Max-Herbold
Copy link
Author

Max-Herbold commented Aug 19, 2024

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 (Max-Herbold/AllCallTimersDiscordPlugin#22) for a temporary solution but this method is probably more effort to maintain for users than it is worth.

@Max-Herbold
Copy link
Author

@Vendicated still awaiting some review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

not functional on vencord
6 participants