mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 12:21:00 -05:00
Fix bot not responding to certain triggers properly.
This commit is contained in:
parent
1c41672103
commit
a5b12217a3
@ -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