mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
Fix bot not responding to certain triggers properly.
This commit is contained in:
parent
671d0c1b7a
commit
16bb01058e
@ -18,7 +18,7 @@ export default class Response {
|
|||||||
this.respond(client, message, keyword);
|
this.respond(client, message, keyword);
|
||||||
}
|
}
|
||||||
protected 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)]}`)
|
if (new RegExp(`^(${this.incomingArrays[responseKeyword].join('|')})\\b`, 'i').test(message.content)) 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) {
|
private static outgoingArrays(client:TClient, message:Discord.Message) {
|
||||||
const PersonnyMcPerson = `**${message.member.displayName}**`;
|
const PersonnyMcPerson = `**${message.member.displayName}**`;
|
||||||
|
Loading…
Reference in New Issue
Block a user