Skip to content

Commit

Permalink
v10.15.1 (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtraction committed Jun 22, 2024
2 parents 4b360e2 + 3b9a89c commit 641aeef
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
"@iamtraction/play-dl": "^1.9.8",
"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",
"play-dl": "^1.9.7",
"mathjs": "^13.0.0",
"openai": "^4.47.1",
"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"
}
}
20 changes: 5 additions & 15 deletions src/commands/gameserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
7 changes: 6 additions & 1 deletion src/listeners/messageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 641aeef

Please sign in to comment.