npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

create-telebot-app

v1.0.3

Published

Creates a boilerplate telebot project which lets you easily create your telegram bot.

Downloads

11

Readme

Create Telebot App

An even easier way to write Telegram bots

A cli app which generates a pre-constructed telegram bot template which uses telebot as its main module.

By NiGhTFuRy

🔨 Installation

npm install -g create-telebot-app

📜 DESCRIPTION

  • 📲 Advanced Telegram Bot Template generator.
  • 📲 Smart commands and event handling system.
  • 📲 Built-in Administration system.
  • 📲 Error Logging system.
  • 📲 Ready-To-Use Bot with sample commands upon set up.

❓ How to use

First of all create a bot using BotFather and customize it, then copy the API_KEY

Next execute the following commands in the terminal:

  • 🖌️ npm install -g create-telebot-app
  • 🖌️ npx create-telebot-app or just create-telebot-app
  • Now using the arrow keys select the template you'd like to create,
  • Now enter a name, a directory with the name you provide will be created and the project will be initialized inside of it. if you would like to initialize the project in the current directory just type a single dot and press Enter. This way the program will inherit the current directory name and name the project after it, no directory will be created and everything will be set up in the current directory.
  • after the setup is done navigate to the project directory and set the .env values.
  • run npm start and enjoy 💓✨

🛠️ Setup .env

✅ Make sure the values in .env are set.

❕ DATABASE_FILENAME and API_KEY must be set before starting and DATABASE_FILENAME must not be changd after the first time starting the script.

Example of .env:

API_KEY=5763260291:AAGATJAKr4EOc0JR2EnNETR_rYjhONrYo0U
SKIP_COMMANDS_ON_TEXT=true
ADMINS=111733645,111733645
LOG_CHANNEL_ID=
DATABASE_FILENAME=data.sqlite3

⚠️ DATABASE_FILENAME must not be changed after the first time you run npm start!, Upon starting the bot for the first time the app will check for the DATABASE_FILENAME you provided, if exists it will use it, if not it will be created. If you change the name a new database will be created and the bot wouldn't use the previous database unless you change the name back.


🍽️ Templates

  • /Basic-Template is the template without data base and administration system.
  • /Full-Template is the template with database and admin commands pre-written.

Each template have multiple directories such as:

  • /commands where each command or a group of related commands will be unique to their own file, this allows the division of different commands of the bot to improve readablity and easier debugging for each command.

    • all commands must follow the same structure as bellow:
    module.exports = {
        name: 'name_of_command', // or commands -> ['command1', 'command2']
        async execute(bot, msg, args) {
            // < -- your code here -- >
        }
    }

    note that each commands file must export a module with name and execute properties otherwise you'll run to an error.

    💼 In case you need to use execute recursively you can do the following:

        module.exports = {
        name: 'name_of_command', // or commands -> ['command1', 'command2']
        execute: async function execute(bot, msg, args) {
            // < -- your code here -- >
            // now you can call execute recursively.
        }
    }
  • /events where each event or a group of related events will be unique to their own file.(events must be denfined in telebot, check out main telebot docs to read more about all events)

    • Events follow the same structure as commands but in /events you can mix events and commands together:
        module.exports = {
        // for example you can group an event and a command together.
        // by putting a forward slash behind its name, it will be treated as a command
        name: ['text', '/say'],
        async execute(bot, msg, args) {
            // < -- your code here -- >
        }
    }
  • /modifiers where each modifier will be defined in its own file, modifiers may affect other events or commands as they manipulate data before passing it to events or commands (read more on official telebot docs)

    • a modifier for text event is already defined in the Full-Template modifiers, do not touch the codes inside modifiers/text.js as database user handling is done inside of it. (unless you know what you are doing)

💌 NOTES

  • To contact us directly join our discord server by clicking Here
  • Any Recommendation will be appreciated, don't forget Pull requests if you have any idea to improve this project . 👙🤺

Do not HeZiTaTe to open issues if there was any problem! ❤️❤️❤️