Skip to content

Commit 1d18376

Browse files
committed
Add slack integration
1 parent 141ae03 commit 1d18376

File tree

9 files changed

+589
-0
lines changed

9 files changed

+589
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"@jimp/plugin-color": "1.6.0",
8484
"@mdui/icons": "^1.0.3",
8585
"@skyra/jaro-winkler": "1.1.1",
86+
"@slack/web-api": "^7.13.0",
8687
"@xhayper/discord-rpc": "1.3.0",
8788
"async-mutex": "0.5.0",
8889
"bgutils-js": "3.2.0",

pnpm-lock.yaml

Lines changed: 118 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/resources/en.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
}
477477
}
478478
},
479+
"slack-status": {
480+
"description": "Sets your Slack status to the currently playing song",
481+
"menu": {
482+
"set-token": "Set Token",
483+
"token": "Slack API Token",
484+
"clear-activity-after-timeout": "Clear activity after timeout",
485+
"set-inactivity-timeout": "Set inactivity timeout"
486+
},
487+
"name": "Slack Status",
488+
"prompt": {
489+
"set-inactivity-timeout": {
490+
"label": "Enter inactivity timeout in seconds:",
491+
"title": "Set inactivity timeout"
492+
}
493+
}
494+
},
479495
"downloader": {
480496
"backend": {
481497
"dialog": {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Throttle time for progress updates in milliseconds
3+
*/
4+
export const SLACK_PROGRESS_THROTTLE_MS = 15_000;
5+
/**
6+
* Time in milliseconds to wait before sending a time update
7+
*/
8+
export const SLACK_TIME_UPDATE_DEBOUNCE_MS = 5000;
9+
10+
export enum TimerKey {
11+
ClearActivity = 'clearActivity',
12+
UpdateTimeout = 'updateTimeout',
13+
}

src/plugins/slack-status/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { t } from '@/i18n';
2+
import { createPlugin } from '@/utils';
3+
import { backend } from './main';
4+
import { onMenu } from './menu';
5+
6+
export type SlackStatusConfig = {
7+
enabled: boolean;
8+
token: string;
9+
activityTimeoutEnabled?: boolean;
10+
activityTimeoutTime?: number;
11+
};
12+
13+
export default createPlugin({
14+
name: () => t('plugins.slack-status.name'),
15+
description: () => t('plugins.slack-status.description'),
16+
restartNeeded: true,
17+
config: {
18+
enabled: false,
19+
token: '',
20+
activityTimeoutEnabled: true,
21+
activityTimeoutTime: 10 * 60 * 1000,
22+
} as SlackStatusConfig,
23+
menu: onMenu,
24+
backend,
25+
});

0 commit comments

Comments
 (0)