fix: timeout and default command

This commit is contained in:
Crawl 2018-11-20 21:52:13 +01:00
parent 7be2adf048
commit 449725e300
No known key found for this signature in database
GPG key ID: E41A6DB922EC2CFE
2 changed files with 4 additions and 5 deletions

View file

@ -44,11 +44,9 @@ export default class RPCClient implements Disposable {
this._rpc.once('ready', () => { this._rpc.once('ready', () => {
Logger.log('Successfully connected to Discord.'); Logger.log('Successfully connected to Discord.');
this.statusBarIcon.text = '$(globe) Connected to Discord'; this.statusBarIcon.text = '$(globe) Connected to Discord';
this.statusBarIcon.tooltip = 'Connected to Discord';
setTimeout(() => { setTimeout(() => this.statusBarIcon.text = '$(globe)', 5000);
this.statusBarIcon.text = '$(globe)';
this.statusBarIcon.tooltip = 'Connected to Discord';
}, 10000);
if (activityTimer) clearInterval(activityTimer); if (activityTimer) clearInterval(activityTimer);
this.setActivity(); this.setActivity();
@ -64,6 +62,7 @@ export default class RPCClient implements Disposable {
await this.dispose(); await this.dispose();
this.statusBarIcon.text = '$(plug) Reconnect to Discord'; this.statusBarIcon.text = '$(plug) Reconnect to Discord';
this.statusBarIcon.command = 'discord.reconnect'; this.statusBarIcon.command = 'discord.reconnect';
this.statusBarIcon.tooltip = '';
}); });
await this._rpc.login({ clientId: this._clientId }); await this._rpc.login({ clientId: this._clientId });
} }
@ -74,6 +73,7 @@ export default class RPCClient implements Disposable {
await this._rpc.destroy(); await this._rpc.destroy();
} catch {} } catch {}
this._rpc = null; this._rpc = null;
this.statusBarIcon.tooltip = '';
clearInterval(activityTimer); clearInterval(activityTimer);
} }

View file

@ -11,7 +11,6 @@ import Logger from './structures/Logger';
const statusBarIcon: StatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left); const statusBarIcon: StatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
statusBarIcon.text = '$(pulse) Connecting to Discord...'; statusBarIcon.text = '$(pulse) Connecting to Discord...';
statusBarIcon.command = 'discord.reconnect';
const config = workspace.getConfiguration('discord'); const config = workspace.getConfiguration('discord');
const rpc = new RPCClient(config.get<string>('clientID')!, statusBarIcon); const rpc = new RPCClient(config.get<string>('clientID')!, statusBarIcon);