Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"@jimp/plugin-color": "1.6.0",
"@mdui/icons": "^1.0.3",
"@skyra/jaro-winkler": "1.1.1",
"@slack/web-api": "^7.13.0",
"@xhayper/discord-rpc": "1.3.0",
"async-mutex": "0.5.0",
"bgutils-js": "3.2.0",
Expand Down
118 changes: 118 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/i18n/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,22 @@
}
}
},
"slack-status": {
"description": "Sets your Slack status to the currently playing song",
"menu": {
"set-token": "Set Token",
"token": "Slack API Token",
"clear-activity-after-timeout": "Clear activity after timeout",
"set-inactivity-timeout": "Set inactivity timeout"
},
"name": "Slack Status",
"prompt": {
"set-inactivity-timeout": {
"label": "Enter inactivity timeout in seconds:",
"title": "Set inactivity timeout"
}
}
},
"downloader": {
"backend": {
"dialog": {
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/slack-status/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Throttle time for progress updates in milliseconds
*/
export const SLACK_PROGRESS_THROTTLE_MS = 15_000;
/**
* Time in milliseconds to wait before sending a time update
*/
export const SLACK_TIME_UPDATE_DEBOUNCE_MS = 5000;

export enum TimerKey {
ClearActivity = 'clearActivity',
UpdateTimeout = 'updateTimeout',
}
25 changes: 25 additions & 0 deletions src/plugins/slack-status/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { t } from '@/i18n';
import { createPlugin } from '@/utils';
import { backend } from './main';
import { onMenu } from './menu';

export type SlackStatusConfig = {
enabled: boolean;
token: string;
activityTimeoutEnabled?: boolean;
activityTimeoutTime?: number;
};

export default createPlugin({
name: () => t('plugins.slack-status.name'),
description: () => t('plugins.slack-status.description'),
restartNeeded: true,
config: {
enabled: false,
token: '',
activityTimeoutEnabled: true,
activityTimeoutTime: 10 * 60 * 1000,
} as SlackStatusConfig,
menu: onMenu,
backend,
});
Loading