feat: use custom configuration for client ID for those who really know what they are doing which does not include 90% of you
This commit is contained in:
parent
d186b17763
commit
15c4888812
3 changed files with 44 additions and 5 deletions
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
40
package.json
40
package.json
|
@ -20,6 +20,46 @@
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"*"
|
"*"
|
||||||
],
|
],
|
||||||
|
"contributes": {
|
||||||
|
"configuration": [
|
||||||
|
{
|
||||||
|
"title": "Visual Studio Code Discord Configuration",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"discord.clientID": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "383226320970055681",
|
||||||
|
"description": "Only modify this if you know what you are doing (most of you don't)."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/iCrawl/discord-vscode.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/iCrawl/discord-vscode/issues"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"discord",
|
||||||
|
"vscode",
|
||||||
|
"status",
|
||||||
|
"update",
|
||||||
|
"rich",
|
||||||
|
"presence",
|
||||||
|
"rpc",
|
||||||
|
"rich presence"
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
"Other"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/iCrawl/discord-vscode#readme",
|
||||||
|
"icon": "assets/icon.png",
|
||||||
|
"galleryBanner": {
|
||||||
|
"theme": "dark"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord-rpc": "^3.0.0-beta.2"
|
"discord-rpc": "^3.0.0-beta.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import { Client } from 'discord-rpc';
|
import { Client } from 'discord-rpc';
|
||||||
import { basename, extname } from 'path';
|
import { basename, extname } from 'path';
|
||||||
import { ExtensionContext, commands, window, workspace, Uri, TextDocumentChangeEvent } from 'vscode';
|
import { ExtensionContext, commands, window, workspace, Uri, TextDocumentChangeEvent, TextDocument } from 'vscode';
|
||||||
|
|
||||||
export function activate(context: ExtensionContext) {
|
export function activate(context: ExtensionContext) {
|
||||||
const rpc = new Client({ transport: 'ipc' });
|
const rpc = new Client({ transport: 'ipc' });
|
||||||
|
const config = workspace.getConfiguration('discord');
|
||||||
|
|
||||||
rpc.once('ready', () => {
|
rpc.once('ready', () => {
|
||||||
setActivity(rpc);
|
setActivity(rpc);
|
||||||
workspace.onDidChangeTextDocument((e: TextDocumentChangeEvent) => {
|
workspace.onDidChangeTextDocument((e: TextDocumentChangeEvent) => setActivity(rpc));
|
||||||
setActivity(rpc);
|
|
||||||
});
|
});
|
||||||
});
|
rpc.login(config.get('clientID')).catch(error =>
|
||||||
rpc.login('').catch(error =>
|
|
||||||
window.showErrorMessage(`Could not connect to discord via rpc: ${error.message}`)
|
window.showErrorMessage(`Could not connect to discord via rpc: ${error.message}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue