edit: db path
This commit is contained in:
parent
7250a6ddb5
commit
8d1b44a82a
2 changed files with 6 additions and 5 deletions
2
example.env
Normal file
2
example.env
Normal file
|
@ -0,0 +1,2 @@
|
|||
DISCORD_TOKEN='BOT_TOKEN'
|
||||
DB_PATH='DB_PATH'
|
|
@ -1,5 +1,5 @@
|
|||
import type { Client, Message } from 'discord.js'
|
||||
import { join } from 'node:path'
|
||||
// import { join } from 'node:path'
|
||||
import Database from './Database'
|
||||
|
||||
type TrainType = 'muffinOnly' | 'All'
|
||||
|
@ -12,18 +12,17 @@ export default class ChatBot {
|
|||
set trainType(value: TrainType) {
|
||||
this._trainType = value
|
||||
}
|
||||
public db = new Database(join(__dirname, '..', 'db', 'db.sqlite3'))
|
||||
public db = new Database(process.env.DB_PATH!)
|
||||
private _trainType: TrainType = 'All'
|
||||
public constructor() {}
|
||||
|
||||
public getResponse(msg: Message, sendMsg?: boolean): ChatBot {
|
||||
this.db
|
||||
.all()
|
||||
.then(rows => {
|
||||
const a = msg.content.replace('머핀아', '')
|
||||
const a = msg.content.replace('머핀아 ', '')
|
||||
let r = rows[Math.floor(Math.random() * rows.length)].text
|
||||
if (!r) r = '살ㄹ려주세요'
|
||||
console.log(`⌨️ ㅣ${a}`)
|
||||
console.log(`⌨️ㅣ${a}`)
|
||||
console.log(`🍰ㅣ${r}`)
|
||||
if (sendMsg) {
|
||||
msg.channel.sendTyping()
|
||||
|
|
Loading…
Reference in a new issue