mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-10 15:13:02 -04:00
Pr Stuff
Co-Authored-By: sadan4 <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
parent
8c2bfea5c0
commit
4f72832ba1
7 changed files with 50 additions and 7 deletions
3
.github/workflows/syncDev.yml
vendored
3
.github/workflows/syncDev.yml
vendored
|
@ -1,4 +1,7 @@
|
||||||
name: Sync Vencord Dev
|
name: Sync Vencord Dev
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
|
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
|
||||||
|
|
3
.github/workflows/syncMain.yml
vendored
3
.github/workflows/syncMain.yml
vendored
|
@ -1,4 +1,7 @@
|
||||||
name: Sync Vencord Main
|
name: Sync Vencord Main
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
|
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
|
||||||
|
|
|
@ -44,11 +44,16 @@ export let OptionalMessageOption: Option = OptPlaceholder;
|
||||||
*/
|
*/
|
||||||
export let RequiredMessageOption: Option = ReqPlaceholder;
|
export let RequiredMessageOption: Option = ReqPlaceholder;
|
||||||
|
|
||||||
|
// Discords command list has random gaps for some reason, which can cause issues while rendering the commands
|
||||||
|
// add this offset too every added command to keep them unique
|
||||||
|
let commandIdOffset: number;
|
||||||
|
|
||||||
export const _init = function (cmds: Command[]) {
|
export const _init = function (cmds: Command[]) {
|
||||||
try {
|
try {
|
||||||
BUILT_IN = cmds;
|
BUILT_IN = cmds;
|
||||||
OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0];
|
OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0];
|
||||||
RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0];
|
RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0];
|
||||||
|
commandIdOffset = Math.abs(BUILT_IN.map(x => +x.id!).toSorted((x, y) => x - y)[0]) - BUILT_IN.length;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds);
|
new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +147,7 @@ export function registerCommand<C extends Command>(command: C, plugin: string) {
|
||||||
command.isVencordCommand = true;
|
command.isVencordCommand = true;
|
||||||
command.untranslatedName ??= command.name;
|
command.untranslatedName ??= command.name;
|
||||||
command.untranslatedDescription ??= command.description;
|
command.untranslatedDescription ??= command.description;
|
||||||
command.id ??= `-${BUILT_IN.length + 1}`;
|
command.id ??= `-${BUILT_IN.length + commandIdOffset + 1}`;
|
||||||
command.applicationId ??= "-1"; // BUILT_IN;
|
command.applicationId ??= "-1"; // BUILT_IN;
|
||||||
command.type ??= ApplicationCommandType.CHAT_INPUT;
|
command.type ??= ApplicationCommandType.CHAT_INPUT;
|
||||||
command.inputType ??= ApplicationCommandInputType.BUILT_IN_TEXT;
|
command.inputType ??= ApplicationCommandInputType.BUILT_IN_TEXT;
|
||||||
|
|
|
@ -81,9 +81,14 @@ export default definePlugin({
|
||||||
],
|
],
|
||||||
|
|
||||||
calculateNameColorForMessageContext(context: any) {
|
calculateNameColorForMessageContext(context: any) {
|
||||||
const id = context?.message?.author?.id;
|
const userId: string | undefined = context?.message?.author?.id;
|
||||||
const colorString = context?.author?.colorString;
|
const colorString = context?.author?.colorString;
|
||||||
const color = calculateNameColorForUser(id);
|
const color = calculateNameColorForUser(userId);
|
||||||
|
|
||||||
|
// color preview in role settings
|
||||||
|
// channel.id is undefined in the role menu
|
||||||
|
if (context?.message?.channel_id === "1337" && userId === "313337")
|
||||||
|
return colorString;
|
||||||
|
|
||||||
if (settings.store.applyColorOnlyInDms && !context?.channel?.isPrivate()) {
|
if (settings.store.applyColorOnlyInDms && !context?.channel?.isPrivate()) {
|
||||||
return colorString;
|
return colorString;
|
||||||
|
|
|
@ -136,7 +136,7 @@ export default definePlugin({
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (data.sinkId != null && data.sinkId !== data.audioContext.sinkId && "setSinkId" in AudioContext.prototype) {
|
if (data.sinkId != null && data.sinkId !== data.audioContext.sinkId && "setSinkId" in AudioContext.prototype) {
|
||||||
// @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/setSinkId
|
// @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/setSinkId
|
||||||
data.audioContext.setSinkId(data.sinkId);
|
data.audioContext.setSinkId(data.sinkId === "default" ? "" : data.sinkId);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.gainNode.gain.value = data._mute
|
data.gainNode.gain.value = data._mute
|
||||||
|
|
24
src/webpack/common/types/utils.d.ts
vendored
24
src/webpack/common/types/utils.d.ts
vendored
|
@ -158,6 +158,30 @@ export interface Clipboard {
|
||||||
SUPPORTS_COPY: boolean;
|
SUPPORTS_COPY: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ApplicationAssets {
|
||||||
|
lastUpdated: number;
|
||||||
|
assets: Record<string, { id: string; name: string; type: number; } & Record<string, any>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationAssetUtils {
|
||||||
|
fetchAssetIds(applicationId: string, e: string[]): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* mp === media proxy
|
||||||
|
*/
|
||||||
|
getAssetFromImageURL(type: "mp" | "youtube" | "spotify" | "twitch", url: string): string;
|
||||||
|
/**
|
||||||
|
* converts an asset string into an image url
|
||||||
|
* @param applicationId the application id if fetching an application asset
|
||||||
|
* @param asset asset id if fetching an application asset, otherwise something like what {@link getAssetFromImageURL} returns
|
||||||
|
* @param size if width and height are not needed, the largest is used. If omitted, no size is used
|
||||||
|
*/
|
||||||
|
getAssetImage(applicationId: string | undefined, assetId: string, size?: number | [width: number, height: number]): undefined | string;
|
||||||
|
/**
|
||||||
|
* @returns assets or undefined
|
||||||
|
*/
|
||||||
|
getAssets(applicationId: string): Promise<undefined | ApplicationAssets>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface NavigationRouter {
|
export interface NavigationRouter {
|
||||||
back(): void;
|
back(): void;
|
||||||
forward(): void;
|
forward(): void;
|
||||||
|
|
|
@ -144,9 +144,12 @@ export const UploadHandler = {
|
||||||
promptToUpload: findByCodeLazy("#{intl::ATTACHMENT_TOO_MANY_ERROR_TITLE}") as (files: File[], channel: Channel, draftType: Number) => void
|
promptToUpload: findByCodeLazy("#{intl::ATTACHMENT_TOO_MANY_ERROR_TITLE}") as (files: File[], channel: Channel, draftType: Number) => void
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ApplicationAssetUtils = findByPropsLazy("fetchAssetIds", "getAssetImage") as {
|
export const ApplicationAssetUtils: t.ApplicationAssetUtils = mapMangledModuleLazy("getAssetImage: size must === [", {
|
||||||
fetchAssetIds: (applicationId: string, e: string[]) => Promise<string[]>;
|
fetchAssetIds: filters.byCode('.startsWith("http:")', ".dispatch({"),
|
||||||
};
|
getAssetFromImageURL: filters.byCode("].serialize(", ',":"'),
|
||||||
|
getAssetImage: filters.byCode("getAssetImage: size must === ["),
|
||||||
|
getAssets: filters.byCode(".assets")
|
||||||
|
});
|
||||||
|
|
||||||
export const Clipboard: t.Clipboard = mapMangledModuleLazy('queryCommandEnabled("copy")', {
|
export const Clipboard: t.Clipboard = mapMangledModuleLazy('queryCommandEnabled("copy")', {
|
||||||
copy: filters.byCode(".copy("),
|
copy: filters.byCode(".copy("),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue