3.1.0-Cake #7

Merged
migan merged 7 commits from release/3.1.0 into main 2024-09-28 11:57:06 +09:00
7 changed files with 162 additions and 92 deletions

View file

@ -1,6 +1,6 @@
{
"name": "muffinbot",
"version": "3.0.2-cake.r240924a",
"version": "3.1.0-cake.p240927b",
"main": "dist/index.js",
"private": true,
"dependencies": {
@ -10,11 +10,10 @@
"@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",
"semver": "^7.6.3",
"undici": "^6.19.4"
"mysql2": "^3.11.3",
"semver": "^7.6.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",

View file

@ -1,7 +1,6 @@
CREATE TABLE
`statement` (
CREATE TABLE `statement` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`text` varchar(255) DEFAULT NULL,
`text` varchar(255) DEFAULT NOT NULL,
`search_text` varchar(255) NOT NULL DEFAULT '',
`conversation` varchar(32) NOT NULL DEFAULT '',
`created_at` datetime DEFAULT current_timestamp(),
@ -11,8 +10,7 @@ CREATE TABLE
PRIMARY KEY (`id`)
);
CREATE TABLE
`nsfw_content` (
CREATE TABLE `nsfw_content` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`text` varchar(255) NOT NULL DEFAULT '',
`created_at` datetime DEFAULT current_timestamp(),
@ -20,8 +18,7 @@ CREATE TABLE
PRIMARY KEY (`id`)
);
CREATE TABLE
`learn` (
CREATE TABLE `learn` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`command` varchar(255) NOT NULL,
`result` varchar(255) NOT NULL,

View file

@ -20,10 +20,12 @@ const release = version
.slice((semver.coerce(version)?.toString() + '-').length)
.split('.')[1]
if (release.startsWith('d')) {
if (release.startsWith('e')) {
container.release = 'EXPERIMENTAL'
} else if (release.startsWith('d')) {
container.release = 'DEV'
} else if (release.startsWith('p')) {
container.release = 'PRE-RELEASE'
container.release = 'PREVIEW'
} else {
container.release = 'RELEASE'
}
@ -80,7 +82,7 @@ declare module '@sapphire/framework' {
port: number
}
}
release: 'DEV' | 'PRE-RELEASE' | 'RELEASE'
release: 'EXPERIMENTAL' | 'DEV' | 'PREVIEW' | 'RELEASE'
}
}

View file

@ -28,7 +28,8 @@ class DeleteLearnCommand extends Command {
const command = await args.rest('string').catch(() => null)
const options: SelectMenuComponentOptionData[] = []
const db = this.container.database
const [datas] = await db.database.execute<LearnData[]>(
const deleteDataList: string[] = []
const [deleteDatas] = await db.database.execute<LearnData[]>(
'SELECT * FROM learn WHERE command = ? AND user_id = ?;',
[command, msg.author.id],
)
@ -39,27 +40,24 @@ class DeleteLearnCommand extends Command {
)
}
if (!datas) {
if (!deleteDatas) {
return await msg.channel.send('해당하는 걸 찾ㅈ을 수 없어요.')
}
datas.forEach(data => {
console.log(data)
for (let i = 1; i <= deleteDatas.length; i++) {
deleteDataList.push(`${i}. ${deleteDatas[i - 1].result}`)
options.push({
label: `${data.id}`,
value: `${CUSTOM_ID}-${data.id}`,
description: data.result.slice(0, 100),
})
label: `${i}번 지식`,
value: `${CUSTOM_ID}-${deleteDatas[i - 1].id}`,
description: deleteDatas[i - 1].result.slice(0, 100),
})
}
await msg.reply({
embeds: [
{
title: '삭제',
description: `${codeBlock(
'md',
datas.map(data => `${data.id}. ${data.result}`).join('\n'),
)}`,
description: `${codeBlock('md', deleteDataList.join('\n'))}`,
timestamp: new Date().toISOString(),
},
],

View file

@ -30,6 +30,11 @@ class DeleteLearnHandler extends InteractionHandler {
const id = interaction.values[0].slice(`${this._CUSTOM_ID}-`.length)
const db = this.container.database
const decimalRegexp = /^[0-9]/g
const itemId = interaction.component.options.map(item =>
item.value.endsWith(id) ? item.label.match(decimalRegexp)![0] : null,
)
await db.learn.delete(id)
@ -37,7 +42,7 @@ class DeleteLearnHandler extends InteractionHandler {
embeds: [
{
title: '삭제',
description: `${id}번을 정상적으로 삭제하ㅇ였어요.`,
description: `${Number(itemId!)}번을 정상적으로 삭제하ㅇ였어요.`,
timestamp: new Date().toISOString(),
},
],

View file

@ -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<true>) {
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: {

148
yarn.lock
View file

@ -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,36 +2541,35 @@ __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"
tsup: "npm:^8.2.3"
typescript: "npm:^5.5.4"
undici: "npm:^6.19.4"
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
@ -3265,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
@ -3363,10 +3433,10 @@ __metadata:
languageName: node
linkType: hard
"undici@npm:^6.19.4":
version: 6.19.4
resolution: "undici@npm:6.19.4"
checksum: 10c0/d6cb7227893140abab3c216bd2817f24a34270b23be316ff9ddbdbb18e3b528e29e0a20cd33ab1bc0d3f604d652e7baf3f39f6760470b3027d83bc6270f90e43
"undici@npm:6.19.8":
version: 6.19.8
resolution: "undici@npm:6.19.8"
checksum: 10c0/07fd8520bce7e34ea29c07ef0de27b734183042cdb4e2f1262cd1fb9b755a6b04ff2471040395dfb1770fb7786069a97c5178bcf706b80a34075994f46feb37c
languageName: node
linkType: hard