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

aoitelegram

v1.0.0

Published

A powerful package to create Telegram Bots with built-in string functions

Downloads

647

Readme

AoiTelegram

NPM Version Bot API NPM Downloads License

aoitelegram is a JavaScript/TypeScript library for creating Telegram bots with ease. It simplifies the process of building and managing Telegram bot functionality, similar to aoijs but tailored for Telegram.

Features

  • Over 200 Pre-built Functions: aoitelegram comes equipped with more than 200 pre-built functions, empowering you to effortlessly create dynamic and interactive Telegram bots.

  • Built-in Custom Function System: aoitelegram has very good support for custom functions. Besides, aoitelegram has classes for working with extensions that you can create.

  • CommonJS/ESM Support: aoitelegram now supports modules like CommonJS/ESM for more convenient development on NodeJS.

  • User-Friendly Design: aoitelegram is perfect for beginners with its straightforward function interface. The $ prefix simplifies command writing, ensuring a swift launch for your bot. 🚀

Starting from v1, aoitelegram has an improved parser/interpreter that ensures proper functioning of $if/$else/$endif similar to bdfd.

Installation

To use aoitelegram in your project, you can install it via npm:

npm install aoitelegram

Usage

Here's a quick example of how to use aoitelegram to create a Telegram bot:

// CommonJS
const { AoiClient, LoadCommands } = require("aoitelegram");
// Esm/TypeScript
import { AoiClient, LoadCommands } from "aoitelegram";

const bot = new AoiClient("YOUR_BOT_TOKEN_HERE", {
  /** Optional request options for fetch **/
  telegram?: RequestInit;
  /** Functions that will be removed from the library's loading functions. **/
  disableFunctions?: string[],
  /** An array of AoiExtension functions **/
  extension?: AoiExtension[],
  /** For the error handler of functions **/
  functionError?: boolean,
  /** To disable text errors **/
  sendMessageError?: boolean,
  /** Outputting system messages to the console. **/
  logging?: boolean,
  /** Auto register bot commands **/
  myCommands?: {
    /** Allow command registration **/
    register?: boolean,
    /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */
    scope?: BotCommandScope,
   /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */
    language_code?: string,
  },
  /** Checks for available package updates and performs an update if enabled **/
  autoUpdate?: {
    /** Displaying messages about new versions. **/
    aoiWarning?: boolean,
    /**  Whether automatic updates are enabled. **/
    autoUpdate?: boolean,
    /** Whether to enable development versions. **/
    enableDev?: boolean,
    /** Whether to enable beta versions. **/
    enableBeta?: boolean,
  },
});

bot.addEvent(["onReady", "onMessage", "onCallbackQuery", "onFunctionError"]);

bot.functionErrorCommand({
  code: `$sendMessage[Sorry, but there was an error in the $handleError[function] function within the $handleError[command] command: $handleError[error]]`,
});

bot.readyCommand({
  code: `$print[Starting @$getMe[username]]`,
});

bot.messageCommand({
  code: `$print[Message Handle]`,
});

bot.callbackQueryCommand({
  code: `$print[Action Handle]`,
});

// Define a command to print a message.
bot.addCommand({
  command: "say",
  code: `$replyMessage[$eventData[text]]`,
});

// Define a command to check the bot's ping.
bot.addCommand({
  command: "ping",
  code: `$replyMessage[Bot ping: $pingms]`,
});

// Define a command to display bot information.
bot.addCommand({
  command: "botinfo",
  code: `
$replyMessage[
Bot ID: $getMe[id]
Name: $getMe[first_name]
Username: $getMe[username]
Ping: $pingms
]`,
});

const loader = new LoadCommands(bot);
loader.loadCommands("./command/");

bot.connect();

Documentation

For detailed documentation and usage instructions, please refer to the aoitelegram Wiki.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please create a GitHub issue or submit a pull request. Additionally, feel free to reach out to me on Telegram via my group AoiTelegram or on Discord using my username sempaika_chess.