Browse Source

Update discord.js

pull/12/head
Abheek Dhawan 3 years ago
parent
commit
44aed45d39
  1. 13
      bot/awesomescibo.js
  2. 98
      bot/package-lock.json

13
bot/awesomescibo.js

@ -120,7 +120,7 @@ client.on("guildCreate", (guild) => {
'Authorization': config.topggauth 'Authorization': config.topggauth
} }
}; };
axios.post(`https://top.gg/api/bots/${client.user.id}/stats`, { server_count: client.guilds.cache.size }, topggAuthHeader); axios.post(`https://top.gg/api/bots/${client.user.id}/stats`, { server_count: client.guilds.cache.size }, topggAuthHeader).then(response => { console.log(response); })
//guild.commands.set(slashCommands); //guild.commands.set(slashCommands);
const welcomeChannel = guild.channels.cache const welcomeChannel = guild.channels.cache
.find( .find(
@ -170,7 +170,7 @@ async function updateScore(isCorrect, score, authorId) {
} }
} }
function training(subject, interaction) { async function training(subject, interaction) {
const authorId = interaction.user.id; const authorId = interaction.user.id;
let score; let score;
userScore userScore
@ -228,13 +228,14 @@ function training(subject, interaction) {
return; return;
} }
console.log(categoryArray);
axios axios
.post("https://scibowldb.com/api/questions/random", { categories: categoryArray }) .post("https://scibowldb.com/api/questions/random", { categories: categoryArray })
.then((res) => { .then((res) => {
data = res.data.question; data = res.data.question;
console.log(`${interaction.user.tag} -- ${data.tossup_question} -- ${data.tossup_answer}\n`); console.log(`${interaction.user.tag} -- ${data.tossup_question} -- ${data.tossup_answer}\n`);
const messageFilter = (m) => m.author.id === authorId; const messageFilter = (m) => m.author.id === authorId;
interaction.reply(data.tossup_question + `\n\n||Source: ${data.uri}||`).then(() => { interaction.reply({ content: data.tossup_question + `\n\n||Source: ${data.uri}||` }).then(() => {
interaction.channel.awaitMessages(messageFilter, { interaction.channel.awaitMessages(messageFilter, {
max: 1, max: 1,
time: 120000, time: 120000,
@ -299,7 +300,7 @@ function training(subject, interaction) {
} }
}).catch(error => { if (error) interaction.editReply("Sorry, the question timed out waiting for an answer.") }); }).catch(error => { if (error) interaction.editReply("Sorry, the question timed out waiting for an answer.") });
}).catch(console.error); }).catch(console.error);
}).catch(error => { if (error) interaction.reply("Sorry, there was a problem fetching the question. Please try again!") }); }).catch(console.error);
} }
function sendHelpMessage(interaction) { function sendHelpMessage(interaction) {
@ -537,7 +538,7 @@ async function rounds(action, interaction) {
} }
} }
client.on("interaction", interaction => { client.on("interaction", async interaction => {
// If the interaction isn't a slash command, return // If the interaction isn't a slash command, return
if (!interaction.isCommand()) return; if (!interaction.isCommand()) return;
@ -546,7 +547,7 @@ client.on("interaction", interaction => {
sendHelpMessage(interaction); sendHelpMessage(interaction);
break; break;
case "train": case "train":
training(interaction.options[0] ? interaction.options[0].value : null, interaction); training(interaction.options.get("subject") ? interaction.options.get("subject").value : null, interaction);
break; break;
case "rounds": case "rounds":
rounds(interaction.options[0].name, interaction); rounds(interaction.options[0].name, interaction);

98
bot/package-lock.json

@ -1,12 +1,12 @@
{ {
"name": "awscibo", "name": "awscibo",
"version": "0.4.1", "version": "0.5.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "awscibo", "name": "awscibo",
"version": "0.4.1", "version": "0.5.1",
"license": "Apache 2.0", "license": "Apache 2.0",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
@ -115,6 +115,32 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/@discordjs/builders": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.2.0.tgz",
"integrity": "sha512-TVq7NZBCJrrTRc3CfxOr3IdgY5nrtqVxZ7qDUF1mN6LgxIiOldmFxsSwMrQBzLFVmOwqFyNLKCeblley8UpEuw==",
"dependencies": {
"discord-api-types": "^0.18.1",
"tslib": "^2.3.0"
},
"engines": {
"node": ">=14.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@discordjs/builders/node_modules/discord-api-types": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz",
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==",
"engines": {
"node": ">=12"
}
},
"node_modules/@discordjs/builders/node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
},
"node_modules/@discordjs/collection": { "node_modules/@discordjs/collection": {
"version": "0.1.6", "version": "0.1.6",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
@ -442,26 +468,28 @@
} }
}, },
"node_modules/discord-api-types": { "node_modules/discord-api-types": {
"version": "0.18.1", "version": "0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e.tgz",
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==", "integrity": "sha512-ttRA/8e/WKHDbGFfED5WlS7gID+kalmNr6iMiWBCvkphQ7kFHiTOVbnj/zX9ksaRaYXp/I38SCQ+qZvLu8DJZg==",
"deprecated": "No longer supported. Install the latest @next release",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/discord.js": { "node_modules/discord.js": {
"version": "13.0.0-dev", "version": "13.0.0-dev",
"resolved": "git+ssh://git@github.com/discordjs/discord.js.git#b15d825bb3acdf432b94d8413a7a964ccc8734bc", "resolved": "git+ssh://git@github.com/discordjs/discord.js.git#4206e35b2316431c1a009664636dcda85d39fff8",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/builders": "^0.2.0",
"@discordjs/collection": "^0.1.6", "@discordjs/collection": "^0.1.6",
"@discordjs/form-data": "^3.0.1", "@discordjs/form-data": "^3.0.1",
"@sapphire/async-queue": "^1.1.2", "@sapphire/async-queue": "^1.1.4",
"@types/ws": "^7.4.4", "@types/ws": "^7.4.5",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"discord-api-types": "^0.18.1", "discord-api-types": "^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"ws": "^7.4.6" "ws": "^7.5.1"
}, },
"engines": { "engines": {
"node": ">=14.0.0", "node": ">=14.0.0",
@ -1596,9 +1624,9 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "7.5.0", "version": "7.5.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
"integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==", "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==",
"engines": { "engines": {
"node": ">=8.3.0" "node": ">=8.3.0"
}, },
@ -1696,6 +1724,27 @@
} }
} }
}, },
"@discordjs/builders": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.2.0.tgz",
"integrity": "sha512-TVq7NZBCJrrTRc3CfxOr3IdgY5nrtqVxZ7qDUF1mN6LgxIiOldmFxsSwMrQBzLFVmOwqFyNLKCeblley8UpEuw==",
"requires": {
"discord-api-types": "^0.18.1",
"tslib": "^2.3.0"
},
"dependencies": {
"discord-api-types": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz",
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg=="
},
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
},
"@discordjs/collection": { "@discordjs/collection": {
"version": "0.1.6", "version": "0.1.6",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
@ -1948,22 +1997,23 @@
"integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ=="
}, },
"discord-api-types": { "discord-api-types": {
"version": "0.18.1", "version": "0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e.tgz",
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==" "integrity": "sha512-ttRA/8e/WKHDbGFfED5WlS7gID+kalmNr6iMiWBCvkphQ7kFHiTOVbnj/zX9ksaRaYXp/I38SCQ+qZvLu8DJZg=="
}, },
"discord.js": { "discord.js": {
"version": "git+ssh://git@github.com/discordjs/discord.js.git#b15d825bb3acdf432b94d8413a7a964ccc8734bc", "version": "git+ssh://git@github.com/discordjs/discord.js.git#4206e35b2316431c1a009664636dcda85d39fff8",
"from": "discord.js@github:discordjs/discord.js", "from": "discord.js@github:discordjs/discord.js",
"requires": { "requires": {
"@discordjs/builders": "^0.2.0",
"@discordjs/collection": "^0.1.6", "@discordjs/collection": "^0.1.6",
"@discordjs/form-data": "^3.0.1", "@discordjs/form-data": "^3.0.1",
"@sapphire/async-queue": "^1.1.2", "@sapphire/async-queue": "^1.1.4",
"@types/ws": "^7.4.4", "@types/ws": "^7.4.5",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"discord-api-types": "^0.18.1", "discord-api-types": "^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"ws": "^7.4.6" "ws": "^7.5.1"
} }
}, },
"doctrine": { "doctrine": {
@ -2797,9 +2847,9 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}, },
"ws": { "ws": {
"version": "7.5.0", "version": "7.5.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
"integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==", "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==",
"requires": {} "requires": {}
}, },
"yallist": { "yallist": {

Loading…
Cancel
Save