From 25c70594319b3ed85f2a7d68d868548df8fdba30 Mon Sep 17 00:00:00 2001 From: TRACTION <19631364+iamtraction@users.noreply.github.com> Date: Mon, 20 May 2024 18:44:57 +0530 Subject: [PATCH 1/6] chore: upgrade dependencies Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com> --- package.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index bbcc2c8a4..9dff49676 100644 --- a/package.json +++ b/package.json @@ -20,37 +20,37 @@ "devDependencies": { "@types/discord-rpc": "^4.0.8", "@types/express": "^4.17.21", - "@types/gamedig": "^4.0.5", + "@types/gamedig": "^5.0.2", "@types/http-errors": "^2.0.4", "@types/jsdom": "^21.1.6", - "@types/node": "^20.10.2", - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "^7.5.0", - "eslint": "^8.55.0", - "typescript": "^5.3.2" + "@types/node": "^20.12.12", + "@typescript-eslint/eslint-plugin": "^7.9.0", + "@typescript-eslint/parser": "^7.9.0", + "eslint": "^8.57.0", + "typescript": "^5.4.5" }, "dependencies": { - "@bastion/tesseract": "^5.1.0", + "@bastion/tesseract": "^5.2.0", "@discordjs/opus": "^0.9.0", "@iamtraction/google-translate": "^2.0.1", "discord-rpc": "^4.0.1", "dotenv": "^16.3.1", "emoji-regex": "^10.3.0", - "gamedig": "^4.2.0", + "gamedig": "^5.0.0", "jsdom": "^24.0.0", "libsodium-wrappers": "^0.7.13", - "mathjs": "^12.1.0", - "openai": "^4.20.1", + "mathjs": "^12.4.2", + "openai": "^4.47.1", "play-dl": "^1.9.7", "r6api.js": "^4.4.1", - "undici": "^6.11.1", + "undici": "^6.18.0", "ytdl-core": "^4.11.5", "ytpl": "^2.3.0" }, "optionalDependencies": { "bufferutil": "^4.0.8", "erlpack": "github:discord/erlpack", - "utf-8-validate": "^6.0.3", + "utf-8-validate": "^6.0.4", "zlib-sync": "^0.1.9" } } From 7d954e4281bb75bfb7f9f79c5c9f24152ecc05bc Mon Sep 17 00:00:00 2001 From: TRACTION <19631364+iamtraction@users.noreply.github.com> Date: Mon, 20 May 2024 18:45:31 +0530 Subject: [PATCH 2/6] commands(gameserver): changes w.r.t. gamedig v5 Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com> --- src/commands/gameserver.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/commands/gameserver.ts b/src/commands/gameserver.ts index 9cc17a3be..1e525e84a 100644 --- a/src/commands/gameserver.ts +++ b/src/commands/gameserver.ts @@ -4,18 +4,10 @@ */ import { ApplicationCommandOptionType, ChatInputCommandInteraction } from "discord.js"; import { Command } from "@bastion/tesseract"; -import gamedig from "gamedig"; +import { GameDig } from "gamedig"; import { COLORS } from "../utils/constants.js"; -interface Player extends gamedig.Player { - time?: number; - raw?: { - frags?: number; - ping?: number; - }; -} - class GameServerCommand extends Command { constructor() { super({ @@ -52,8 +44,8 @@ class GameServerCommand extends Command { const port = interaction.options.getInteger("port"); // fetch data from the game server - const server = await gamedig.query({ - type: game as gamedig.Type, + const server = await GameDig.query({ + type: game, host: hostname, port: port, }); @@ -87,12 +79,10 @@ class GameServerCommand extends Command { server.players ? server.players .filter(player => player.name) - .sort((a: Player, b: Player) => b.time - a.time) .sort((a, b) => b.score - a.score) - .sort((a: Player, b: Player) => b.raw?.frags - a.raw?.frags) - .map((player: Player) => ({ + .map(player => ({ name: (player.team ? "[" + player.team + "]" : "") + player.name, - value: "```\nSCORE " + (player.score || player.raw?.frags || 0) + ((player.ping || player.raw?.ping) ? "\tPING " + (player.ping || player.raw?.ping) + "ms" : "") + (player.time ? "\t" + (player.time / 60).toFixed(2) + " minutes" : "") + "```", + value: "```\nSCORE " + (player.score || 0) + (player.team ? "\tTEAM " + player.team : "") + (player.ping ? "\tPING " + player.ping + "ms" : "") + "```", inline: false, })) .slice(0, 5) From 831bcdc7a88f7fd2472f87557db0a7f0e825563a Mon Sep 17 00:00:00 2001 From: TRACTION <19631364+iamtraction@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:07:49 +0530 Subject: [PATCH 3/6] fix: use fixed play-dl library Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com> --- package.json | 2 +- src/commands/music/play.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9dff49676..dd1c0ac7d 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@bastion/tesseract": "^5.2.0", "@discordjs/opus": "^0.9.0", "@iamtraction/google-translate": "^2.0.1", + "@iamtraction/play-dl": "^1.9.8", "discord-rpc": "^4.0.1", "dotenv": "^16.3.1", "emoji-regex": "^10.3.0", @@ -41,7 +42,6 @@ "libsodium-wrappers": "^0.7.13", "mathjs": "^12.4.2", "openai": "^4.47.1", - "play-dl": "^1.9.7", "r6api.js": "^4.4.1", "undici": "^6.18.0", "ytdl-core": "^4.11.5", diff --git a/src/commands/music/play.ts b/src/commands/music/play.ts index 251f6932c..1d3140a9b 100644 --- a/src/commands/music/play.ts +++ b/src/commands/music/play.ts @@ -6,7 +6,7 @@ import { ApplicationCommandOptionType, ChatInputCommandInteraction } from "disco import { AudioPlayerStatus, AudioResource, createAudioPlayer, createAudioResource, entersState, getVoiceConnection, joinVoiceChannel, NoSubscriberBehavior, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice"; import { Client, Command, Logger } from "@bastion/tesseract"; import { music } from "@bastion/tesseract/typings/types.js"; -import playDL from "play-dl"; +import playDL from "@iamtraction/play-dl"; import ytpl from "ytpl"; import GuildModel from "../../models/Guild.js"; From 5d7b5ffd9e5ff0037e47fbe30b7142daf39fd51a Mon Sep 17 00:00:00 2001 From: TRACTION <19631364+iamtraction@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:08:41 +0530 Subject: [PATCH 4/6] version: 10.15.1 Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd1c0ac7d..252e50512 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bastion", - "version": "10.15.0", + "version": "10.15.1", "description": "Get an enhanced Discord experience!", "type": "module", "homepage": "https://bastion.traction.one", From fa8afdf6c8cb4eb7437a82f578e75271537d2072 Mon Sep 17 00:00:00 2001 From: TRACTION <19631364+iamtraction@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:40:18 +0530 Subject: [PATCH 5/6] listeners(messageCreate): create guild doc if it wasn't created due to some error Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com> --- src/listeners/messageCreate.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/listeners/messageCreate.ts b/src/listeners/messageCreate.ts index 3b126a95e..da4863bd8 100644 --- a/src/listeners/messageCreate.ts +++ b/src/listeners/messageCreate.ts @@ -297,7 +297,12 @@ class MessageCreateListener extends Listener<"messageCreate"> { if (message.author.bot) return; if (message.inGuild()) { - const guildDocument = await GuildModel.findById(message.guildId); + let guildDocument = await GuildModel.findById(message.guildId); + + // create guild document if it wasn't found + if (!guildDocument) { + guildDocument = await GuildModel.findByIdAndUpdate(message.guildId, {}, { upsert: true }); + } // gamification this.handleGamification(message, guildDocument).catch(Logger.error); From 3b9a89c4aa01091ff6c65ea3fb48561c3ec1bd56 Mon Sep 17 00:00:00 2001 From: TRACTION <19631364+iamtraction@users.noreply.github.com> Date: Sat, 22 Jun 2024 11:49:44 +0530 Subject: [PATCH 6/6] deps: update Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 252e50512..02accf2bc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "gamedig": "^5.0.0", "jsdom": "^24.0.0", "libsodium-wrappers": "^0.7.13", - "mathjs": "^12.4.2", + "mathjs": "^13.0.0", "openai": "^4.47.1", "r6api.js": "^4.4.1", "undici": "^6.18.0",