Add username in feedback

This commit is contained in:
Ceda EI 2024-04-16 19:15:54 +05:30
parent 5ededd535f
commit bdf52331b1
2 changed files with 15 additions and 4 deletions

View File

@ -1,14 +1,25 @@
module.exports = (feedback_id) => (ctx) => { module.exports = (bot, feedback_id) => (ctx) => {
const message = ctx.message.text.replace(/^[^ ]+/, ""); const message = ctx.message.text.replace(/^[^ ]+/, "");
if (message) { if (message) {
const from = ctx.message.from;
let contactable = "The developer might contact you regarding your feedback.";
if (from.username) {
bot.telegram.sendMessage(feedback_id, `Feedback from: @${from.username}`);
} else {
contactable = "The developer might not be able to contact you due to lack of your username.";
}
ctx.forwardMessage(feedback_id); ctx.forwardMessage(feedback_id);
return "Thanks for the feedback"; return `Thanks for the feedback! ${contactable}`;
} else { } else {
return "To send feedback type in /feedback followed by the feedback"; return "To send feedback type in /feedback followed by the feedback. Note that developers may contact you regarding the feedback.";
} }

View File

@ -55,7 +55,7 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay
"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))); bot.command("feedback", (ctx) => ctx.reply(feedback(bot, feedback_id)(ctx)));
bot.command("wiki", (ctx) => media_wiki(axios, bot.command("wiki", (ctx) => media_wiki(axios,
"https://en.wikipedia.org/w/api.php")(ctx).then(x => ctx.reply(x, "https://en.wikipedia.org/w/api.php")(ctx).then(x => ctx.reply(x,
{parse_mode: "HTML"}))); {parse_mode: "HTML"})));