From 72bee2bdb9002f90e61c36c3ff45ce47c8ec34a6 Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Sun, 11 Aug 2024 14:17:39 +0900 Subject: [PATCH 01/16] Update package --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1f0d0ba58..cb0ada04c 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@biomejs/biome": "^1.8.3", "@types/i18n": "^0.13.12", - "@types/node": "^22.1.0", + "@types/node": "^22.2.0", "@types/signale": "^1.4.7", "prisma": "^5.18.0", "typescript": "^5.5.4" @@ -52,7 +52,7 @@ "signale": "^1.4.0", "topgg-autoposter": "^2.0.2", "tslib": "^2.6.3", - "undici": "^6.19.6" + "undici": "^6.19.7" }, "signale": { "displayScope": true, From 72c49439ef3768061a7ae21d9f1c8ca8cd36a91b Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Mon, 12 Aug 2024 01:08:54 +0900 Subject: [PATCH 02/16] Update Now, developers can bypass all permissions on the server. --- src/events/client/MessageCreate.ts | 286 +++++++++++++++-------------- 1 file changed, 144 insertions(+), 142 deletions(-) diff --git a/src/events/client/MessageCreate.ts b/src/events/client/MessageCreate.ts index 3bafa99e8..3306e87ec 100644 --- a/src/events/client/MessageCreate.ts +++ b/src/events/client/MessageCreate.ts @@ -52,195 +52,196 @@ export default class MessageCreate extends Event { const ctx = new Context(message, args); ctx.setArgs(args); ctx.guildLocale = locale; - if (!message.guild.members.resolve(this.client.user)?.permissions.has(PermissionFlagsBits.ViewChannel)) return; - const clientMember = message.guild.members.resolve(this.client.user); - if (!clientMember.permissions.has(PermissionFlagsBits.SendMessages)) { - await message.author - .send({ - content: T(locale, "event.message.no_send_message", { - guild: message.guild.name, - channel: `<#${message.channelId}>`, - }), - }) - .catch(() => {}); - return; - } + const isDev = this.client.config.owners?.includes(message.author.id); - if (!clientMember.permissions.has(PermissionFlagsBits.EmbedLinks)) { - await message.reply({ - content: T(locale, "event.message.no_embed_links"), - }); - return; - } + if (!isDev) { + if (!message.guild.members.resolve(this.client.user)?.permissions.has(PermissionFlagsBits.ViewChannel)) return; - const logs = this.client.channels.cache.get(this.client.config.commandLogs); - - if (command.permissions) { - if (command.permissions.client && !clientMember.permissions.has(command.permissions.client)) { - await message.reply({ - content: T(locale, "event.message.no_permission"), - }); + const clientMember = message.guild.members.resolve(this.client.user); + if (!clientMember.permissions.has(PermissionFlagsBits.SendMessages)) { + await message.author + .send({ + content: T(locale, "event.message.no_send_message", { + guild: message.guild.name, + channel: `<#${message.channelId}>`, + }), + }) + .catch(() => {}); return; } - if (command.permissions.user && !message.member.permissions.has(command.permissions.user)) { + if (!clientMember.permissions.has(PermissionFlagsBits.EmbedLinks)) { await message.reply({ - content: T(locale, "event.message.no_user_permission"), + content: T(locale, "event.message.no_embed_links"), }); return; } - if (command.permissions.dev && this.client.config.owners) { - const isDev = this.client.config.owners.includes(message.author.id); - if (!isDev) return; - } - } - if (command.vote && this.client.config.topGG) { - const voted = await this.client.topGG.hasVoted(message.author.id); - if (!voted) { - const voteBtn = new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setLabel("Vote for Me!") - .setURL(`https://top.gg/bot/${this.client.config.clientId}/vote`) - .setStyle(ButtonStyle.Link), - ); - - await message.reply({ - content: "Wait! Before using this command, you must vote on top.gg. Thank you.", - components: [voteBtn], - }); - } - } - if (command.player) { - if (command.player.voice) { - if (!message.member.voice.channel) { + if (command.permissions) { + if (command.permissions.client && !clientMember.permissions.has(command.permissions.client)) { await message.reply({ - content: T(locale, "event.message.no_voice_channel", { - command: command.name, - }), + content: T(locale, "event.message.no_permission"), }); return; } - if (!clientMember.permissions.has(PermissionFlagsBits.Connect)) { + if (command.permissions.user && !message.member.permissions.has(command.permissions.user)) { await message.reply({ - content: T(locale, "event.message.no_connect_permission", { command: command.name }), - }); - return; - } - - if (!clientMember.permissions.has(PermissionFlagsBits.Speak)) { - await message.reply({ - content: T(locale, "event.message.no_speak_permission", { command: command.name }), + content: T(locale, "event.message.no_user_permission"), }); return; } + } - if ( - message.member.voice.channel.type === ChannelType.GuildStageVoice && - !clientMember.permissions.has(PermissionFlagsBits.RequestToSpeak) - ) { - await message.reply({ - content: T(locale, "event.message.no_request_to_speak", { command: command.name }), - }); - return; - } + if (command.vote && this.client.config.topGG) { + const voted = await this.client.topGG.hasVoted(message.author.id); + if (!voted) { + const voteBtn = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setLabel("Vote for Me!") + .setURL(`https://top.gg/bot/${this.client.config.clientId}/vote`) + .setStyle(ButtonStyle.Link), + ); - if (clientMember.voice.channel && clientMember.voice.channelId !== message.member.voice.channelId) { await message.reply({ - content: T(locale, "event.message.different_voice_channel", { - channel: `<#${clientMember.voice.channelId}>`, - command: command.name, - }), + content: "Wait! Before using this command, you must vote on top.gg. Thank you.", + components: [voteBtn], }); return; } } - if (command.player.active) { - const queue = this.client.queue.get(message.guildId); - if (!queue?.queue && queue.current) { - await message.reply({ - content: T(locale, "event.message.no_music_playing"), - }); - return; + if (command.player) { + if (command.player.voice) { + if (!message.member.voice.channel) { + await message.reply({ + content: T(locale, "event.message.no_voice_channel", { + command: command.name, + }), + }); + return; + } + + if (!clientMember.permissions.has(PermissionFlagsBits.Connect)) { + await message.reply({ + content: T(locale, "event.message.no_connect_permission", { command: command.name }), + }); + return; + } + + if (!clientMember.permissions.has(PermissionFlagsBits.Speak)) { + await message.reply({ + content: T(locale, "event.message.no_speak_permission", { command: command.name }), + }); + return; + } + + if ( + message.member.voice.channel.type === ChannelType.GuildStageVoice && + !clientMember.permissions.has(PermissionFlagsBits.RequestToSpeak) + ) { + await message.reply({ + content: T(locale, "event.message.no_request_to_speak", { command: command.name }), + }); + return; + } + + if (clientMember.voice.channel && clientMember.voice.channelId !== message.member.voice.channelId) { + await message.reply({ + content: T(locale, "event.message.different_voice_channel", { + channel: `<#${clientMember.voice.channelId}>`, + command: command.name, + }), + }); + return; + } } - } - if (command.player.dj) { - const dj = await this.client.db.getDj(message.guildId); - if (dj?.mode) { - const djRole = await this.client.db.getRoles(message.guildId); - if (!djRole) { + if (command.player.active) { + const queue = this.client.queue.get(message.guildId); + if (!queue?.queue && queue.current) { await message.reply({ - content: T(locale, "event.message.no_dj_role"), + content: T(locale, "event.message.no_music_playing"), }); return; } - const findDJRole = message.member.roles.cache.find((x: any) => djRole.map((y: any) => y.roleId).includes(x.id)); - if (!findDJRole) { - if (!message.member.permissions.has(PermissionFlagsBits.ManageGuild)) { - await message - .reply({ - content: T(locale, "event.message.no_dj_permission"), - }) - .then((msg) => setTimeout(() => msg.delete(), 5000)); + } + + if (command.player.dj) { + const dj = await this.client.db.getDj(message.guildId); + if (dj?.mode) { + const djRole = await this.client.db.getRoles(message.guildId); + if (!djRole) { + await message.reply({ + content: T(locale, "event.message.no_dj_role"), + }); return; } + const findDJRole = message.member.roles.cache.find((x: any) => djRole.map((y: any) => y.roleId).includes(x.id)); + if (!findDJRole) { + if (!message.member.permissions.has(PermissionFlagsBits.ManageGuild)) { + await message + .reply({ + content: T(locale, "event.message.no_dj_permission"), + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); + return; + } + } } } } - } - if (command.args && !args.length) { - const embed = this.client - .embed() - .setColor(this.client.color.red) - .setTitle(T(locale, "event.message.missing_arguments")) - .setDescription( - T(locale, "event.message.missing_arguments_description", { - command: command.name, - examples: command.description.examples ? command.description.examples.join("\n") : "None", - }), - ) - .setFooter({ text: T(locale, "event.message.syntax_footer") }); - await message.reply({ embeds: [embed] }); - return; - } + if (command.args && !args.length) { + const embed = this.client + .embed() + .setColor(this.client.color.red) + .setTitle(T(locale, "event.message.missing_arguments")) + .setDescription( + T(locale, "event.message.missing_arguments_description", { + command: command.name, + examples: command.description.examples ? command.description.examples.join("\n") : "None", + }), + ) + .setFooter({ text: T(locale, "event.message.syntax_footer") }); + await message.reply({ embeds: [embed] }); + return; + } - if (!this.client.cooldown.has(cmd)) { - this.client.cooldown.set(cmd, new Collection()); - } + if (!this.client.cooldown.has(cmd)) { + this.client.cooldown.set(cmd, new Collection()); + } - const now = Date.now(); - const timestamps = this.client.cooldown.get(cmd)!; - const cooldownAmount = (command.cooldown || 5) * 1000; + const now = Date.now(); + const timestamps = this.client.cooldown.get(cmd)!; + const cooldownAmount = (command.cooldown || 5) * 1000; - if (timestamps.has(message.author.id)) { - const expirationTime = timestamps.get(message.author.id)! + cooldownAmount; - const timeLeft = (expirationTime - now) / 1000; - if (now < expirationTime && timeLeft > 0.9) { + if (timestamps.has(message.author.id)) { + const expirationTime = timestamps.get(message.author.id)! + cooldownAmount; + const timeLeft = (expirationTime - now) / 1000; + if (now < expirationTime && timeLeft > 0.9) { + await message.reply({ + content: T(locale, "event.message.cooldown", { + time: timeLeft.toFixed(1), + command: cmd, + }), + }); + return; + } + timestamps.set(message.author.id, now); + setTimeout(() => timestamps.delete(message.author.id), cooldownAmount); + } else { + timestamps.set(message.author.id, now); + setTimeout(() => timestamps.delete(message.author.id), cooldownAmount); + } + + if (args.includes("@everyone") || args.includes("@here")) { await message.reply({ - content: T(locale, "event.message.cooldown", { - time: timeLeft.toFixed(1), - command: cmd, - }), + content: T(locale, "event.message.no_mention_everyone"), }); return; } - timestamps.set(message.author.id, now); - setTimeout(() => timestamps.delete(message.author.id), cooldownAmount); - } else { - timestamps.set(message.author.id, now); - setTimeout(() => timestamps.delete(message.author.id), cooldownAmount); - } - - if (args.includes("@everyone") || args.includes("@here")) { - await message.reply({ - content: T(locale, "event.message.no_mention_everyone"), - }); - return; } try { @@ -251,6 +252,7 @@ export default class MessageCreate extends Event { content: T(locale, "event.message.error", { error }), }); } finally { + const logs = this.client.channels.cache.get(this.client.config.commandLogs); if (logs) { const embed = new EmbedBuilder() .setAuthor({ From c733ba90632edcb93bb7b93fa1d064fc01fb2482 Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Mon, 12 Aug 2024 20:35:10 +0900 Subject: [PATCH 03/16] Update perm --- .github/workflows/biome.yml | 4 ++-- .github/workflows/codeql.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/biome.yml b/.github/workflows/biome.yml index c9d03920e..3a88c5cde 100644 --- a/.github/workflows/biome.yml +++ b/.github/workflows/biome.yml @@ -13,9 +13,9 @@ jobs: name: Run biome checking runs-on: ubuntu-latest permissions: - contents: read + contents: write security-events: write - actions: read + actions: write steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 04dd677b7..2dc504dec 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,8 +25,8 @@ jobs: name: Analyze runs-on: ubuntu-latest permissions: - actions: read - contents: read + actions: write + contents: write security-events: write strategy: From 22264fdf73b50ce78363ce2b4a6eff73243e67a0 Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:00:42 +0900 Subject: [PATCH 04/16] biome.yml --- .github/workflows/biome.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/biome.yml b/.github/workflows/biome.yml index 3a88c5cde..2fc5d5c4b 100644 --- a/.github/workflows/biome.yml +++ b/.github/workflows/biome.yml @@ -24,4 +24,4 @@ jobs: run: npm install -g @biomejs/biome - name: Run Biome Check - run: biome check --write src/ + run: biome check --write From ccd84d9c34a1619ab49aebfb2b0b91a51279ab3c Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Tue, 13 Aug 2024 12:12:26 +0900 Subject: [PATCH 05/16] Update workflow --- .github/dependabot.yml | 6 ---- .github/workflows/biome.yml | 2 -- .github/workflows/codeql.yml | 2 -- .github/workflows/update-dependencies.yml | 37 +++++++++++++++++++++++ 4 files changed, 37 insertions(+), 10 deletions(-) delete mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/update-dependencies.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index d1f0d0851..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "daily" diff --git a/.github/workflows/biome.yml b/.github/workflows/biome.yml index 2fc5d5c4b..932ac0c27 100644 --- a/.github/workflows/biome.yml +++ b/.github/workflows/biome.yml @@ -5,8 +5,6 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - schedule: - - cron: '36 1 * * 6' jobs: biome: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2dc504dec..f8d5898d4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,8 +17,6 @@ on: pull_request: # The branches below must be a subset of the branches above branches: ['main'] - schedule: - - cron: '18 20 * * 3' jobs: analyze: diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 000000000..39faebd2c --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,37 @@ +name: Update Dependencies + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + update-dependencies: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '22' + + - name: Install npm-check-updates + run: npm install -g npm-check-updates + + - name: Run update dependencies + run: ncu -u + + - name: Install updated dependencies + run: npm install + + - name: Commit and push changes + run: | + git config --local user.name "GitHub Actions" + git config --local user.email "actions@github.com" + git add package.json + git commit -m "Update dependencies" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0b67633d878acc080ab83b399808df9f3a9ccf9f Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:45:40 +0900 Subject: [PATCH 06/16] update-dependencies.yml --- .github/workflows/update-dependencies.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 39faebd2c..360b1c290 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -23,9 +23,6 @@ jobs: - name: Run update dependencies run: ncu -u - - name: Install updated dependencies - run: npm install - - name: Commit and push changes run: | git config --local user.name "GitHub Actions" From a289c7fe4a33b4002c4e7cb472287b405e216e2c Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:46:40 +0900 Subject: [PATCH 07/16] update-dependencies.yml --- .github/workflows/update-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 360b1c290..2ca3cde7b 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -27,7 +27,7 @@ jobs: run: | git config --local user.name "GitHub Actions" git config --local user.email "actions@github.com" - git add package.json + git add . git commit -m "Update dependencies" git push env: From 44f47a79ef65e6a846c16aa92d9d1b9f2572cac6 Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Tue, 13 Aug 2024 22:51:42 +0900 Subject: [PATCH 08/16] Update --- .github/workflows/biome.yml | 10 +++++ src/commands/dev/CreateInvite.ts | 71 +++++++++++++++++++++++++++++++ src/commands/dev/DeleteInvites.ts | 65 ++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 src/commands/dev/CreateInvite.ts create mode 100644 src/commands/dev/DeleteInvites.ts diff --git a/.github/workflows/biome.yml b/.github/workflows/biome.yml index 932ac0c27..1d80fbe4d 100644 --- a/.github/workflows/biome.yml +++ b/.github/workflows/biome.yml @@ -23,3 +23,13 @@ jobs: - name: Run Biome Check run: biome check --write + + - name: Commit and push changes + run: | + git config --local user.name "GitHub Actions" + git config --local user.email "actions@github.com" + git add . + git commit -m "Update dependencies" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/commands/dev/CreateInvite.ts b/src/commands/dev/CreateInvite.ts new file mode 100644 index 000000000..c369f19bb --- /dev/null +++ b/src/commands/dev/CreateInvite.ts @@ -0,0 +1,71 @@ +import { Command, type Context, type Lavamusic } from "../../structures/index.js"; +import { ChannelType } from "discord.js"; + +export default class CreateInvite extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "createinvite", + description: { + content: "Create a one-time use, unlimited duration invite link for a guild", + examples: ["createinvite "], + usage: "createinvite ", + }, + category: "dev", + aliases: ["ci"], + cooldown: 3, + args: true, + player: { + voice: false, + dj: false, + active: false, + djPerm: null, + }, + permissions: { + dev: true, + client: ["SendMessages", "CreateInstantInvite", "ReadMessageHistory", "ViewChannel"], + user: [], + }, + slashCommand: false, + options: [], + }); + } + + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + const guildId = args[0]; + + const guild = client.guilds.cache.get(guildId); + + if (!guild) { + return await ctx.sendMessage("Guild not found."); + } + + try { + const textChannel = guild.channels.cache.find(channel => channel.type === ChannelType.GuildText); + + if (!textChannel) { + return await ctx.sendMessage("No text channel found in the guild."); + } + + const invite = await textChannel.createInvite({ + maxUses: 1, + maxAge: 0 + }); + + await ctx.author.send(`Guild: ${guild.name}\nInvite Link: ${invite.url}`); + await ctx.sendMessage("Invite link has been sent to your DM."); + } catch (error) { + await ctx.sendMessage("Failed to create invite link."); + } + } +} + +/** + * Project: lavamusic + * Author: Appu + * Main Contributor: LucasB25 + * Company: Coders + * Copyright (c) 2024. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ diff --git a/src/commands/dev/DeleteInvites.ts b/src/commands/dev/DeleteInvites.ts new file mode 100644 index 000000000..c850a36ac --- /dev/null +++ b/src/commands/dev/DeleteInvites.ts @@ -0,0 +1,65 @@ +import { Command, type Context, type Lavamusic } from "../../structures/index.js"; + +export default class DestroyInvites extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "destroyinvites", + description: { + content: "Destroy all invite links created by the bot in a guild", + examples: ["destroyinvites "], + usage: "destroyinvites ", + }, + category: "dev", + aliases: ["di"], + cooldown: 3, + args: true, + player: { + voice: false, + dj: false, + active: false, + djPerm: null, + }, + permissions: { + dev: true, + client: ["SendMessages", "ManageGuild", "ReadMessageHistory", "ViewChannel"], + user: [], + }, + slashCommand: false, + options: [], + }); + } + + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + const guildId = args[0]; + + const guild = client.guilds.cache.get(guildId); + + if (!guild) { + return await ctx.sendMessage("Guild not found."); + } + + try { + const invites = await guild.invites.fetch(); + + const botInvites = invites.filter(invite => invite.inviter?.id === client.user?.id); + for (const invite of botInvites.values()) { + await invite.delete(); + } + + await ctx.sendMessage(`Destroyed ${botInvites.size} invite(s) created by the bot.`); + } catch (error) { + await ctx.sendMessage("Failed to destroy invites."); + } + } +} + +/** + * Project: lavamusic + * Author: Appu + * Main Contributor: LucasB25 + * Company: Coders + * Copyright (c) 2024. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ From 5b9df40824b958c22b37730204d3ab147fc45c32 Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Tue, 13 Aug 2024 22:53:23 +0900 Subject: [PATCH 09/16] Delete workflow --- .github/workflows/biome.yml | 35 ----------------------- .github/workflows/update-dependencies.yml | 34 ---------------------- 2 files changed, 69 deletions(-) delete mode 100644 .github/workflows/biome.yml delete mode 100644 .github/workflows/update-dependencies.yml diff --git a/.github/workflows/biome.yml b/.github/workflows/biome.yml deleted file mode 100644 index 1d80fbe4d..000000000 --- a/.github/workflows/biome.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Biome - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - biome: - name: Run biome checking - runs-on: ubuntu-latest - permissions: - contents: write - security-events: write - actions: write - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Biome - run: npm install -g @biomejs/biome - - - name: Run Biome Check - run: biome check --write - - - name: Commit and push changes - run: | - git config --local user.name "GitHub Actions" - git config --local user.email "actions@github.com" - git add . - git commit -m "Update dependencies" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml deleted file mode 100644 index 2ca3cde7b..000000000 --- a/.github/workflows/update-dependencies.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Update Dependencies - -on: - schedule: - - cron: '0 0 * * *' - -jobs: - update-dependencies: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '22' - - - name: Install npm-check-updates - run: npm install -g npm-check-updates - - - name: Run update dependencies - run: ncu -u - - - name: Commit and push changes - run: | - git config --local user.name "GitHub Actions" - git config --local user.email "actions@github.com" - git add . - git commit -m "Update dependencies" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From edc5078e61efe8e53c16e9efbfc68b50a41ae29c Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:00:28 +0900 Subject: [PATCH 10/16] CreateInvite.ts --- src/commands/dev/CreateInvite.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/dev/CreateInvite.ts b/src/commands/dev/CreateInvite.ts index c369f19bb..65688f427 100644 --- a/src/commands/dev/CreateInvite.ts +++ b/src/commands/dev/CreateInvite.ts @@ -7,7 +7,7 @@ export default class CreateInvite extends Command { name: "createinvite", description: { content: "Create a one-time use, unlimited duration invite link for a guild", - examples: ["createinvite "], + examples: ["createinvite 0000000000000000000"], usage: "createinvite ", }, category: "dev", From 97afaecaf4bd90b469426f2e5bd8c82d4cd51845 Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:02:47 +0900 Subject: [PATCH 11/16] DeleteInvites.ts --- src/commands/dev/DeleteInvites.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/dev/DeleteInvites.ts b/src/commands/dev/DeleteInvites.ts index c850a36ac..8cb73bc3f 100644 --- a/src/commands/dev/DeleteInvites.ts +++ b/src/commands/dev/DeleteInvites.ts @@ -6,7 +6,7 @@ export default class DestroyInvites extends Command { name: "destroyinvites", description: { content: "Destroy all invite links created by the bot in a guild", - examples: ["destroyinvites "], + examples: ["destroyinvites 0000000000000000000"], usage: "destroyinvites ", }, category: "dev", From e1f85a9a96579f0711472d70b0bfb0541fafc2af Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Wed, 14 Aug 2024 09:27:58 +0900 Subject: [PATCH 12/16] Format --- src/commands/dev/CreateInvite.ts | 10 +++++----- src/commands/dev/DeleteInvites.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands/dev/CreateInvite.ts b/src/commands/dev/CreateInvite.ts index 65688f427..7d365f791 100644 --- a/src/commands/dev/CreateInvite.ts +++ b/src/commands/dev/CreateInvite.ts @@ -1,5 +1,5 @@ -import { Command, type Context, type Lavamusic } from "../../structures/index.js"; import { ChannelType } from "discord.js"; +import { Command, type Context, type Lavamusic } from "../../structures/index.js"; export default class CreateInvite extends Command { constructor(client: Lavamusic) { @@ -40,20 +40,20 @@ export default class CreateInvite extends Command { } try { - const textChannel = guild.channels.cache.find(channel => channel.type === ChannelType.GuildText); - + const textChannel = guild.channels.cache.find((channel) => channel.type === ChannelType.GuildText); + if (!textChannel) { return await ctx.sendMessage("No text channel found in the guild."); } const invite = await textChannel.createInvite({ maxUses: 1, - maxAge: 0 + maxAge: 0, }); await ctx.author.send(`Guild: ${guild.name}\nInvite Link: ${invite.url}`); await ctx.sendMessage("Invite link has been sent to your DM."); - } catch (error) { + } catch (_error) { await ctx.sendMessage("Failed to create invite link."); } } diff --git a/src/commands/dev/DeleteInvites.ts b/src/commands/dev/DeleteInvites.ts index 8cb73bc3f..9408b9cdf 100644 --- a/src/commands/dev/DeleteInvites.ts +++ b/src/commands/dev/DeleteInvites.ts @@ -41,13 +41,13 @@ export default class DestroyInvites extends Command { try { const invites = await guild.invites.fetch(); - const botInvites = invites.filter(invite => invite.inviter?.id === client.user?.id); + const botInvites = invites.filter((invite) => invite.inviter?.id === client.user?.id); for (const invite of botInvites.values()) { await invite.delete(); } await ctx.sendMessage(`Destroyed ${botInvites.size} invite(s) created by the bot.`); - } catch (error) { + } catch (_error) { await ctx.sendMessage("Failed to destroy invites."); } } From 87b0ed1207e87ee50fac4a3f1b9c7c78e39aac45 Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Wed, 14 Aug 2024 09:37:00 +0900 Subject: [PATCH 13/16] Fix Korean translation --- locales/Korean.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/Korean.json b/locales/Korean.json index fcf424ff3..b223b4bf3 100644 --- a/locales/Korean.json +++ b/locales/Korean.json @@ -40,7 +40,7 @@ }, "botinfo": { "description": "봇에 대한 정보를 표시해요", - "content": "봇 정보:\n- **운영체제**: {osInfo}\n- **가동시간**: {osUptime}\n- **컴퓨터 이름**: {osHostname}\n- **CPU 및 아키텍처**: {cpuInfo}\n- **CPU 사용량**: {cpuUsed}%\n- **메모리 사용량**: {memUsed}MB / {memTotal}GB\n- **Node 버전**: {nodeVersion}\n- **Discord 버전**: {discordJsVersion}\n- {guilds} 서버, {channels} 채널, {users} 유저 캐시됨\n- **명령어 수**: {commands}개" + "content": "봇 정보:\n- **운영 체제**: {osInfo}\n- **업타임**: {osUptime}\n- **호스트 이름**: {osHostname}\n- **CPU 아키텍처**: {cpuInfo}\n- **CPU 사용량**: {cpuUsed}%\n- **메모리 사용량**: {memUsed}MB / {memTotal}GB\n- **Node 버전**: {nodeVersion}\n- **Discord 버전**: {discordJsVersion}\n- 서버 {guilds}개, 채널 {channels}개, 멤버 {users}명\n- **명령어 수**: {commands}개" }, "about": { "description": "봇에 대해 알려줘요", @@ -582,10 +582,10 @@ "missing_arguments_description": "`{command}` 명령어에 필요한 인수를 지정해주세요.\n\n예시:\n{examples}", "syntax_footer": "구문: [] = 선택, <> = 필수", "cooldown": "`{command}` 명령어를 사용하려면 {time}초동안 기다려야 해요.", - "no_mention_everyone": "이 명령어는 everyone나 here 멘션으로 사용할 수 없어요. 빗금 명령으로 사용해주세요.", + "no_mention_everyone": "이 명령어는 everyone나 here 멘션으로 사용할 수 없어요. 빗금 명령어로 사용해주세요.", "error": "오류: `{error}`", "no_voice_channel_queue": "대기열에 노래를 추가하려면 음성 채널에 접속해주세요.", - "no_permission_connect_speak": "<#{channel}>에서 연결/말하기 권한이 봇에게 없어요.", + "no_permission_connect_speak": "<#{channel}>에서 연결/말하기 권한이 없어요.", "different_voice_channel_queue": "노래를 대기열에 추가하려면 <#{channel}> 채널에 접속해주세요." }, "setupButton": { From 39dc403136f684028e6f5f4c4058f5b16f89a96a Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Thu, 15 Aug 2024 11:24:24 +0900 Subject: [PATCH 14/16] Update package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb0ada04c..80344b343 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@biomejs/biome": "^1.8.3", "@types/i18n": "^0.13.12", - "@types/node": "^22.2.0", + "@types/node": "^22.3.0", "@types/signale": "^1.4.7", "prisma": "^5.18.0", "typescript": "^5.5.4" From d3d21fd37455421cb4063045812cf599cfe8f11c Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Thu, 15 Aug 2024 20:24:59 +0900 Subject: [PATCH 15/16] EnglishUS.json --- locales/EnglishUS.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/EnglishUS.json b/locales/EnglishUS.json index 41adc0dc3..b0a08b9fe 100644 --- a/locales/EnglishUS.json +++ b/locales/EnglishUS.json @@ -239,9 +239,9 @@ } }, "grab": { - "loading": "Loading...", "description": "Grabs the current playing song on your DM", - "content": "**Duration:** {length}\n**Requested by:** <@{requester}>\n**Link:** [Click here]({uri})", + "loading": "Loading...", + "content": "**Duration:** {length}\n**Requested by:** <@{requester}>\n**Link:** [Click here]({uri})", "check_dm": "Please check your DM.", "dm_failed": "I couldn't send you a DM. Please make sure allow direct messages is turned on." }, From 2a15f5f2c9f8a1c159c5ebfa541161641cb67ea1 Mon Sep 17 00:00:00 2001 From: hwangsihu <129564966+hwangsihu@users.noreply.github.com> Date: Thu, 15 Aug 2024 20:27:05 +0900 Subject: [PATCH 16/16] EnglishUS.json --- locales/EnglishUS.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/EnglishUS.json b/locales/EnglishUS.json index b0a08b9fe..7f11d7ac3 100644 --- a/locales/EnglishUS.json +++ b/locales/EnglishUS.json @@ -241,7 +241,7 @@ "grab": { "description": "Grabs the current playing song on your DM", "loading": "Loading...", - "content": "**Duration:** {length}\n**Requested by:** <@{requester}>\n**Link:** [Click here]({uri})", + "content": "**Duration:** {length}\n**Requested by:** <@{requester}>\n**Link:** [Click here]({uri})", "check_dm": "Please check your DM.", "dm_failed": "I couldn't send you a DM. Please make sure allow direct messages is turned on." },