Add /feedback
This commit is contained in:
parent
54f1e9a73b
commit
87fa5eb60c
4
bot.js
4
bot.js
|
@ -1,5 +1,5 @@
|
||||||
const Telegraf = require("telegraf");
|
const Telegraf = require("telegraf");
|
||||||
const { BOT_API_KEY } = process.env;
|
const { BOT_API_KEY, FEEDBACK_ID } = process.env;
|
||||||
const fs = require("fs").promises;
|
const fs = require("fs").promises;
|
||||||
const commands = require("./commands");
|
const commands = require("./commands");
|
||||||
|
|
||||||
|
@ -18,6 +18,6 @@ const data = [
|
||||||
|
|
||||||
Promise.all(data)
|
Promise.all(data)
|
||||||
.then(data =>
|
.then(data =>
|
||||||
commands(bot, data));
|
commands(bot, data, FEEDBACK_ID));
|
||||||
|
|
||||||
bot.launch();
|
bot.launch();
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
module.exports = (feedback_id) => (ctx) => {
|
||||||
|
|
||||||
|
const message = ctx.message.text.replace(/^[^ ]+/, "");
|
||||||
|
if (message) {
|
||||||
|
|
||||||
|
ctx.forwardMessage(feedback_id);
|
||||||
|
return "Thanks for the feedback";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return "To send feedback type in /feedback followed by the feedback";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
|
@ -4,7 +4,10 @@ const words_fun = require("./words");
|
||||||
const is = require("./is");
|
const is = require("./is");
|
||||||
const weebify = require("./weebify");
|
const weebify = require("./weebify");
|
||||||
const absurdify = require("./absurdify");
|
const absurdify = require("./absurdify");
|
||||||
module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => {
|
const feedback = require("./feedback");
|
||||||
|
|
||||||
|
module.exports = (bot, [ questions, kys, insults, commands_list, words ],
|
||||||
|
feedback_id) => {
|
||||||
|
|
||||||
bot.command("question", (ctx) => ctx.reply(random(questions)()));
|
bot.command("question", (ctx) => ctx.reply(random(questions)()));
|
||||||
bot.command("word", (ctx) => ctx.reply(random(words)()));
|
bot.command("word", (ctx) => ctx.reply(random(words)()));
|
||||||
|
@ -47,5 +50,6 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => {
|
||||||
"Markdown"}));
|
"Markdown"}));
|
||||||
bot.command("weebify", (ctx) => ctx.reply(weebify()(ctx)));
|
bot.command("weebify", (ctx) => ctx.reply(weebify()(ctx)));
|
||||||
bot.command("absurdify", (ctx) => ctx.reply(absurdify()(ctx)));
|
bot.command("absurdify", (ctx) => ctx.reply(absurdify()(ctx)));
|
||||||
|
bot.command("feedback", (ctx) => ctx.reply(feedback(feedback_id)(ctx)));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue