This commit is contained in:
commit
b5a1674dc7
5 changed files with 39 additions and 36 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "equicord",
|
"name": "equicord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.12.9",
|
"version": "1.12.10",
|
||||||
"description": "The other cutest Discord client mod",
|
"description": "The other cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Equicord/Equicord#readme",
|
"homepage": "https://github.com/Equicord/Equicord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export interface MessageReplyOptions {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MessageExtra {
|
export interface MessageOptions {
|
||||||
stickers?: string[];
|
stickers?: string[];
|
||||||
uploads?: Upload[];
|
uploads?: Upload[];
|
||||||
replyOptions: MessageReplyOptions;
|
replyOptions: MessageReplyOptions;
|
||||||
|
|
@ -76,17 +76,17 @@ export interface MessageExtra {
|
||||||
openWarningPopout: (props: any) => any;
|
openWarningPopout: (props: any) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MessageSendListener = (channelId: string, messageObj: MessageObject, extra: MessageExtra) => Promisable<void | { cancel: boolean; }>;
|
export type MessageSendListener = (channelId: string, messageObj: MessageObject, options: MessageOptions) => Promisable<void | { cancel: boolean; }>;
|
||||||
export type MessageEditListener = (channelId: string, messageId: string, messageObj: MessageObject) => Promisable<void | { cancel: boolean; }>;
|
export type MessageEditListener = (channelId: string, messageId: string, messageObj: MessageObject) => Promisable<void | { cancel: boolean; }>;
|
||||||
|
|
||||||
const sendListeners = new Set<MessageSendListener>();
|
const sendListeners = new Set<MessageSendListener>();
|
||||||
const editListeners = new Set<MessageEditListener>();
|
const editListeners = new Set<MessageEditListener>();
|
||||||
|
|
||||||
export async function _handlePreSend(channelId: string, messageObj: MessageObject, extra: MessageExtra, replyOptions: MessageReplyOptions) {
|
export async function _handlePreSend(channelId: string, messageObj: MessageObject, options: MessageOptions, replyOptions: MessageReplyOptions) {
|
||||||
extra.replyOptions = replyOptions;
|
options.replyOptions = replyOptions;
|
||||||
for (const listener of sendListeners) {
|
for (const listener of sendListeners) {
|
||||||
try {
|
try {
|
||||||
const result = await listener(channelId, messageObj, extra);
|
const result = await listener(channelId, messageObj, options);
|
||||||
if (result?.cancel) {
|
if (result?.cancel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,23 @@ export default definePlugin({
|
||||||
description: "Music Controls and Lyrics for multiple services ",
|
description: "Music Controls and Lyrics for multiple services ",
|
||||||
authors: [Devs.Ven, Devs.afn, Devs.KraXen72, Devs.Av32000, Devs.nin0dev, EquicordDevs.thororen, EquicordDevs.vmohammad, Devs.Joona],
|
authors: [Devs.Ven, Devs.afn, Devs.KraXen72, Devs.Av32000, Devs.nin0dev, EquicordDevs.thororen, EquicordDevs.vmohammad, Devs.Joona],
|
||||||
settings,
|
settings,
|
||||||
|
tags: [
|
||||||
|
// Spotify
|
||||||
|
"Spotify",
|
||||||
|
"SpotifyControls",
|
||||||
|
"SpotifyLyrics",
|
||||||
|
// Tidal
|
||||||
|
"Tidal",
|
||||||
|
"TidalControls",
|
||||||
|
"TidalLyrics",
|
||||||
|
// Youtube
|
||||||
|
/* Deprecated RN
|
||||||
|
"Youtube",
|
||||||
|
"YoutubeMusic",
|
||||||
|
"YoutubeMusicControls"
|
||||||
|
*/
|
||||||
|
],
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "this.isCopiedStreakGodlike",
|
find: "this.isCopiedStreakGodlike",
|
||||||
|
|
@ -102,7 +119,15 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
|
if (Settings.plugins?.SpotifyControls?.enabled) {
|
||||||
|
settings.store.showSpotifyControls = true;
|
||||||
|
Settings.plugins.SpotifyControls.enabled = false;
|
||||||
|
}
|
||||||
|
if (Settings.plugins?.SpotifyLyrics?.enabled) {
|
||||||
|
settings.store.showSpotifyLyrics = true;
|
||||||
|
Settings.plugins.SpotifyLyrics.enabled = false;
|
||||||
|
}
|
||||||
await migrateOldLyrics();
|
await migrateOldLyrics();
|
||||||
toggleHoverControls(Settings.plugins.MusicControls.hoverControls);
|
toggleHoverControls(settings.store.hoverControls);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,11 @@
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { disableStyle, enableStyle } from "@api/Styles";
|
import { disableStyle, enableStyle } from "@api/Styles";
|
||||||
import { useAwaiter } from "@utils/react";
|
|
||||||
import { makeRange, OptionType } from "@utils/types";
|
import { makeRange, OptionType } from "@utils/types";
|
||||||
import { Button, Forms, MaskedLink, showToast, Text, Toasts, useMemo } from "@webpack/common";
|
import { Button, Forms, MaskedLink, showToast, Toasts } from "@webpack/common";
|
||||||
|
|
||||||
import hoverOnlyStyle from "./hoverOnly.css?managed";
|
import hoverOnlyStyle from "./hoverOnly.css?managed";
|
||||||
import { clearLyricsCache, getLyricsCount } from "./spotify/lyrics/api";
|
import { clearLyricsCache } from "./spotify/lyrics/api";
|
||||||
import { useLyrics } from "./spotify/lyrics/components/util";
|
|
||||||
import { Provider } from "./spotify/lyrics/providers/types";
|
import { Provider } from "./spotify/lyrics/providers/types";
|
||||||
|
|
||||||
const sliderOptions = {
|
const sliderOptions = {
|
||||||
|
|
@ -24,26 +22,6 @@ export function toggleHoverControls(value: boolean) {
|
||||||
(value ? enableStyle : disableStyle)(hoverOnlyStyle);
|
(value ? enableStyle : disableStyle)(hoverOnlyStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Details() {
|
|
||||||
const { lyricsInfo } = useLyrics();
|
|
||||||
|
|
||||||
const [count, error, loading] = useAwaiter(
|
|
||||||
useMemo(() => getLyricsCount, []),
|
|
||||||
{
|
|
||||||
onError: () => console.error("Failed to get lyrics count"),
|
|
||||||
fallbackValue: null,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Text>Current lyrics provider: {lyricsInfo?.useLyric || "None"}</Text>
|
|
||||||
{loading ? <Text>Loading lyrics count...</Text> : error ? <Text>Failed to get lyrics count</Text> : <Text>Lyrics count: {count}</Text>}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function InstallInstructions() {
|
function InstallInstructions() {
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection>
|
<Forms.FormSection>
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export function insertTextIntoChatInputBox(text: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MessageExtra {
|
interface MessageOptions {
|
||||||
messageReference: Message["messageReference"];
|
messageReference: Message["messageReference"];
|
||||||
allowedMentions: {
|
allowedMentions: {
|
||||||
parse: string[];
|
parse: string[];
|
||||||
|
|
@ -122,8 +122,8 @@ interface MessageExtra {
|
||||||
export function sendMessage(
|
export function sendMessage(
|
||||||
channelId: string,
|
channelId: string,
|
||||||
data: Partial<MessageObject>,
|
data: Partial<MessageObject>,
|
||||||
waitForChannelReady?: boolean,
|
waitForChannelReady = true,
|
||||||
extra?: Partial<MessageExtra>
|
options: Partial<MessageOptions> = {}
|
||||||
) {
|
) {
|
||||||
const messageData = {
|
const messageData = {
|
||||||
content: "",
|
content: "",
|
||||||
|
|
@ -133,7 +133,7 @@ export function sendMessage(
|
||||||
...data
|
...data
|
||||||
};
|
};
|
||||||
|
|
||||||
return MessageActions.sendMessage(channelId, messageData, waitForChannelReady, extra);
|
return MessageActions.sendMessage(channelId, messageData, waitForChannelReady, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue