From 44aed45d39d2b29abaa4bd2b70953b29ce525ed7 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Thu, 15 Jul 2021 12:44:08 -0500 Subject: [PATCH] Update discord.js --- bot/awesomescibo.js | 13 +++--- bot/package-lock.json | 98 ++++++++++++++++++++++++++++++++----------- 2 files changed, 81 insertions(+), 30 deletions(-) diff --git a/bot/awesomescibo.js b/bot/awesomescibo.js index f04cdea..f607c9d 100755 --- a/bot/awesomescibo.js +++ b/bot/awesomescibo.js @@ -120,7 +120,7 @@ client.on("guildCreate", (guild) => { '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); const welcomeChannel = guild.channels.cache .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; let score; userScore @@ -228,13 +228,14 @@ function training(subject, interaction) { return; } + console.log(categoryArray); axios .post("https://scibowldb.com/api/questions/random", { categories: categoryArray }) .then((res) => { data = res.data.question; console.log(`${interaction.user.tag} -- ${data.tossup_question} -- ${data.tossup_answer}\n`); 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, { max: 1, 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(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) { @@ -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 (!interaction.isCommand()) return; @@ -546,7 +547,7 @@ client.on("interaction", interaction => { sendHelpMessage(interaction); break; 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; case "rounds": rounds(interaction.options[0].name, interaction); diff --git a/bot/package-lock.json b/bot/package-lock.json index 9030283..dbc0ade 100644 --- a/bot/package-lock.json +++ b/bot/package-lock.json @@ -1,12 +1,12 @@ { "name": "awscibo", - "version": "0.4.1", + "version": "0.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "awscibo", - "version": "0.4.1", + "version": "0.5.1", "license": "Apache 2.0", "dependencies": { "axios": "^0.21.1", @@ -115,6 +115,32 @@ "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": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", @@ -442,26 +468,28 @@ } }, "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==", + "version": "0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e.tgz", + "integrity": "sha512-ttRA/8e/WKHDbGFfED5WlS7gID+kalmNr6iMiWBCvkphQ7kFHiTOVbnj/zX9ksaRaYXp/I38SCQ+qZvLu8DJZg==", + "deprecated": "No longer supported. Install the latest @next release", "engines": { "node": ">=12" } }, "node_modules/discord.js": { "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", "dependencies": { + "@discordjs/builders": "^0.2.0", "@discordjs/collection": "^0.1.6", "@discordjs/form-data": "^3.0.1", - "@sapphire/async-queue": "^1.1.2", - "@types/ws": "^7.4.4", + "@sapphire/async-queue": "^1.1.4", + "@types/ws": "^7.4.5", "abort-controller": "^3.0.0", - "discord-api-types": "^0.18.1", + "discord-api-types": "^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e", "node-fetch": "^2.6.1", - "ws": "^7.4.6" + "ws": "^7.5.1" }, "engines": { "node": ">=14.0.0", @@ -1596,9 +1624,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/ws": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", - "integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", + "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==", "engines": { "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": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", @@ -1948,22 +1997,23 @@ "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" }, "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==" + "version": "0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e.tgz", + "integrity": "sha512-ttRA/8e/WKHDbGFfED5WlS7gID+kalmNr6iMiWBCvkphQ7kFHiTOVbnj/zX9ksaRaYXp/I38SCQ+qZvLu8DJZg==" }, "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", "requires": { + "@discordjs/builders": "^0.2.0", "@discordjs/collection": "^0.1.6", "@discordjs/form-data": "^3.0.1", - "@sapphire/async-queue": "^1.1.2", - "@types/ws": "^7.4.4", + "@sapphire/async-queue": "^1.1.4", + "@types/ws": "^7.4.5", "abort-controller": "^3.0.0", - "discord-api-types": "^0.18.1", + "discord-api-types": "^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e", "node-fetch": "^2.6.1", - "ws": "^7.4.6" + "ws": "^7.5.1" } }, "doctrine": { @@ -2797,9 +2847,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", - "integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", + "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==", "requires": {} }, "yallist": {