Markdown formatting + some fixes

This commit is contained in:
Lucas Gabriel 2024-06-02 00:26:48 +00:00
parent 1ec0af7cdb
commit 57154bcb70
8 changed files with 56 additions and 63 deletions

View file

@ -10,27 +10,27 @@ module.exports = function(bot, msg) {
let isForumOutput = "";
if (isForum) {
isForumOutput = "This chat is a forum (has topics enabled)";
isForumOutput = "*This chat is a forum (has topics enabled).*";
} else {
isForumOutput = "This chat is not a forum (doesn't have topics enabled)";
};
isForumOutput = "*This chat is not a forum (doesn't have topics enabled).*";
}
if (chatHandle) {
chatHandleOutput = `Chat handle: @${chatHandle}`;
chatHandleOutput = `*Chat handle:* @${chatHandle}`;
} else {
chatHandleOutput = `Chat handle: none (private group)`;
};
chatHandleOutput = `*Chat handle:* none (private group)`;
}
// if chatName returns undefined, the chat is not a group or channel
if (chatName) {
chatNameOutput = `Chat name: ${chatName}\n${chatHandleOutput}\nChat ID: ${chatId}\n\n${isForumOutput}`;
chatNameOutput = `*Chat name:* ${chatName}\n${chatHandleOutput}\n*Chat ID:* ${chatId}\n\n${isForumOutput}`;
} else {
chatNameOutput = `Whoops!\nThis command doesn't work in PM.`
};
chatNameOutput = "Whoops!\nThis command doesn't work in PM.";
}
const message = chatNameOutput;
bot.sendMessage(chatId, message)
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
.catch(error => console.error('ERROR: Message cannot be sent:', error));
console.log(`INFO: /chatinfo executed by ${userName}, ${userId}`);
}
}