module Tourmaline::Helpers

Extended Modules

Defined in:

tourmaline/helpers.cr

Constant Summary

DEFAULT_EXTENSIONS = {audio: "mp3", photo: "jpg", sticker: "webp", video: "mp4", animation: "mp4", video_note: "mp4", voice: "ogg"}
HTML_ENTITY_MAP = {"bold" => {"<b>", "</b>"}, "italic" => {"<i>", "</i>"}, "underline" => {"<u>", "</u>"}, "code" => {"<code>", "</code>"}, "pre" => {"<pre>\n", "\n</pre>"}, "pre_language" => {"<pre><code class=\"language-{language}\">\n", "\n</code></pre>"}, "strikethrough" => {"<s>", "</s>"}, "text_mention" => {"<a href=\"tg://user?id={id}\">", "</a>"}, "text_link" => {"<a href=\"{url}\">", "</a>"}, "spoiler" => {"<span class=\"tg-spoiler\">", "</span>"}}
MD_ENTITY_MAP = {"bold" => {"*", "*"}, "italic" => {"_", "_"}, "underline" => {"", ""}, "code" => {"`", "`"}, "pre" => {"```\n", "\n```"}, "pre_language" => {"```{language}\n", "\n```"}, "strikethrough" => {"", ""}, "text_mention" => {"[", "](tg://user?id={id})"}, "text_link" => {"[", "]({url})"}}
MDV2_ENTITY_MAP = {"bold" => {"*", "*"}, "italic" => {"_", "_"}, "underline" => {"__", "__"}, "code" => {"`", "`"}, "pre" => {"```\n", "\n```"}, "pre_language" => {"```{language}\n", "\n```"}, "strikethrough" => {"~", "~"}, "text_mention" => {"[", "](tg://user?id={id})"}, "text_link" => {"[", "]({url})"}, "spoiler" => {"||", "||"}}

Instance Method Summary

Instance Method Detail

def escape_html(text) #

[View source]
def escape_md(text, version = 1) #

[View source]
def pad_utf16(text) #

[View source]
def random_string(length) #

[View source]
def unpad_utf16(text) #

[View source]
def unparse_html(text : String, entities ents : Array(MessageEntity)) #

[View source]
def unparse_text(text : String, entities ents : Array(MessageEntity), parse_mode : ParseMode = :markdown, escape : Bool = false) #

[View source]