1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 04:10:59 -05:00

Compare commits

..

2 Commits

Author SHA1 Message Date
AnxietyisReal
ad6c92a8d0 Add modifiers to ResponseSystem 2023-08-31 11:15:41 +10:00
AnxietyisReal
c702f01007 Update DatabaseServer.ts 2023-08-31 10:26:14 +10:00
2 changed files with 4 additions and 5 deletions

View File

@ -26,5 +26,5 @@ export default async(client:TClient)=>{
.on('close', ()=>console.log(client.logTime(), `${LogPrefix} MongoDB has closed the connection`))
.on('all', ()=>console.log(client.logTime(), `${LogPrefix} Successfully established a connection to all members`))
.on('fullsetup', ()=>console.log(client.logTime(), `${LogPrefix} Successfully established a connection to Primary server & atleast one member`))
.on('error', ((err:mongoose.Error)=>console.error(client.logTime(), `${LogPrefix} Encountered an error in MongoDB: ${err.message}`)));
.on('error', (err:mongoose.Error)=>console.error(client.logTime(), `${LogPrefix} Encountered an error in MongoDB: ${err.message}`));
}

View File

@ -6,21 +6,20 @@ import TClient from '../client.js';
} */
export default class Response {
static readonly incomingArrays = {
private static readonly incomingArrays = {
morning: ['good morning all', 'good morning everyone', 'good morning lads', 'morning all', 'morning everyone', 'morning lads', 'morning guys', 'good morning everybody', 'morning yall', 'morning y\'all'],
afternoon: ['good afternoon', 'afternoon all', 'afternoon everyone'],
evening: ['good evening', 'evening all', 'evening everyone', 'evening lads'],
night: ['night all', 'night everyone', 'night guys', 'goodnight', 'good night']
} as const
static create(client:TClient, message:Discord.Message, channel:Discord.Snowflake, keyword:string) {
if (message.channelId != channel || message.type != 0) return;
this.respond(client, message, keyword);
}
static respond(client:TClient, message:Discord.Message, responseKeyword:string) {
protected static respond(client:TClient, message:Discord.Message, responseKeyword:string) {
if (this.incomingArrays[responseKeyword].some(m=>message.content.toLowerCase().startsWith(m))) return message.reply(`${this.outgoingArrays(client, message)[responseKeyword][Math.floor(Math.random() * this.outgoingArrays(client, message)[responseKeyword].length)]}`)
}
static outgoingArrays(client:TClient, message:Discord.Message) {
private static outgoingArrays(client:TClient, message:Discord.Message) {
const PersonnyMcPerson = `**${message.member.displayName}**`;
return {
morning: [