Package: tgbot
A Python Telegram BotWelcome to a UWSGI based abstract Telegram Bot. With this framework you
are easily able to set up a complete Telegram Bot with self made
commands without a lot of extra work. All abstract commands are
implemented as GET-Responses as explained onhttps://core.telegram.org/bots/api. This means you don’t need to have
experience in HTTP Requests or PHP: All you need is python.In the next few chapters I will explain you all the Features and how to
properly set up the bot.Set UpFirst of all, as we are talking about anabstractbot you first need
toimplementthis package.For programming with the bot, you need the following:At least Python 3.XA good supported Python IDE (for example PyCharm)This python package , available on pypiAn example implementation of this bot will be soon available in the
example folder.For using your bot implemenation on a real serverAt least Python 3.XInstall this package with pip install xxxxInstall regis with pip install redisInstall uwsgi with pip install uwsgiWarning: It’s recommended that you install all packages used for your
bot on a virtual environment to not mess up your OS. All infos about
Virtual Environments can be read onhttp://docs.python-guide.org/en/latest/dev/virtualenvs/. With virtual
environments you can keep all the used requirements only for this
project / bot.More instructions will follow.FeaturesCommands and Inline CommandsThis Bot support both the normal commands and the newly added inline
commands. To add new commands you simply create methods inside either a
Command- or InlineCommandClass. The name of the method is the command
itself. To add more command- inlinecommandclasses to your bot you simply
add the to the lists which you give the class TGBotWSGI when you
initialise the bot. For more information check the example.ConfigurationAll configurations are managed by *.ini - files.UWSGIBotFor correctly configuring the bot, you need a file
/resources/config/config.ini inside your bot project. All needed
attributes will be explained here in future and will also be shown in
the example.LoggingThe Bot supports a complete logger and can be accessed in
telegram/tglogging/init.py .FilesYou are able to save several data in .json files. To define new files
you simply define a folder for all your json filesm in the
bot-configuration and define json-file-names in a list when implementing
the classTGBotWSGI.RedisFile ServerTo save performance when e.g. loading files, a cache server is
implemented. Every time a command has been recognized, all the created
files will be loaded into the cache of this server, if the cache is
empty. If it is not empty, every time a command has been recognized the
cache will be used to make the bot more performant.Limit ServerTo prevent spam there is a limit cache server. In the config.ini you are
able to set the amount and time of a limit: - Amount: How many commands
are allowed until you start to restrict the use of the bot? - Time: What
period are we looking at? When will the restriction be resetted?Conversation ServerFurthermore a conversation cache server has also been added to add
support for longer command conversations. If you , for example, start
with a command, the bot then can answer back with a second question. You
will then answer back etc. All these commands will be explained in the
next sub-chapter.More Documentation will follow.