fix: login now uses an object instead of parameters

This commit is contained in:
Crawl 2018-07-03 04:45:24 +02:00
parent a6bd7df5a4
commit f989319bd2
No known key found for this signature in database
GPG key ID: E41A6DB922EC2CFE

View file

@ -46,6 +46,7 @@ let statusBarIcon: StatusBarItem;
// `Activate` is fired when the extension is enabled. This SHOULD only fire once. // `Activate` is fired when the extension is enabled. This SHOULD only fire once.
export function activate(context: ExtensionContext) { export function activate(context: ExtensionContext) {
console.log('[Discord Presence]: Activated!');
// Get the workspace's configuration for "discord". // Get the workspace's configuration for "discord".
config = workspace.getConfiguration('discord'); config = workspace.getConfiguration('discord');
@ -97,6 +98,7 @@ function initRPC(clientID: string, loud?: boolean): void {
// Once the RPC Client is ready, set the activity. // Once the RPC Client is ready, set the activity.
rpc.once('ready', () => { rpc.once('ready', () => {
console.log('[Discord Presence]: Successfully connected to Discord');
// Announce the reconnection // Announce the reconnection
if (loud && !config.get('silent')) window.showInformationMessage('Successfully reconnected to Discord RPC'); if (loud && !config.get('silent')) window.showInformationMessage('Successfully reconnected to Discord RPC');
@ -142,8 +144,9 @@ function initRPC(clientID: string, loud?: boolean): void {
}); });
// Log in to the RPC Client, and check whether or not it errors. // Log in to the RPC Client, and check whether or not it errors.
rpc.login(clientID).catch(async error => { rpc.login({ clientId: clientID }).catch(async error => {
// Check if the client is reconnecting // Check if the client is reconnecting
console.error(`[Discord Presence]: ${error}`);
if (reconnecting) { if (reconnecting) {
// Destroy and dispose of everything after the set reconnect attempts // Destroy and dispose of everything after the set reconnect attempts
if (reconnectCounter >= config.get('reconnectThreshold')) { if (reconnectCounter >= config.get('reconnectThreshold')) {