# aoitelegram

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

Latest version **1.0.0** (published 2024-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install aoitelegram
pnpm add aoitelegram
yarn add aoitelegram
bun add aoitelegram
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-07-21 |
| First published | 2023-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 9 |
| Unpacked size | 471.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Sempai |
| Maintainers | crazy-sempai07 |
| Keywords | javascript, typescript, telegram, library, telegramapi, bot, aoi, aoitelegram, bds.js, @aoitelegram, aoi.js |

## Links

- npm: https://www.npmjs.com/package/aoitelegram
- Repository: https://github.com/Sempai-07/aoitelegram
- Homepage: https://aoitelegram.vercel.app
- Issues: https://github.com/Sempai-07/aoitelegram/issues
- npm.io page: https://npm.io/package/aoitelegram

## Dependencies (9)

- [ms](https://npm.io/package/ms.md) ^2.1.3
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [loupe](https://npm.io/package/loupe.md) ^3.1.0
- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [figlet](https://npm.io/package/figlet.md) ^1.7.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.7.0
- [telegramsjs](https://npm.io/package/telegramsjs.md) ^3.3.0
- [long-timeout](https://npm.io/package/long-timeout.md) ^0.1.1
- [@aoitelegram/util](https://npm.io/package/@aoitelegram/util.md) ^1.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-07-21
- 1.0.0-beta.2 (beta) — 2024-06-10
- 1.0.0-beta.1 — 2024-04-28
- 0.8.2 — 2024-02-17
- 0.7.0 — 2024-02-10
- 0.6.0 — 2024-01-17
- 0.5.0 — 2024-01-06
- 0.4.0 — 2024-01-01
- 0.4.0-beta.1 — 2024-01-01
- 0.3.0 — 2023-12-21
- 0.2.1 — 2023-12-02
- 0.2.0 — 2023-12-02
- 0.1.2 — 2023-11-07
- 0.0.4 — 2023-10-25
- 0.0.3 — 2023-10-25
- … 3 more at https://npm.io/package/aoitelegram/versions

## README

# AoiTelegram

[![NPM Version](https://img.shields.io/npm/v/aoitelegram)](https://www.npmjs.com/package/aoitelegram)
[![Bot API](https://img.shields.io/badge/Bot%20API-v.7.5-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![NPM Downloads](https://img.shields.io/npm/dt/aoitelegram.svg?maxAge=3600)](https://www.npmjs.com/package/aoitelegram)
[![License](https://img.shields.io/npm/l/aoitelegram)](https://github.com/aoitelegram/aoitelegram/blob/v1/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:

```shell
npm install aoitelegram
```

## Usage

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

```typescript
// 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](https://aoitelegram.vercel.app/).

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/aoitelegram/aoitelegram/blob/main/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](https://t.me/aoitegram) or on Discord using my username `sempaika_chess`.

<table>
  <td><image src="https://avatars.githubusercontent.com/u/101444750?v=4"><a href="https://github.com/Asayukiii">Asayukiii</a></td>
  <td><image src="https://avatars.githubusercontent.com/u/141875262?v=4"><a href="https://github.com/gdeVanezus">gdeVanezus</a></td>
</table>

---
_Source: https://npm.io/package/aoitelegram · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
