by edwin0207



A modular telegram Python bot running on python3 with an sqlalchemy database.

Originally a simple group management bot with multiple admin features, it has evolved, becoming extremely modular and simple to use.


Can be found on telegram as Shelvy.

Shelvy and I are moderating a support group, where you can ask for help setting up your bot, discover/request new features, report bugs, and stay in the loop whenever a new update is available. Of course I'll also help when a database schema changes, and some table column needs to be modified/added. Note to maintainers that all schema changes will be found in the commit messages, and its their responsibility to read any new commits.

Alternatively, find me on telegram! (Keep all support questions in the support chat, where more people can help you.)

Starting the bot.

Simply press Deploy to Heroku button above than fill the empty box with env variables.

Setting up the bot (Read this before trying to use!):

Please make sure to use python3.6, as I cannot guarantee everything will work as expected on older python versions! This is because markdown parsing is done by iterating through a dict, which are ordered by default in 3.6.


The following env variables are supported:

  • ENV: Setting this to ANYTHING will enable env variables
  • TOKEN: Your bot token, as a string.
  • OWNER_ID: An integer of consisting of your owner ID
  • OWNER_USERNAME: Your username
  • DATABASE_URL: Your database URL
  • MESSAGE_DUMP: optional: a chat where your replied saved messages are stored, to stop people deleting their old
  • LOAD: Space separated list of modules you would like to load
  • NO_LOAD: Space separated list of modules you would like NOT to load
  • WEBHOOK: Setting this to ANYTHING will enable webhooks when in env mode messages
  • URL: The URL your webhook should connect to (only needed for webhook mode)
  • SUDO_USERS: A space separated list of user_ids which should be considered sudo users
  • SUPPORT_USERS: A space separated list of user_ids which should be considered support users (can gban/ungban, nothing else)
  • WHITELIST_USERS: A space separated list of user_ids which should be considered whitelisted - they can't be banned.
  • DONATION_LINK: Optional: link where you would like to receive donations.
  • CERT_PATH: Path to your webhook certificate
  • PORT: Port to use for your webhooks
  • DEL_CMDS: Whether to delete commands from users which don't have rights to use that command
  • STRICT_GBAN: Enforce gbans across new groups as well as old groups. When a gbanned user talks, he will be banned.
  • WORKERS: Number of threads to use. 8 is the recommended (and default) amount, but your experience may vary. Note that going crazy with more threads wont necessarily speed up your bot, given the large amount of sql data accesses, and the way python asynchronous calls work.
  • BAN_STICKER: Which sticker to use when banning people.
  • ALLOW_EXCL: Whether to allow using exclamation marks ! for commands as well as /.