Untitled
unknown
javascript
4 years ago
543 B
18
Indexable
async function styleAdder(text, style) {
const styles = {
bold: "*",
italic: "_",
code: "`",
pre: "```",
strikethrough: "~~",
underline: "__",
spoiler: "||",
};
if (styles.hasOwnProperty(style)) {
return `${styles[style]}${text}${styles[style]}`;
}
}
bot.onText(/\/send (.+)/, async (msg, message) => {
const h = message.input.split("/send ")[1];
let hh = await styleAdder(h, msg?.entities?.[1]?.type);
bot.sendMessage(msg.chat.id, hh, {
parse_mode: "MarkdownV2",
});
});Editor is loading...