From 71db89f4d5f5624a0a2b503c8057b79d2ac965ca Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Fri, 27 Sep 2024 22:01:18 +0900 Subject: [PATCH 1/4] chore(discord.js & mysql2): Update dependencies --- package.json | 6 +-- yarn.lock | 146 +++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 115 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 944c411..a0b3670 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "3.1.0-cake.d240925a", + "version": "3.1.0-cake.p240927a", "main": "dist/index.js", "private": true, "dependencies": { @@ -10,9 +10,9 @@ "@sapphire/pieces": "^4.3.1", "@sapphire/utilities": "^3.17.0", "discord-api-types": "^0.37.93", - "discord.js": "^14.15.3", + "discord.js": "^14.16.2", "dokdo": "^0.6.2", - "mysql2": "^3.11.0", + "mysql2": "^3.11.3", "semver": "^7.6.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 40fc59f..a528913 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29,18 +29,18 @@ __metadata: languageName: node linkType: hard -"@discordjs/builders@npm:^1.8.2": - version: 1.8.2 - resolution: "@discordjs/builders@npm:1.8.2" +"@discordjs/builders@npm:^1.9.0": + version: 1.9.0 + resolution: "@discordjs/builders@npm:1.9.0" dependencies: - "@discordjs/formatters": "npm:^0.4.0" - "@discordjs/util": "npm:^1.1.0" - "@sapphire/shapeshift": "npm:^3.9.7" - discord-api-types: "npm:0.37.83" + "@discordjs/formatters": "npm:^0.5.0" + "@discordjs/util": "npm:^1.1.1" + "@sapphire/shapeshift": "npm:^4.0.0" + discord-api-types: "npm:0.37.97" fast-deep-equal: "npm:^3.1.3" ts-mixer: "npm:^6.0.4" - tslib: "npm:^2.6.2" - checksum: 10c0/108fe8903e9bc875a28b39629589391e44f41835169114e93c15548b5635632862168d4bec3392eac12e981d06b830d90f11b7af38fd664d7ea9cfa46b0726f3 + tslib: "npm:^2.6.3" + checksum: 10c0/3287b87624c11112faeac0acc0063427dd85f4174ca7b2c3bbd0f77feab99e97193e5d6e6fb5989000eb50aff67d2831af3fc6cdf2907a05ac23a475f5b65ab6 languageName: node linkType: hard @@ -58,6 +58,13 @@ __metadata: languageName: node linkType: hard +"@discordjs/collection@npm:^2.1.1": + version: 2.1.1 + resolution: "@discordjs/collection@npm:2.1.1" + checksum: 10c0/7bbb007271a046c981957b4a0543f6ca7e4c294a2d40987437ff06db5e92dbf35b8dc61719db2a7bc99557a58275742aa34be9f50487870a6e80acfc4fe45fa1 + languageName: node + linkType: hard + "@discordjs/formatters@npm:^0.4.0": version: 0.4.0 resolution: "@discordjs/formatters@npm:0.4.0" @@ -67,6 +74,15 @@ __metadata: languageName: node linkType: hard +"@discordjs/formatters@npm:^0.5.0": + version: 0.5.0 + resolution: "@discordjs/formatters@npm:0.5.0" + dependencies: + discord-api-types: "npm:0.37.97" + checksum: 10c0/784e7a7cb82874eb3d5741c8058088accdc6151151d5dbafa634efdb184e0f5666a95e57ac8f6e514b2819b07f764dbb1d4258c0dbba37fc5645f800182ae1d9 + languageName: node + linkType: hard + "@discordjs/rest@npm:^2.3.0": version: 2.3.0 resolution: "@discordjs/rest@npm:2.3.0" @@ -84,6 +100,23 @@ __metadata: languageName: node linkType: hard +"@discordjs/rest@npm:^2.4.0": + version: 2.4.0 + resolution: "@discordjs/rest@npm:2.4.0" + dependencies: + "@discordjs/collection": "npm:^2.1.1" + "@discordjs/util": "npm:^1.1.1" + "@sapphire/async-queue": "npm:^1.5.3" + "@sapphire/snowflake": "npm:^3.5.3" + "@vladfrangu/async_event_emitter": "npm:^2.4.6" + discord-api-types: "npm:0.37.97" + magic-bytes.js: "npm:^1.10.0" + tslib: "npm:^2.6.3" + undici: "npm:6.19.8" + checksum: 10c0/2de35ff6c0ad734685e329fc29df52823faf6e9eb68045b780f5b657555c699da7e9e0ffdf2ab1ee7ef902d7a8901993b6ea6e0f3c85938570a2b74e15207c0a + languageName: node + linkType: hard + "@discordjs/util@npm:^1.1.0": version: 1.1.0 resolution: "@discordjs/util@npm:1.1.0" @@ -91,7 +124,14 @@ __metadata: languageName: node linkType: hard -"@discordjs/ws@npm:^1.1.1": +"@discordjs/util@npm:^1.1.1": + version: 1.1.1 + resolution: "@discordjs/util@npm:1.1.1" + checksum: 10c0/a374648aae0dd98345996f41891add0523388297a6f6b99c7a37c83de4d832d91a464195502126967fac0f071e5ecb80f776ee42a887fffa9c5c0f4612381b98 + languageName: node + linkType: hard + +"@discordjs/ws@npm:1.1.1": version: 1.1.1 resolution: "@discordjs/ws@npm:1.1.1" dependencies: @@ -619,6 +659,13 @@ __metadata: languageName: node linkType: hard +"@sapphire/async-queue@npm:^1.5.3": + version: 1.5.3 + resolution: "@sapphire/async-queue@npm:1.5.3" + checksum: 10c0/fcf860cdde9bfbc1625dab5e11924caa871c9e741a8fb836193a519267179a4a1979604f88f8a40855c6b931bc82d489dcd11d034fea38bb8a4d9816ab821ed1 + languageName: node + linkType: hard + "@sapphire/decorators@npm:^6.1.0": version: 6.1.0 resolution: "@sapphire/decorators@npm:6.1.0" @@ -728,6 +775,16 @@ __metadata: languageName: node linkType: hard +"@sapphire/shapeshift@npm:^4.0.0": + version: 4.0.0 + resolution: "@sapphire/shapeshift@npm:4.0.0" + dependencies: + fast-deep-equal: "npm:^3.1.3" + lodash: "npm:^4.17.21" + checksum: 10c0/2abbfd20977e800455108688e45fff7b7c6e197256c8f8a54db90025a900914908b5fa4ffcbd1eacb4c692792cbed980613aa878e09f1fd87ab5052b6a6d6bce + languageName: node + linkType: hard + "@sapphire/snowflake@npm:3.5.3, @sapphire/snowflake@npm:^3.5.3": version: 3.5.3 resolution: "@sapphire/snowflake@npm:3.5.3" @@ -950,6 +1007,13 @@ __metadata: languageName: node linkType: hard +"@vladfrangu/async_event_emitter@npm:^2.4.6": + version: 2.4.6 + resolution: "@vladfrangu/async_event_emitter@npm:2.4.6" + checksum: 10c0/1fe634878902da584493ecb8e81c855436c002b215dd7c25c21780930fc5621ebe8eb79d5b899a56af0d1ea9ea9171e35175221e4438e2f56c67ce64d4b8a373 + languageName: node + linkType: hard + "abbrev@npm:^2.0.0": version: 2.0.0 resolution: "abbrev@npm:2.0.0" @@ -1355,6 +1419,13 @@ __metadata: languageName: node linkType: hard +"discord-api-types@npm:0.37.97": + version: 0.37.97 + resolution: "discord-api-types@npm:0.37.97" + checksum: 10c0/1a08a0f44d3a7439fd1ac4128e4a853c498fa5477e40bc68f2c62d5b2abe8aad1d1d402d8a59a6ac55adf348354dc6c97865a11548b1a25bf2f0878cff3a54b0 + languageName: node + linkType: hard + "discord-api-types@npm:^0.37.84": version: 0.37.90 resolution: "discord-api-types@npm:0.37.90" @@ -1369,23 +1440,23 @@ __metadata: languageName: node linkType: hard -"discord.js@npm:^14.15.3": - version: 14.15.3 - resolution: "discord.js@npm:14.15.3" +"discord.js@npm:^14.16.2": + version: 14.16.2 + resolution: "discord.js@npm:14.16.2" dependencies: - "@discordjs/builders": "npm:^1.8.2" + "@discordjs/builders": "npm:^1.9.0" "@discordjs/collection": "npm:1.5.3" - "@discordjs/formatters": "npm:^0.4.0" - "@discordjs/rest": "npm:^2.3.0" - "@discordjs/util": "npm:^1.1.0" - "@discordjs/ws": "npm:^1.1.1" + "@discordjs/formatters": "npm:^0.5.0" + "@discordjs/rest": "npm:^2.4.0" + "@discordjs/util": "npm:^1.1.1" + "@discordjs/ws": "npm:1.1.1" "@sapphire/snowflake": "npm:3.5.3" - discord-api-types: "npm:0.37.83" + discord-api-types: "npm:0.37.97" fast-deep-equal: "npm:3.1.3" lodash.snakecase: "npm:4.1.1" - tslib: "npm:2.6.2" - undici: "npm:6.13.0" - checksum: 10c0/21a4e28541c29bf7170835f42cebc684e83615221f3c1262677e1f363e8fd28e7367e35bceabaea15873d965aecf0a832df6d572790ddec104bd0e025d11bdb8 + tslib: "npm:^2.6.3" + undici: "npm:6.19.8" + checksum: 10c0/2b4289d6a3b3f5c2978dbfa840225d2f789eaf161ae85bf12e0125b5096eb64562c170dfc7f0d1ee389beb565cabe45733a27853178b2d0dc78548b5d1a83338 languageName: node linkType: hard @@ -2262,10 +2333,10 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^8.0.0": - version: 8.0.5 - resolution: "lru-cache@npm:8.0.5" - checksum: 10c0/cd95a9c38497611c5a6453de39a881f6eb5865851a2a01b5f14104ff3fee515362a7b1e7de28606028f423802910ba05bdb8ae1aa7b0d54eae70c92f0cec10b2 +"lru.min@npm:^1.0.0": + version: 1.1.1 + resolution: "lru.min@npm:1.1.1" + checksum: 10c0/9bb1380dd9fdb155632122dfd2beb26e0c624ac141c4e95d551b66b5c523f2b7c4cdcc0b98a86419d59bc5d3af91c5699439ad06ec07f01b43d5aee51e1b34e8 languageName: node linkType: hard @@ -2470,13 +2541,13 @@ __metadata: "@typescript-eslint/parser": "npm:^7.17.0" cross-env: "npm:^7.0.3" discord-api-types: "npm:^0.37.93" - discord.js: "npm:^14.15.3" + discord.js: "npm:^14.16.2" dokdo: "npm:^0.6.2" eslint: "npm:^9.8.0" eslint-config-prettier: "npm:^9.1.0" eslint-plugin-prettier: "npm:^5.2.1" globals: "npm:^15.8.0" - mysql2: "npm:^3.11.0" + mysql2: "npm:^3.11.3" prettier: "npm:^3.3.3" semver: "npm:^7.6.3" ts-node: "npm:^10.9.2" @@ -2485,20 +2556,20 @@ __metadata: languageName: unknown linkType: soft -"mysql2@npm:^3.11.0": - version: 3.11.0 - resolution: "mysql2@npm:3.11.0" +"mysql2@npm:^3.11.3": + version: 3.11.3 + resolution: "mysql2@npm:3.11.3" dependencies: aws-ssl-profiles: "npm:^1.1.1" denque: "npm:^2.1.0" generate-function: "npm:^2.3.1" iconv-lite: "npm:^0.6.3" long: "npm:^5.2.1" - lru-cache: "npm:^8.0.0" + lru.min: "npm:^1.0.0" named-placeholders: "npm:^1.1.3" seq-queue: "npm:^0.0.5" sqlstring: "npm:^2.3.2" - checksum: 10c0/7cc408ecfce01cda0692e72879e9812855a91b03940ac4e8acb715c55f25f8d262a05df5fe25fe3b707a1f40a61e68cde5c3e00b6a81343b00f9595bd4adc790 + checksum: 10c0/5d4d72a6ea0db8fab29403bd87b5efb244e756badb29a6078fa8fda11a097bbf0634ccad891d9f5decdce8efb98ac13b9bcbc9a3ddce8a232ee140aaacc2c479 languageName: node linkType: hard @@ -3264,7 +3335,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:2.6.2, tslib@npm:^2.6.2": +"tslib@npm:^2.6.2": version: 2.6.2 resolution: "tslib@npm:2.6.2" checksum: 10c0/e03a8a4271152c8b26604ed45535954c0a45296e32445b4b87f8a5abdb2421f40b59b4ca437c4346af0f28179780d604094eb64546bee2019d903d01c6c19bdb @@ -3362,6 +3433,13 @@ __metadata: languageName: node linkType: hard +"undici@npm:6.19.8": + version: 6.19.8 + resolution: "undici@npm:6.19.8" + checksum: 10c0/07fd8520bce7e34ea29c07ef0de27b734183042cdb4e2f1262cd1fb9b755a6b04ff2471040395dfb1770fb7786069a97c5178bcf706b80a34075994f46feb37c + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0" From cbe8df23e129e7c8aaaa586c23d756ee23566690 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Fri, 27 Sep 2024 22:46:07 +0900 Subject: [PATCH 2/4] fix: Can't send preview version use warning message --- package.json | 2 +- src/listeners/messageCreate.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a0b3670..17c5737 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "3.1.0-cake.p240927a", + "version": "3.1.0-cake.p240927b", "main": "dist/index.js", "private": true, "dependencies": { diff --git a/src/listeners/messageCreate.ts b/src/listeners/messageCreate.ts index fe12337..44c3fdd 100644 --- a/src/listeners/messageCreate.ts +++ b/src/listeners/messageCreate.ts @@ -4,7 +4,7 @@ import { noPerm } from '../modules' import Dokdo from 'dokdo' class MessageCreateListener extends Listener { - public async run(msg: Message) { + public async run(msg: Message) { const prefix = this.container.prefix const dokdo = new Dokdo(this.container.client, { aliases: ['dokdo', 'dok'], @@ -14,14 +14,13 @@ class MessageCreateListener extends Listener { }) if (msg.author.bot) return if (msg.content.startsWith(prefix)) { - if (this.container.release === 'PRE-RELEASE') { + if (this.container.release === 'PREVIEW') { await msg.reply({ embeds: [ { title: '정식 출시 이전 버전 사용안내', description: `현재 이 버전의 ${this.container.client.user?.username}은 정식출시 되기 이전이라 많이 불안정할 수 있어요.\n` + - `또한 이 버전의 ${this.container.client.user?.username}의 데이터는 정식버전과 연동이 안돼요.\n` + `만약 오류가 발견되면 ${(await this.container.client.users.fetch(this.container.config.bot.owner_ID)).username}님에게 알려주세요.\n`, color: 0xff0000, footer: { From ed782a7b9682409875a693718cc67a23ab968490 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Mon, 30 Sep 2024 21:43:20 +0900 Subject: [PATCH 3/4] fix: Can't delete the not exist data. --- src/Commands/deleteLearn.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Commands/deleteLearn.ts b/src/Commands/deleteLearn.ts index 321a83b..3318e44 100644 --- a/src/Commands/deleteLearn.ts +++ b/src/Commands/deleteLearn.ts @@ -35,13 +35,13 @@ class DeleteLearnCommand extends Command { ) if (!command) { - return await msg.channel.send( + return await msg.reply( `사용법: \n\`\`\`${(this.detailedDescription as DetailedDescriptionCommandObject).usage}\`\`\``, ) } - if (!deleteDatas) { - return await msg.channel.send('해당하는 걸 찾ㅈ을 수 없어요.') + if (deleteDatas.length === 0) { + return await msg.reply('해당하는 걸 찾ㅈ을 수 없어요.') } for (let i = 1; i <= deleteDatas.length; i++) { From 789bfba759092886d6337f0e704401c0a00a4b2c Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Mon, 30 Sep 2024 22:05:40 +0900 Subject: [PATCH 4/4] feat: Add deleteLearn's cancel --- package.json | 2 +- src/Commands/deleteLearn.ts | 9 ++++++++- src/interaction-handlers/deleteLearn.ts | 14 +++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 095572e..773043f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "3.1.0-cake.r240928a", + "version": "3.2.0-cake.r240930a", "main": "dist/index.js", "private": true, "dependencies": { diff --git a/src/Commands/deleteLearn.ts b/src/Commands/deleteLearn.ts index 3318e44..2037bd3 100644 --- a/src/Commands/deleteLearn.ts +++ b/src/Commands/deleteLearn.ts @@ -69,7 +69,14 @@ class DeleteLearnCommand extends Command { type: ComponentType.StringSelect, customId: `${CUSTOM_ID}@${msg.author.id}`, placeholder: '지울 데이터를 선택해ㅈ주세요', - options, + options: [ + ...options, + { + label: '❌ 취소', + description: '아무것도 삭제하지 않아요.', + value: `${CUSTOM_ID}-cancel`, + }, + ], }, ], }, diff --git a/src/interaction-handlers/deleteLearn.ts b/src/interaction-handlers/deleteLearn.ts index a0c42f8..49efc52 100644 --- a/src/interaction-handlers/deleteLearn.ts +++ b/src/interaction-handlers/deleteLearn.ts @@ -32,6 +32,18 @@ class DeleteLearnHandler extends InteractionHandler { const db = this.container.database const decimalRegexp = /^[0-9]/g + if (id === 'cancel') + return interaction.editReply({ + embeds: [ + { + title: '삭제', + description: '아무것도 삭제하지 않았어요.', + color: 0x00ff00, + }, + ], + components: [], + }) + const itemId = interaction.component.options.map(item => item.value.endsWith(id) ? item.label.match(decimalRegexp)![0] : null, ) @@ -42,7 +54,7 @@ class DeleteLearnHandler extends InteractionHandler { embeds: [ { title: '삭제', - description: `${Number(itemId!)}번을 정상적으로 삭제하ㅇ였어요.`, + description: `${Number(itemId[0]!)}번을 정상적으로 삭제하ㅇ였어요.`, timestamp: new Date().toISOString(), }, ],