1
1
mirror of https://gitlab.com/ceda_ei/Quadnite-Bot synced 2026-05-06 05:40:04 +02:00

Disallow insult / kys on bot

This commit is contained in:
2019-02-12 03:09:42 +05:30
parent 71809ed109
commit b6edbb8b3b
2 changed files with 24 additions and 6 deletions

View File

@@ -1,9 +1,11 @@
module.exports = (random, kys, default_text) => (ctx) => {
module.exports = (random, kys, default_text, bot_text, excluded_names) => (ctx) => {
if (ctx.message.reply_to_message) {
const { from } = ctx.message.reply_to_message;
const name = from.username ? "@" + from.username : from.firstName;
if (name == excluded_names[0])
return bot_text;
return random(kys)().replace(/##name##/g, name);
} else {
@@ -12,6 +14,10 @@ module.exports = (random, kys, default_text) => (ctx) => {
if (text_array.length > 1) {
const name = text_array[1];
if (excluded_names.includes(name)
|| excluded_names.includes("@" + name))
return bot_text;
return random(kys)().replace(/##name##/g, name);
} else