Compare commits

...

12 commits

Author SHA1 Message Date
Nick
371b29ca76
Merge 83341f6e3c into 8890c8c6b4 2024-09-05 00:19:52 -06:00
Nick
83341f6e3c
Merge branch 'main' into main 2024-06-28 18:35:59 -07:00
Nick
8f6384a751
Merge branch 'main' into main 2024-06-19 10:05:53 -04:00
Nick
0113739d63
Merge branch 'main' into main 2024-05-15 15:51:46 -04:00
Nick
8fcfb9579a Only show button when in VC 2024-05-15 15:49:48 -04:00
Nick
e8e1a7e6f9
Merge branch 'main' into main 2024-04-27 20:29:42 -04:00
Nick
da73fc17b4
Merge branch 'main' into main 2024-04-24 15:19:28 -04:00
Nick
1ae6c9c0dc
Merge branch 'Vendicated:main' into main 2024-04-15 11:07:57 -04:00
Nick
dd957a2999
Merge branch 'main' into main 2024-04-10 14:02:34 -04:00
Nick
57b397e053 Rename the directory for consistency 2024-04-10 09:04:37 -04:00
Nick
b3598e3a6a Split getVoiceChannelMentions into multiple lines 2024-04-08 14:10:18 -04:00
Nick
f4f2734806 Voice Chat Mention 2024-04-08 12:50:20 -04:00
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,47 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated, nickwoah, and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Menu, UserStore } from "@webpack/common";
import { Channel } from "discord-types/general";
const SortedVoiceStateStore = findByPropsLazy("getVoiceStatesForChannel");
function getVoiceChannelMentions(channel: Channel) {
return SortedVoiceStateStore.getVoiceStatesForChannel(channel)
.filter((value: any) => value.user.id !== UserStore.getCurrentUser().id)
.map((value: any) => {
return `<@${value.user.id}>`;
})
.join(" ");
}
function isInVoiceChannel(channel: Channel) {
return SortedVoiceStateStore.getVoiceStatesForChannel(channel)
.some((value: any) => value.user.id == UserStore.getCurrentUser().id);
}
export default definePlugin({
name: "VoiceChatMention",
description: "Adds a context menu button to put mentions of all users in your voice chat in the text box.",
authors: [Devs.nickwoah],
contextMenus: {
"channel-context"(children, { channel }: { channel: Channel; }) {
if (channel.isVocal() && isInVoiceChannel(channel)) children.push(
<Menu.MenuItem
id="voice-mention-all-users"
label="Mention All Users"
action={async () => {
insertTextIntoChatInputBox(getVoiceChannelMentions(channel));
}}
/>
);
}
}
});

View file

@ -486,6 +486,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "Oleh Polisan", name: "Oleh Polisan",
id: 242305263313485825n id: 242305263313485825n
}, },
nickwoah: {
name: "nickwoah",
id: 644298972420374528n
},
HAHALOSAH: { HAHALOSAH: {
name: "HAHALOSAH", name: "HAHALOSAH",
id: 903418691268513883n id: 903418691268513883n