1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 08:20:58 -05:00

Compare commits

..

No commits in common. "ad6c92a8d0f6c48648dd804d7abec3a8532ce1e6" and "e3f0da75b3c4c212e09077d878b9f68d19bb72f4" have entirely different histories.

2 changed files with 5 additions and 4 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,20 +6,21 @@ import TClient from '../client.js';
} */
export default class Response {
private static readonly incomingArrays = {
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);
}
protected static respond(client:TClient, message:Discord.Message, responseKeyword:string) {
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)]}`)
}
private static outgoingArrays(client:TClient, message:Discord.Message) {
static outgoingArrays(client:TClient, message:Discord.Message) {
const PersonnyMcPerson = `**${message.member.displayName}**`;
return {
morning: [