fix: double check if RPC exists or not in commands
This commit is contained in:
parent
b432c06ce9
commit
a54dc0767a
1 changed files with 2 additions and 0 deletions
|
@ -32,12 +32,14 @@ export function activate(context: ExtensionContext) {
|
|||
|
||||
// Register the `discord.enable` command, and set the `enabled` config option to true.
|
||||
const enabler = commands.registerCommand('discord.enable', () => {
|
||||
if (rpc) return;
|
||||
config.update('enabled', true);
|
||||
initRPC(config.get('clientID'));
|
||||
});
|
||||
|
||||
// Register the `discord.disable` command, and set the `enabled` config option to false.
|
||||
const disabler = commands.registerCommand('discord.disable', () => {
|
||||
if (!rpc) return;
|
||||
config.update('enabled', false);
|
||||
eventHandler.dispose();
|
||||
rpc.setActivity({});
|
||||
|
|
Loading…
Reference in a new issue