This commit is contained in:
Siwoo Jeon 2023-02-17 18:14:28 +09:00
parent 67809bd834
commit 99d2bc2d80
Signed by: migan
GPG key ID: C4151385FFD2082A
4 changed files with 28 additions and 7 deletions

View file

@ -9,6 +9,7 @@ import { Command, noPerm, ChatBot, NODE_ENV } from './modules'
import { readdirSync } from 'node:fs'
import { join } from 'node:path'
import 'dotenv/config'
import { execSync } from 'node:child_process'
const prefix = '멒힌아 '
@ -40,6 +41,9 @@ export default class MuffinAI extends Client {
})
this.once('ready', () => {
console.log(
`Build Number: ${execSync('git rev-parse --short HEAD').toString()}`
)
this.user!.setActivity({
type: ActivityType.Playing,
name: 'ㅅ살려주세요..!',

View file

@ -1,4 +1,4 @@
import { Command, ResponseData } from '../modules'
import { Command, type ResponseData, type NSFWData } from '../modules'
import { type Message } from 'discord.js'
export default class extends Command {
@ -8,11 +8,14 @@ export default class extends Command {
public async execute(msg: Message, args: string[]) {
const db = await msg.client.chatBot.db
const [rows] = await db.execute<ResponseData[]>('SELECT * FROM statement;')
const [nsfw] = await db.execute<NSFWData[]>('SELECT * FROM nsfw_content;')
const muffin: ResponseData[] = []
rows.forEach(row => {
if (row.persona === 'muffin') muffin.push(row)
else return
})
msg.channel.send(`머핀 데이터: ${muffin.length}`)
msg.channel.send(
`머핀 데이터: ${muffin.length}\nnsfw 데이터: ${nsfw.length}`
)
}
}

View file

@ -5,15 +5,18 @@ import {
} from 'mysql2/promise'
import 'dotenv/config'
export interface ResponseData extends RowDataPacket {
export interface BaseData extends RowDataPacket {
id: number
text: string
created_at: string
persona: string
}
export interface ResponseData extends BaseData {
search_text: string
conversation: string
created_at: string
in_response_to: string | null
search_in_response_to: string
persona: string
}
export const config: ConnectionOptions = {
@ -24,4 +27,6 @@ export const config: ConnectionOptions = {
port: (process.env.MYSQL_PORT as unknown as number) || 3306,
}
export { BaseData as NSFWData }
export default createConnection(config)

View file

@ -1,6 +1,15 @@
import ChatBot from './ChatBot'
import Command from './Command'
import database, { ResponseData, config } from './database'
import database, { ResponseData, config, NSFWData } from './database'
import noPerm from './noPerm'
import { NODE_ENV } from './env'
export { ChatBot, Command, database, noPerm, ResponseData, config, NODE_ENV }
export {
ChatBot,
Command,
database,
noPerm,
ResponseData,
config,
NODE_ENV,
NSFWData,
}