/telegram-bot

Your Telegram Bot

Primary LanguagePython

Telegram Bot

Introduction

ICO projects usually use Telegram to build community, with its private, fast and free features.

With Telegram Bot, you can integrate some services into your user groups, such as automatically publishing scheduled notifications and news, interacting with users, providing information query through your own servers.

Getting started

This is just a starter, but you can go further by starting from here.

  • new bot: Introduction to the API
  • dotenv: add your token into a specified envrionment-based file, like .env.development, see sample
  • custom: add any command and implementation into tgbot
  • run: python tgbot.py
  • example features:
    • /chatid will reply current chat id. After got this chat id, you can actively send any messages to specified groups, and do any telegram group-based-access-control strategies.
    • kick out other bots. Bots are awesome, but some are not, you may have to kick other bots out to keep the group from chaos.

Performance

According to Getting Updates:

There are two mutually exclusive ways of receiving updates for your bot:

Use getUpdates is simple, and you can get started with this mechanism. But if your telegram group has been getting more and more intensive messages and your bot is getting slower, you may have to use Webhooks instead:

  • Avoids your bot having to ask for updates frequently.
  • Avoids the need for some kind of polling mechanism in your code.

For details, please read through Marvin's Marvellous Guide to All Things Webhook.

Reference