Skip to content

Commit

Permalink
Merge pull request #179 from Harry-Hopkinson/Show-the-StatusBar-on-Di…
Browse files Browse the repository at this point in the history
…scord-Gateway-Connection-Fail

Show the StatusBar on Discord Gateway Connection Fail.
  • Loading branch information
xhayper committed Feb 23, 2023
2 parents 76cae0c + 46b5ee9 commit 24040f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ export class RPCController {
`Couldn't connect to Discord via RPC: ${error.name}`,
"Reconnect"
));
this.statusBarIcon.text = "$(search-refresh) Reconnect to Discord Gateway";
this.statusBarIcon.command = "vscord.reconnect";
this.statusBarIcon.tooltip = "Reconnect to Discord Gateway";

if (result === "Reconnect") {
commands.executeCommand("vscord.reconnect");
}
this.statusBarIcon.show();
})();
}

Expand Down
5 changes: 4 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ export const registerCommands = (ctx: ExtensionContext) => {
await controller
.login()
.then(async () => await controller.enable())
.catch(() => window.showErrorMessage("Failed to reconnect to Discord Gateway"));
.catch(() => {
window.showErrorMessage("Failed to reconnect to Discord Gateway");
controller.statusBarIcon.text = "$(search-refresh) Reconnect to Discord Gateway";
});
});

const disconnectCommand = commands.registerCommand("vscord.disconnect", async () => {
Expand Down

0 comments on commit 24040f6

Please sign in to comment.