This commit is contained in:
commit
b5a1674dc7
5 changed files with 39 additions and 36 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "equicord",
|
||||
"private": "true",
|
||||
"version": "1.12.9",
|
||||
"version": "1.12.10",
|
||||
"description": "The other cutest Discord client mod",
|
||||
"homepage": "https://github.com/Equicord/Equicord#readme",
|
||||
"bugs": {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export interface MessageReplyOptions {
|
|||
};
|
||||
}
|
||||
|
||||
export interface MessageExtra {
|
||||
export interface MessageOptions {
|
||||
stickers?: string[];
|
||||
uploads?: Upload[];
|
||||
replyOptions: MessageReplyOptions;
|
||||
|
|
@ -76,17 +76,17 @@ export interface MessageExtra {
|
|||
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; }>;
|
||||
|
||||
const sendListeners = new Set<MessageSendListener>();
|
||||
const editListeners = new Set<MessageEditListener>();
|
||||
|
||||
export async function _handlePreSend(channelId: string, messageObj: MessageObject, extra: MessageExtra, replyOptions: MessageReplyOptions) {
|
||||
extra.replyOptions = replyOptions;
|
||||
export async function _handlePreSend(channelId: string, messageObj: MessageObject, options: MessageOptions, replyOptions: MessageReplyOptions) {
|
||||
options.replyOptions = replyOptions;
|
||||
for (const listener of sendListeners) {
|
||||
try {
|
||||
const result = await listener(channelId, messageObj, extra);
|
||||
const result = await listener(channelId, messageObj, options);
|
||||
if (result?.cancel) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,23 @@ export default definePlugin({
|
|||
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],
|
||||
settings,
|
||||
tags: [
|
||||
// Spotify
|
||||
"Spotify",
|
||||
"SpotifyControls",
|
||||
"SpotifyLyrics",
|
||||
// Tidal
|
||||
"Tidal",
|
||||
"TidalControls",
|
||||
"TidalLyrics",
|
||||
// Youtube
|
||||
/* Deprecated RN
|
||||
"Youtube",
|
||||
"YoutubeMusic",
|
||||
"YoutubeMusicControls"
|
||||
*/
|
||||
],
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: "this.isCopiedStreakGodlike",
|
||||
|
|
@ -102,7 +119,15 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
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();
|
||||
toggleHoverControls(Settings.plugins.MusicControls.hoverControls);
|
||||
toggleHoverControls(settings.store.hoverControls);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,13 +6,11 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { disableStyle, enableStyle } from "@api/Styles";
|
||||
import { useAwaiter } from "@utils/react";
|
||||
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 { clearLyricsCache, getLyricsCount } from "./spotify/lyrics/api";
|
||||
import { useLyrics } from "./spotify/lyrics/components/util";
|
||||
import { clearLyricsCache } from "./spotify/lyrics/api";
|
||||
import { Provider } from "./spotify/lyrics/providers/types";
|
||||
|
||||
const sliderOptions = {
|
||||
|
|
@ -24,26 +22,6 @@ export function toggleHoverControls(value: boolean) {
|
|||
(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() {
|
||||
return (
|
||||
<Forms.FormSection>
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export function insertTextIntoChatInputBox(text: string) {
|
|||
});
|
||||
}
|
||||
|
||||
interface MessageExtra {
|
||||
interface MessageOptions {
|
||||
messageReference: Message["messageReference"];
|
||||
allowedMentions: {
|
||||
parse: string[];
|
||||
|
|
@ -122,8 +122,8 @@ interface MessageExtra {
|
|||
export function sendMessage(
|
||||
channelId: string,
|
||||
data: Partial<MessageObject>,
|
||||
waitForChannelReady?: boolean,
|
||||
extra?: Partial<MessageExtra>
|
||||
waitForChannelReady = true,
|
||||
options: Partial<MessageOptions> = {}
|
||||
) {
|
||||
const messageData = {
|
||||
content: "",
|
||||
|
|
@ -133,7 +133,7 @@ export function sendMessage(
|
|||
...data
|
||||
};
|
||||
|
||||
return MessageActions.sendMessage(channelId, messageData, waitForChannelReady, extra);
|
||||
return MessageActions.sendMessage(channelId, messageData, waitForChannelReady, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue