From f4da672299afa5a3d9915a2fc4eb9e3efa7b2884 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 28 Jun 2024 20:25:03 +0200 Subject: [PATCH] bump dependencies fix minor bugs --- interactions/global/mensa.ts | 12 ++++++------ interactions/global/quicklink.ts | 2 +- interactions/private/wochenplan.ts | 6 +++--- package.json | 18 +++++++++--------- tsconfig.json | 4 ++-- types/customTypes.ts | 28 ++++++++++------------------ 6 files changed, 31 insertions(+), 39 deletions(-) diff --git a/interactions/global/mensa.ts b/interactions/global/mensa.ts index f0a315c..9d9d741 100644 --- a/interactions/global/mensa.ts +++ b/interactions/global/mensa.ts @@ -5,8 +5,9 @@ import { DiscordClient, DiscordChatInputCommandInteraction, DiscordSlashCommandB const { DateTime } = require('luxon') export const data = new DiscordSlashCommandBuilder() - .setName('mensa') - .setDescription('Was es wohl heute zum Essen geben wird?') +.setName('mensa') +.setDescription('Was es wohl heute zum Essen geben wird?') +.setLocalizations('mensa') .addStringOption(option => option .setName('wochentag') @@ -31,7 +32,6 @@ export const data = new DiscordSlashCommandBuilder() { name: 'caféteria moltkestraße 30', value: 'x1moltkestrasse' }, ), ) - .setLocalizations('mensa') exports.Command = async (client: DiscordClient, interaction: DiscordChatInputCommandInteraction): Promise => { const today = new Date() @@ -158,12 +158,12 @@ export function _updateJson(client: DiscordClient): Promise { * Fancy API stuff and user credential hashing */ const options = { - host: client.config.sensitive.mensa.base_url, + host: client.config.sensitive.mensa?.base_url, port: 443, - path: client.config.sensitive.mensa.api, + path: client.config.sensitive.mensa?.api, headers: { Authorization: `Basic ${Buffer.from( - `${client.config.sensitive.mensa.user}:${client.config.sensitive.mensa.password}`, + `${client.config.sensitive.mensa?.user}:${client.config.sensitive.mensa?.password}`, ).toString('base64')}`, }, } diff --git a/interactions/global/quicklink.ts b/interactions/global/quicklink.ts index 302c8ba..0ea802e 100644 --- a/interactions/global/quicklink.ts +++ b/interactions/global/quicklink.ts @@ -73,6 +73,7 @@ choices.shift() export const data = new DiscordSlashCommandBuilder() .setName('quicklink') .setDescription('Links quick') + .setLocalizations('quicklink') .addStringOption(option => // eslint-disable-next-line newline-per-chained-call option @@ -90,7 +91,6 @@ export const data = new DiscordSlashCommandBuilder() .setRequired(true), ) .addUserOption(option => option.setName('userping').setDescription('Who do you want to annoy?')) - .setLocalizations('quicklink') /** * Reply to interactiopn diff --git a/interactions/private/wochenplan.ts b/interactions/private/wochenplan.ts index 847fc31..33a288c 100644 --- a/interactions/private/wochenplan.ts +++ b/interactions/private/wochenplan.ts @@ -17,12 +17,12 @@ exports.usage = `wochenplan {TAG}` let startOfWeek = new Date() export const data = new DiscordSlashCommandBuilder() - .setName('wochenplan') - .setDescription('Zeigt deinen Wochenplan an.') +.setName('wochenplan') +.setDescription('Zeigt deinen Wochenplan an.') +.setLocalizations('wochenplan') .addStringOption(option => option.setName('datum').setDescription('Das Datum, das angezeigt werden soll. Format: DD.MM.YYYY'), ) - .setLocalizations('wochenplan') function wochenplan( client: DiscordClient, diff --git a/package.json b/package.json index b62ed45..4fde1a9 100644 --- a/package.json +++ b/package.json @@ -11,24 +11,24 @@ "homepage": "https://github.com/Chr1s70ph/ETIT-Master-JS#readme", "author": "Christoph Bluem", "dependencies": { - "@discordjs/rest": "^2.0.0", - "discord-api-types": "^0.37.79", - "discord.js": "^14.12.1", + "@discordjs/rest": "^2.3.0", + "discord-api-types": "^0.37.91", + "discord.js": "^14.15.3", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^5.1.3", "fs": "^0.0.1-security", "https": "^1.0.0", - "i18next": "^23.11.2", + "i18next": "^23.11.5", "i18next-fs-backend": "^2.3.1", "luxon": "^3.4.4", "moment": "^2.30.1", "moment-timezone": "^0.5.45", "node-ical": "^0.18.0", "node-schedule": "^2.1.1", - "openai": "^4.36.0", + "openai": "^4.52.1", "os": "^0.1.2", - "pm2": "^5.3.1", + "pm2": "^5.4.1", "tenorjs": "^1.0.10", "tx2": "^1.0.5", "valid-url": "^1.0.9" @@ -36,8 +36,8 @@ "devDependencies": { "@types/node-schedule": "^2.1.7", "@types/tx2": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^7.7.0", - "@typescript-eslint/parser": "^7.7.0", - "eslint": "^9.0.0" + "@typescript-eslint/eslint-plugin": "^7.14.1", + "@typescript-eslint/parser": "^7.14.1", + "eslint": "^9.5.0" } } diff --git a/tsconfig.json b/tsconfig.json index 1b52561..ba366f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { "outDir": "./built", - "allowJs": true, + "allowJs": false, "target": "ESNext", "resolveJsonModule": true, "esModuleInterop": true, "moduleResolution": "node", "skipLibCheck": true }, - "exclude": ["node_modules", "./built"] + "exclude": ["node_modules", "./built"], } diff --git a/types/customTypes.ts b/types/customTypes.ts index aaed5f1..1f68858 100644 --- a/types/customTypes.ts +++ b/types/customTypes.ts @@ -17,11 +17,11 @@ import { ModalSubmitInteraction, PresenceData, PresenceStatusData, - SlashCommandBuilder, StringSelectMenuInteraction, TextChannel, User, UserContextMenuCommandInteraction, + SlashCommandBuilder } from 'discord.js' import i18next, { TOptions } from 'i18next' import { CalendarResponse } from 'node-ical' @@ -230,28 +230,20 @@ export class DiscordSlashCommandBuilder extends SlashCommandBuilder { /** * Adds all available localizations of name and description * @param {string} name name of command - * @returns {SlashCommandBuilder} + * @returns {this} */ - public setLocalizations(name: string): SlashCommandBuilder { - /** - * Array of all available localizations - */ - const localizations: any = getLocalizations(name) - // If (localizations === []) return this + public setLocalizations(name: string): this { + const localizations: any = getLocalizations(name); for (const entry in localizations) { - /** - * Object containing {@link LocaleString}, localized name and description - */ - const item: LocalizationTypes = localizations[entry] - /** - * Only set localization if a localized name or description can be found - */ - if (item.localized_name !== null) this.setNameLocalization(item.localized_language, item.localized_name) + const item: LocalizationTypes = localizations[entry]; + if (item.localized_name !== null) { + this.setNameLocalization(item.localized_language, item.localized_name); + } if (item.localized_description !== null) { - this.setDescriptionLocalization(item.localized_language, item.localized_description) + this.setDescriptionLocalization(item.localized_language, item.localized_description); } } - return this + return this; } }