Quadnite-Bot/commands/feedback.js

29 lines
787 B
JavaScript
Raw Normal View History

2024-04-16 15:45:54 +02:00
module.exports = (bot, feedback_id) => (ctx) => {
2019-02-12 08:40:01 +01:00
const message = ctx.message.text.replace(/^[^ ]+/, "");
if (message) {
2024-04-16 15:45:54 +02:00
const from = ctx.message.from;
let contactable = "The developer might contact you regarding your feedback.";
let message;
2024-04-16 15:45:54 +02:00
if (from.username) {
message = `Feedback from: @${from.username}`;
2024-04-16 15:45:54 +02:00
} else {
contactable = "The developer might not be able to contact you due to lack of your username.";
message = `Feedback from User ${from.id}`;
2024-04-16 15:45:54 +02:00
}
bot.telegram.sendMessage(feedback_id, `${message} ${ctx.message.text}`).catch(console.log);
2024-04-16 15:45:54 +02:00
return `Thanks for the feedback! ${contactable}`;
2019-02-12 08:40:01 +01:00
} else {
2024-04-16 15:45:54 +02:00
return "To send feedback type in /feedback followed by the feedback. Note that developers may contact you regarding the feedback.";
2019-02-12 08:40:01 +01:00
}
};