New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodecg-io-discord

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodecg-io-discord - npm Package Compare versions

Comparing version

to
0.2.0

extension/index.d.ts

24

discord-schema.json

@@ -9,2 +9,26 @@ {

"description": "The token of your bot"
},
"intents": {
"type": "array",
"description": "The discord intents your bot needs",
"items": {
"type": "string",
"enum": [
"GUILDS",
"GUILD_MEMBERS",
"GUILD_BANS",
"GUILD_EMOJIS_AND_STICKERS",
"GUILD_INTEGRATIONS",
"GUILD_WEBHOOKS",
"GUILD_INVITES",
"GUILD_VOICE_STATES",
"GUILD_PRESENCES",
"GUILD_MESSAGES",
"GUILD_MESSAGE_REACTIONS",
"GUILD_MESSAGE_TYPING",
"DIRECT_MESSAGES",
"DIRECT_MESSAGE_REACTIONS",
"DIRECT_MESSAGE_TYPING"
]
}
}

@@ -11,0 +35,0 @@ },

29

extension/index.js

@@ -8,15 +8,32 @@ "use strict";

};
// All except GUILD_MEMBERS and GUILD_PRESENCES.
const defaultIntents = [
"DIRECT_MESSAGES",
"DIRECT_MESSAGE_REACTIONS",
"DIRECT_MESSAGE_TYPING",
"GUILDS",
"GUILD_BANS",
"GUILD_EMOJIS_AND_STICKERS",
"GUILD_INTEGRATIONS",
"GUILD_INVITES",
"GUILD_MESSAGES",
"GUILD_MESSAGE_REACTIONS",
"GUILD_MESSAGE_TYPING",
"GUILD_VOICE_STATES",
"GUILD_WEBHOOKS",
];
class DiscordService extends nodecg_io_core_1.ServiceBundle {
async validateConfig(config) {
var _a;
const botToken = config.botToken;
const client = new discord_js_1.Client({ partials: ["CHANNEL", "MESSAGE", "REACTION", "GUILD_MEMBER", "USER"] });
const client = new discord_js_1.Client({ intents: (_a = config.intents) !== null && _a !== void 0 ? _a : defaultIntents });
await client.login(botToken);
client.destroy();
return nodecg_io_core_1.emptySuccess();
return (0, nodecg_io_core_1.emptySuccess)();
}
async createClient(config) {
const client = new discord_js_1.Client({ partials: ["CHANNEL", "MESSAGE", "REACTION", "GUILD_MEMBER", "USER"] });
async createClient(config, logger) {
const client = new discord_js_1.Client({ intents: defaultIntents !== null && defaultIntents !== void 0 ? defaultIntents : defaultIntents });
await client.login(config.botToken);
this.nodecg.log.info("Successfully connected to Discord.");
return nodecg_io_core_1.success(client);
logger.info("Successfully connected to Discord.");
return (0, nodecg_io_core_1.success)(client);
}

@@ -23,0 +40,0 @@ stopClient(client) {

{
"name": "nodecg-io-discord",
"version": "0.1.0",
"version": "0.2.0",
"description": "Allows to connect to discord via a discord-bot.",
"homepage": "https://nodecg.io/samples/discord",
"homepage": "https://nodecg.io/RELEASE/samples/discord",
"author": {

@@ -13,10 +13,11 @@ "name": "noeppi_noeppi",

"url": "https://github.com/codeoverflow-org/nodecg-io.git",
"directory": "nodecg-io-discord"
"directory": "services/nodecg-io-discord"
},
"main": "extension",
"scripts": {
"build": "tsc -b",
"watch": "tsc -b -w",
"clean": "tsc -b --clean"
},
"files": [
"**/*.js",
"**/*.js.map",
"**/*.d.ts",
"*.json"
],
"main": "extension/index",
"keywords": [

@@ -29,3 +30,3 @@ "nodecg-io",

"bundleDependencies": {
"nodecg-io-core": "^0.1.0"
"nodecg-io-core": "^0.2.0"
}

@@ -35,11 +36,10 @@ },

"devDependencies": {
"@types/node": "^14.14.33",
"nodecg": "^1.8.1",
"typescript": "^4.2.3"
"@types/node": "^16.11.7",
"nodecg-types": "^1.8.3",
"typescript": "^4.4.4"
},
"dependencies": {
"discord.js": "^12.5.1",
"nodecg-io-core": "^0.1.0"
},
"gitHead": "4c6d149944318ce3bb60715c4335344d81d368b0"
"discord.js": "^13.3.1",
"nodecg-io-core": "^0.2.0"
}
}
{
"extends": "../tsconfig.common.json"
"extends": "../../tsconfig.common.json",
"references": [
{
"path": "../../nodecg-io-core"
}
]
}

Sorry, the diff of this file is not supported yet