mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
Add discord rich presence (#72)
This commit is contained in:
parent
2664a80851
commit
244c00c4c6
12 changed files with 391 additions and 7 deletions
28
src/main/preload/discord-rpc.ts
Normal file
28
src/main/preload/discord-rpc.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { SetActivity } from '@xhayper/discord-rpc';
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
const initialize = (clientId: string) => {
|
||||
const client = ipcRenderer.invoke('discord-rpc-initialize', clientId);
|
||||
return client;
|
||||
};
|
||||
|
||||
const clearActivity = () => {
|
||||
ipcRenderer.invoke('discord-rpc-clear-activity');
|
||||
};
|
||||
|
||||
const setActivity = (activity: SetActivity) => {
|
||||
ipcRenderer.invoke('discord-rpc-set-activity', activity);
|
||||
};
|
||||
|
||||
const quit = () => {
|
||||
ipcRenderer.invoke('discord-rpc-quit');
|
||||
};
|
||||
|
||||
export const discordRpc = {
|
||||
clearActivity,
|
||||
initialize,
|
||||
quit,
|
||||
setActivity,
|
||||
};
|
||||
|
||||
export type DiscordRpc = typeof discordRpc;
|
||||
Loading…
Add table
Add a link
Reference in a new issue