Add MentionAll to VoiceChatUtils (#829)
* Add QuickCSS editor improvements: always on top and close confirmation * fix(ignoreCalls): filter ongoingRings when ignoring calls * feat(voiceChatUtils): add mention all users action * Update ipcMain.ts * Update ipcMain.ts --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
a8109fbfce
commit
4cdb5f4a7b
2 changed files with 21 additions and 2 deletions
|
|
@ -7,6 +7,7 @@
|
|||
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { insertTextIntoChatInputBox } from "@utils/discord";
|
||||
import definePlugin, { makeRange, OptionType } from "@utils/types";
|
||||
import type { Channel } from "@vencord/discord-types";
|
||||
import { GuildChannelStore, Menu, React, RestAPI, UserStore, VoiceStateStore } from "@webpack/common";
|
||||
|
|
@ -48,6 +49,17 @@ function sendPatch(channel: Channel, body: Record<string, any>, bypass = false)
|
|||
});
|
||||
}
|
||||
|
||||
function mentionVoiceUsers(channel: Channel) {
|
||||
const currentUserId = UserStore.getCurrentUser()?.id;
|
||||
const mentions = Object.values(VoiceStateStore.getVoiceStatesForChannel(channel.id))
|
||||
.map(state => state.userId)
|
||||
.filter((userId, index, arr) => userId && userId !== currentUserId && arr.indexOf(userId) === index)
|
||||
.map(userId => `<@${userId}>`);
|
||||
|
||||
if (mentions.length === 0) return;
|
||||
insertTextIntoChatInputBox(`${mentions.join(" ")} `);
|
||||
}
|
||||
|
||||
interface VoiceChannelContextProps {
|
||||
channel: Channel;
|
||||
}
|
||||
|
|
@ -69,6 +81,13 @@ const VoiceChannelContext: NavContextMenuPatchCallback = (children, { channel }:
|
|||
key="voice-tools"
|
||||
id="voice-tools"
|
||||
>
|
||||
<Menu.MenuItem
|
||||
key="voice-tools-mention-all"
|
||||
id="voice-tools-mention-all"
|
||||
label="Mention all Users"
|
||||
action={() => mentionVoiceUsers(channel)}
|
||||
/>
|
||||
|
||||
<Menu.MenuItem
|
||||
key="voice-tools-disconnect-all"
|
||||
id="voice-tools-disconnect-all"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import "./settings";
|
|||
|
||||
import { debounce } from "@shared/debounce";
|
||||
import { IpcEvents } from "@shared/IpcEvents";
|
||||
import { BrowserWindow, ipcMain, nativeTheme, shell, systemPreferences, app, dialog } from "electron";
|
||||
import { app, BrowserWindow, dialog, ipcMain, nativeTheme, shell, systemPreferences } from "electron";
|
||||
import monacoHtml from "file://monacoWin.html?minify&base64";
|
||||
import { FSWatcher, mkdirSync, readFileSync, watch, writeFileSync } from "fs";
|
||||
import { open, readdir, readFile, unlink } from "fs/promises";
|
||||
|
|
@ -167,7 +167,7 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {
|
|||
await monacoWin.loadURL(`data:text/html;base64,${monacoHtml}`);
|
||||
});
|
||||
|
||||
app.on("before-quit", async (event) => {
|
||||
app.on("before-quit", async event => {
|
||||
if (monacoWin && !monacoWin.isDestroyed() && !monacoWin.isVisible()) {
|
||||
const result = await dialog.showMessageBox({
|
||||
type: "question",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue