module Tourmaline::Helpers
Extended Modules
Defined in:
tourmaline/helpers.crConstant Summary
-
DEFAULT_EXTENSIONS =
{audio: "mp3", photo: "jpg", sticker: "webp", video: "mp4", animation: "mp4", video_note: "mp4", voice: "ogg"}
Instance Method Summary
-
#escape_html(text)
Escape the given html for use in a Telegram message.
-
#escape_md(text, version = 1)
Escape the given markdown for use in a Telegram message.
-
#labeled_prices(lp : Array(NamedTuple(label: String, amount: Int32)))
Convenience method to create and
Array
ofLabledPrice
from anArray
ofNamedTuple(label: String, amount: Int32)
. -
#pad_utf16(text)
Pad the given text with spaces to make it a multiple of 4 bytes.
-
#random_string(length, characters = nil)
Return a random string of the given length.
-
#shipping_options(options : Array(NamedTuple(id: String, title: String, prices: Array(LabeledPrice))))
Convenience method to create an
Array
ofShippingOption
from aNamedTuple(id: String, title: String, prices: Array(LabeledPrice))
. -
#unpad_utf16(text)
Unpad the given text by removing spaces that were added to make it a multiple of 4 bytes.
Instance Method Detail
Convenience method to create and Array
of LabledPrice
from an Array
of NamedTuple(label: String, amount: Int32)
.
TODO Replace with a builder of some kind
Return a random string of the given length. If characters
is not given,
it will default to 0..9, a..z, A..Z.
Convenience method to create an Array
of ShippingOption
from a
NamedTuple(id: String, title: String, prices: Array(LabeledPrice))
.
TODO Replace with a builder of some kind
Unpad the given text by removing spaces that were added to make it a multiple of 4 bytes.