/telebot

Hyper-modular Telegram plugin bot in Typescript using Telegraf and Enmap.

Primary LanguageTypeScriptOtherNOASSERTION

Telebot



A hyper-modular Telegram plugin bot in Typescript using Telegraf and Enmap.

Prerequisites

Installation

  • Run npm i and then npm run start, it's as simple as that!
  • Don't forget to add your bot token to src/config.json from BotFather /token!
  • If you want to start using the set_the_table plugin example, set your ChatID in src/plugins/set_the_table/files/config.json.

How To Use

This project serves as the core of your next Telegram bot. Plugins have specific guidelines to make programming easy. To create a new plugin, make a new folder under plugins/, and give it a name. Next, add a commands/ and events/ subfolder. These folders are where you can set commands for your Telegram bot and handle events from the Telegram API when interactions occur. Check out the two example plugins I've provided! Within each plugin, you can include an init.ts file with an init() function that automatically starts loops, for instance, during bot launches.

Register Commands with BotFather

Return to your conversation with BotFather and use the /setcommands command for these two example plugins!

start - Hello!
help - Get help!
get_meals - Get the registered meals
set_meals - Set the meals
get_participants - Get participants for setting the table
set_participants - Set participants for setting the table
skip - Skip the designated person for setting the table
disable_set_the_table - Disable the feature

Notes

These example plugins do not utilize Scenes and WizardScene. I believe they add unnecessary complexity, but I could be mistaken. Feel free to integrate them; I'm open to pull requests!

Similar to WhatThePhoqueBOT, another bot using this plugin system, but for Discord, I might consider integrating MongoDB. However, at the moment, I think it might be overkill.

Libraries

License (CC BY-NC-ND 4.0)

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.