mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
Voice Chat Mention
This commit is contained in:
parent
650f4050e1
commit
f4f2734806
2 changed files with 41 additions and 0 deletions
37
src/plugins/voiceChannelMention/index.tsx
Normal file
37
src/plugins/voiceChannelMention/index.tsx
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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");
|
||||||
|
|
||||||
|
async function getVoiceChannelMentions(channel: Channel) {
|
||||||
|
return await SortedVoiceStateStore.getVoiceStatesForChannel(channel).filter((value: any) => value.user.id !== UserStore.getCurrentUser().id).map((value: any) => { return `<@${value.user.id}>`; }).join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "VoiceChatMention",
|
||||||
|
description: "Adds a context menu button to put mentions of all users in a voice chat in the text box.",
|
||||||
|
authors: [Devs.nickwoah],
|
||||||
|
contextMenus: {
|
||||||
|
"channel-context"(children, { channel }: { channel: Channel; }) {
|
||||||
|
if (channel.isVocal()) children.push(
|
||||||
|
<Menu.MenuItem
|
||||||
|
id="voice-mention-all-users"
|
||||||
|
label="Mention All Users"
|
||||||
|
action={async () => {
|
||||||
|
insertTextIntoChatInputBox(await getVoiceChannelMentions(channel));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -425,6 +425,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
newwares: {
|
newwares: {
|
||||||
name: "newwares",
|
name: "newwares",
|
||||||
id: 421405303951851520n
|
id: 421405303951851520n
|
||||||
|
},
|
||||||
|
nickwoah: {
|
||||||
|
name: "nickwoah",
|
||||||
|
id: 644298972420374528n
|
||||||
}
|
}
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue