Quadnite-Bot/commands/info.js

37 lines
960 B
JavaScript
Raw Normal View History

2019-02-12 19:28:22 +01:00
module.exports = () => (ctx) => {
let text = "";
const msg = ctx.message;
text += `Message ID: \`${msg.message_id}\`\n`;
text += `Chat ID: \`${msg.chat.id}\`\n`;
text += `User ID: \`${msg.from.id}\`\n`;
2024-01-24 20:08:35 +01:00
if (ctx.message.reply_to_message && !ctx.message.reply_to_message.is_topic_message) {
2019-02-12 19:28:22 +01:00
const reply = msg.reply_to_message;
text += "\n*Reply to*\n";
text += `Message ID: \`${reply.message_id}\`\n`;
text += `Chat ID: \`${reply.chat.id}\`\n`;
text += `User ID: \`${reply.from.id}\`\n`;
if (reply.forward_from || reply.forward_from_chat) {
const forward = reply.forward_from ? reply.forward_from
:reply.forward_from_chat;
text += "\n*Forward from*\n";
if (reply.forward_from)
text += "User ID: ";
else
text += "Channel ID: ";
text += `\`${forward.id}\`\n`;
text += "Message Date: `";
2019-02-14 15:31:02 +01:00
const date = new Date(reply.forward_date*1000);
2019-02-12 19:28:22 +01:00
text += date.toUTCString();
text += "`";
}
}
return text;
};