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" | ||
} | ||
} | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
2097
53
1
+ Addedaxios@^1.6.8
+ Addedfs@^0.0.1-security
+ Addedaxios@1.7.9(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedfs@0.0.1-security(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removeddiscord.js@^13.1.0
- Removedreadline-sync@^1.4.10
- Removed@discordjs/builders@0.16.0(transitive)
- Removed@discordjs/collection@0.7.0(transitive)
- Removed@sapphire/async-queue@1.5.5(transitive)
- Removed@sapphire/shapeshift@3.9.7(transitive)
- Removed@types/node@22.10.2(transitive)
- Removed@types/node-fetch@2.6.12(transitive)
- Removed@types/ws@8.5.13(transitive)
- Removeddiscord-api-types@0.33.50.36.3(transitive)
- Removeddiscord.js@13.17.1(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedlodash@4.17.21(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedreadline-sync@1.4.10(transitive)
- Removedtr46@0.0.3(transitive)
- Removedts-mixer@6.0.4(transitive)
- Removedtslib@2.8.1(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedws@8.18.0(transitive)