mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
feat: migrate to new plugin api
Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
55
src/plugins/discord/index.ts
Normal file
55
src/plugins/discord/index.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import { createPluginBuilder } from '../utils/builder';
|
||||
|
||||
export type DiscordPluginConfig = {
|
||||
enabled: boolean;
|
||||
/**
|
||||
* If enabled, will try to reconnect to discord every 5 seconds after disconnecting or failing to connect
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
autoReconnect: boolean;
|
||||
/**
|
||||
* If enabled, the discord rich presence gets cleared when music paused after the time specified below
|
||||
*/
|
||||
activityTimoutEnabled: boolean;
|
||||
/**
|
||||
* The time in milliseconds after which the discord rich presence gets cleared when music paused
|
||||
*
|
||||
* @default 10 * 60 * 1000 (10 minutes)
|
||||
*/
|
||||
activityTimoutTime: number;
|
||||
/**
|
||||
* Add a "Play on YouTube Music" button to rich presence
|
||||
*/
|
||||
playOnYouTubeMusic: boolean;
|
||||
/**
|
||||
* Hide the "View App On GitHub" button in the rich presence
|
||||
*/
|
||||
hideGitHubButton: boolean;
|
||||
/**
|
||||
* Hide the "duration left" in the rich presence
|
||||
*/
|
||||
hideDurationLeft: boolean;
|
||||
}
|
||||
|
||||
const builder = createPluginBuilder('discord', {
|
||||
name: 'Discord Rich Presence',
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: false,
|
||||
autoReconnect: true,
|
||||
activityTimoutEnabled: true,
|
||||
activityTimoutTime: 10 * 60 * 1000,
|
||||
playOnYouTubeMusic: true,
|
||||
hideGitHubButton: false,
|
||||
hideDurationLeft: false,
|
||||
} as DiscordPluginConfig,
|
||||
});
|
||||
|
||||
export default builder;
|
||||
|
||||
declare global {
|
||||
interface PluginBuilderList {
|
||||
[builder.id]: typeof builder;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user