bot Module¶
Methods for the bot functionality.
-
bot.
HOMEPAGE
: str = 'https://hirschheissich.gitlab.io/praedikat-besonders-bottig/' Homepage of this bot.
- Type
-
bot.
STICKER_SET_NAME
: str = 'StickerGenerationSet' The name of the sticker set used to generate the sticker as read from
bot.ini
.- Type
-
bot.
build_sticker_set_name
(bot) Builds the sticker set name given by
STICKER_SET_NAME
for the given bot.- Parameters
bot (
Bot
) – The Bot owning the sticker set.- Return type
- Returns
str
-
bot.
clean_sticker_set
(bot) Cleans up the sticker set, i.e. deletes all but the first sticker.
- Parameters
bot (
Bot
) – The bot.- Return type
-
bot.
error
(update, context) Informs the originator of the update that an error occured and forwards the traceback to the admin.
- Parameters
update (
Update
) – The Telegram update.context (
CallbackContext
) – The callback context as provided by the dispatcher.
-
bot.
get_sticker_id
(predicate, context) Gives the sticker ID for the the requested sticker. If it was already build, just reads it from
bot_data
. Builds a new sticker, otherwise.
-
bot.
get_sticker_set
(bot, name) Get’s the sticker set and creates it, if needed.
- Parameters
bot (
Bot
) – The Bot owning the sticker set.name (
str
) – The name of the sticker set.
- Return type
StickerSet
- Returns
StickerSet
-
bot.
info
(update, context) Returns some info about the bot.
- Parameters
update (
Update
) – The Telegram update.context (
CallbackContext
) – The callback context as provided by the dispatcher.
- Return type
-
bot.
inline
(update, context) Answers an inline query by providing the requested sticker.
- Parameters
update (
Update
) – The Telegram update.context (
CallbackContext
) – The callback context as provided by the dispatcher.
-
bot.
message
(update, context) Answers a text message by providing the requested sticker.
- Parameters
update (
Update
) – The Telegram update.context (
CallbackContext
) – The callback context as provided by the dispatcher.
-
bot.
register_dispatcher
(disptacher) Adds handlers and sets up jobs. Convenience method to avoid doing that all in the main script.
- Parameters
disptacher (
Dispatcher
) – Thetelegram.ext.Dispatcher
.- Return type