Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vs-bot

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vs-bot - npm Package Compare versions

Comparing version 1.0.0 to 1.0.8

63

index.js
const fs = require('fs');
const readlineSync = require('readline-sync');
const { Client } = require('discord.js');
const axios = require('axios');
function getToken() {
const token = readlineSync.question('Enter your bot token: ', {
hideEchoBack: true,
});
return token;
function getTokenFromConfig() {
try {
const config = JSON.parse(fs.readFileSync('config.json'));
return config.token;
} catch (error) {
console.error('Error reading token from config file:', error.message);
process.exit(1);
}
}
function startBot() {
const api = readlineSync.question('Enter your API key: ');
axios.post('https://9981-smiithxz-smiithxz-1k6gnygf2zj.ws-eu111.gitpod.io/bots/api', { apiKey: api })
.then(response => {
console.log('API Key valid:', response.data.valid);
const token = readlineSync.question('Enter your bot token: ', {
hideEchoBack: true,
});
saveToken(token);
const { Client, Intents } = require('discord.js');
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
// Ping command
client.on('messageCreate', async message => {
if (message.content.startsWith('!ping')) {
await message.reply('Pong!');
}
});
});
client.login(token);
})
.catch(error => {
console.error('Error:', error);
console.error('API check failed. Please check your API key.');
process.exit(1);
});
}
function saveToken(token) {

@@ -20,17 +57,3 @@ const config = {

function startBot() {
const client = new Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
const config = JSON.parse(fs.readFileSync('config.json'));
const token = config.token;
client.login(token);
}
function setupBot() {
const token = getToken();
saveToken(token);
startBot();

@@ -37,0 +60,0 @@ }

{
"name": "vs-bot",
"version": "1.0.0",
"description": "vs-bot",
"main": "index.js",
"scripts": {
"start": "node ."
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^13.1.0",
"readline-sync": "^1.4.10"
"name": "vs-bot",
"version": "1.0.8",
"description": "A simple VS Code bot npm package",
"main": "index.js",
"scripts": {
"start": "node src/index.js"
},
"keywords": [
"VS Code",
"bot",
"npm package"
],
"author": "criiime",
"license": "MIT",
"dependencies": {
"axios": "^1.6.8",
"fs": "^0.0.1-security"
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc