Compare commits

..

2 commits

Author SHA1 Message Date
466bed7e2b
chore: Fix eslint ignore list 2024-10-19 19:17:05 +09:00
e9acc545e4
chore: Edit nodemon exec 2024-10-19 18:57:42 +09:00
3 changed files with 7 additions and 21 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "muffinbot", "name": "muffinbot",
"version": "4.0.0-pudding.p241027a", "version": "4.0.0-pudding.p241018a",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"private": true, "private": true,
"dependencies": { "dependencies": {

View file

@ -65,13 +65,8 @@ export default class MuffinBot extends SapphireClient {
} }
public override async login(): Promise<string> { public override async login(): Promise<string> {
if (container.channel === 'RELEASE') { if (container.channel === 'RELEASE') await container.chatBot.train(this)
if (!config.train.user_ID) else {
container.logger.info(
'[MuffinBot] .env파일에 TRAIN_USER_ID값이 없어서 학습 기능이 꺼졌어요.',
)
else await container.chatBot.train(this)
} else {
container.logger.info( container.logger.info(
'[MuffinBot] 해당 채널은 RELEASE 채널이 아니라서 학습 기능이 꺼졌습니다.', '[MuffinBot] 해당 채널은 RELEASE 채널이 아니라서 학습 기능이 꺼졌습니다.',
) )

View file

@ -1,22 +1,13 @@
import 'dotenv/config' import 'dotenv/config'
function getConfigValue(
value: 'BOT_TOKEN' | 'BOT_OWNER_ID' | 'BOT_PREFIX',
) {
const configValue = process.env[value]
if (!configValue)
throw new Error(`.env 파일에서 ${value}값을 찾을 수 없어요.`)
return configValue
}
export default class MAAConfig { export default class MAAConfig {
public readonly bot = { public readonly bot = {
token: getConfigValue('BOT_TOKEN'), token: process.env.BOT_TOKEN!,
owner_ID: getConfigValue('BOT_OWNER_ID'), owner_ID: process.env.BOT_OWNER_ID!,
prefix: getConfigValue('BOT_PREFIX'), prefix: process.env.BOT_PREFIX!,
} }
public readonly train = { public readonly train = {
user_ID: process.env.TRAIN_USER_ID, user_ID: process.env.TRAIN_USER_ID!,
} }
} }