feat: Add warning message

This commit is contained in:
Siwoo Jeon 2024-08-02 18:41:44 +09:00
parent f9983d2fb4
commit 19cee7d44a
Signed by: migan
GPG key ID: C4151385FFD2082A
7 changed files with 73 additions and 5 deletions

20
.pnp.cjs generated
View file

@ -36,6 +36,7 @@ const RAW_RUNTIME_STATE =
["@sapphire/pieces", "npm:4.3.1"],\
["@sapphire/utilities", "npm:3.17.0"],\
["@types/node", "npm:20.14.12"],\
["@types/semver", "npm:7.5.8"],\
["@types/ws", "npm:8.5.11"],\
["@typescript-eslint/eslint-plugin", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:7.17.0"],\
["@typescript-eslint/parser", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:7.17.0"],\
@ -49,6 +50,7 @@ const RAW_RUNTIME_STATE =
["globals", "npm:15.8.0"],\
["mysql2", "npm:3.11.0"],\
["prettier", "npm:3.3.3"],\
["semver", "npm:7.6.3"],\
["ts-node", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:10.9.2"],\
["tsup", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:8.2.3"],\
["typescript", "patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=379a07"],\
@ -1033,6 +1035,15 @@ const RAW_RUNTIME_STATE =
"linkType": "HARD"\
}]\
]],\
["@types/semver", [\
["npm:7.5.8", {\
"packageLocation": "./.yarn/cache/@types-semver-npm-7.5.8-26073743d7-3496808818.zip/node_modules/@types/semver/",\
"packageDependencies": [\
["@types/semver", "npm:7.5.8"]\
],\
"linkType": "HARD"\
}]\
]],\
["@types/ws", [\
["npm:8.5.10", {\
"packageLocation": "./.yarn/cache/@types-ws-npm-8.5.10-a877a38f71-9b414dc5e0.zip/node_modules/@types/ws/",\
@ -2987,6 +2998,7 @@ const RAW_RUNTIME_STATE =
["@sapphire/pieces", "npm:4.3.1"],\
["@sapphire/utilities", "npm:3.17.0"],\
["@types/node", "npm:20.14.12"],\
["@types/semver", "npm:7.5.8"],\
["@types/ws", "npm:8.5.11"],\
["@typescript-eslint/eslint-plugin", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:7.17.0"],\
["@typescript-eslint/parser", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:7.17.0"],\
@ -3000,6 +3012,7 @@ const RAW_RUNTIME_STATE =
["globals", "npm:15.8.0"],\
["mysql2", "npm:3.11.0"],\
["prettier", "npm:3.3.3"],\
["semver", "npm:7.6.3"],\
["ts-node", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:10.9.2"],\
["tsup", "virtual:df417fa6ed58592061b3cdd25305c567cb83e355f566a3f712cecb8d4e6c4814c3ed842a030a9c3a51e2de30e93ecf82143ea19accc29756c7a7ac08166c7416#npm:8.2.3"],\
["typescript", "patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=379a07"],\
@ -3482,6 +3495,13 @@ const RAW_RUNTIME_STATE =
["semver", "npm:7.6.2"]\
],\
"linkType": "HARD"\
}],\
["npm:7.6.3", {\
"packageLocation": "./.yarn/cache/semver-npm-7.6.3-57e82c14d5-36b1fbe1a2.zip/node_modules/semver/",\
"packageDependencies": [\
["semver", "npm:7.6.3"]\
],\
"linkType": "HARD"\
}]\
]],\
["seq-queue", [\

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
{
"name": "muffinbot",
"version": "3.0.0-cake.p240801a",
"version": "3.0.0-cake.p240802a",
"main": "dist/index.js",
"private": true,
"dependencies": {
@ -13,6 +13,7 @@
"discord.js": "^14.15.3",
"dokdo": "^0.6.2",
"mysql2": "^3.11.0",
"semver": "^7.6.3",
"undici": "^6.19.4",
"ws": "^8.18.0"
},
@ -21,6 +22,7 @@
"@eslint/js": "^9.8.0",
"@migan/prettier-config": "^1.2.0",
"@types/node": "^20.14.12",
"@types/semver": "^7",
"@types/ws": "^8.5.11",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",

View file

@ -3,13 +3,26 @@ import { GatewayIntentBits, Partials, type Snowflake } from 'discord.js'
import { ChatBot, NODE_ENV, MaaDatabase } from './modules'
import { version } from '../package.json'
import config from '../config.json'
import semver from 'semver'
container.config = config
container.prefix = config.bot.prefix
container.version = version
container.database = new MaaDatabase()
container.chatBot = new ChatBot(container.database)
container.dokdoAliases = ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트']
container.chatBot = new ChatBot(container.database)
const release = version
.slice((semver.coerce(version)?.toString() + '-').length)
.split('.')[1]
if (release.startsWith('d')) {
container.release = 'DEV'
} else if (release.startsWith('p')) {
container.release = 'PRE-RELEASE'
} else {
container.release = 'RELEASE'
}
export default class MuffinBot extends SapphireClient {
public constructor() {
@ -25,6 +38,7 @@ export default class MuffinBot extends SapphireClient {
level: NODE_ENV === 'development' ? LogLevel.Debug : LogLevel.Info,
},
allowedMentions: {
users: [],
roles: [],
repliedUser: true,
},
@ -60,10 +74,8 @@ declare module '@sapphire/framework' {
database: string
port: number
}
api: {
opendict: string
}
}
release: 'DEV' | 'PRE-RELEASE' | 'RELEASE'
}
}

View file

@ -14,6 +14,22 @@ export default class extends Listener {
})
if (msg.author.bot) return
if (msg.content.startsWith(prefix)) {
if (this.container.release === 'PRE-RELEASE') {
await msg.reply({
embeds: [
{
title: '정식 출시 이전 버전 사용안내',
description:
`현재 이 버전의 ${this.container.client.user?.username}은 개발중ㅇ이라 오류가 있을수 있어요.\n` +
`만약 오류가 발견되면 ${(await this.container.client.users.fetch(this.container.config.bot.owner_ID)).username}님에게 알려주세요.\n`,
color: 0xff0000,
footer: {
text: `현재 브랜치: ${this.container.release.toLowerCase()} 버전: ${this.container.version}`,
},
},
],
})
}
const args = msg.content.slice(prefix.length).trim().split(/ +/g)
this.container.logger.debug(`[ChatBot] command: ${args.join(' ')}`)

View file

@ -809,6 +809,13 @@ __metadata:
languageName: node
linkType: hard
"@types/semver@npm:^7":
version: 7.5.8
resolution: "@types/semver@npm:7.5.8"
checksum: 10/3496808818ddb36deabfe4974fd343a78101fa242c4690044ccdc3b95dcf8785b494f5d628f2f47f38a702f8db9c53c67f47d7818f2be1b79f2efb09692e1178
languageName: node
linkType: hard
"@types/ws@npm:^8.5.10":
version: 8.5.10
resolution: "@types/ws@npm:8.5.10"
@ -2467,6 +2474,7 @@ __metadata:
"@sapphire/pieces": "npm:^4.3.1"
"@sapphire/utilities": "npm:^3.17.0"
"@types/node": "npm:^20.14.12"
"@types/semver": "npm:^7"
"@types/ws": "npm:^8.5.11"
"@typescript-eslint/eslint-plugin": "npm:^7.17.0"
"@typescript-eslint/parser": "npm:^7.17.0"
@ -2480,6 +2488,7 @@ __metadata:
globals: "npm:^15.8.0"
mysql2: "npm:^3.11.0"
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"
@ -2929,6 +2938,15 @@ __metadata:
languageName: node
linkType: hard
"semver@npm:^7.6.3":
version: 7.6.3
resolution: "semver@npm:7.6.3"
bin:
semver: bin/semver.js
checksum: 10/36b1fbe1a2b6f873559cd57b238f1094a053dbfd997ceeb8757d79d1d2089c56d1321b9f1069ce263dc64cfa922fa1d2ad566b39426fe1ac6c723c1487589e10
languageName: node
linkType: hard
"seq-queue@npm:^0.0.5":
version: 0.0.5
resolution: "seq-queue@npm:0.0.5"