
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
This is a library for creating progressive bots for Telegram. Based on the principle of MVS (Model, View, Service).
#TgAirBot
This is a library for creating progressive bots for Telegram. Based on the principle of MVS (Model, View, Service).
Uses TypeScript and in particular the extensive system of decorators.
####Work has just begun!!! ##Install
npm install tgairbot
##Install dependencies
npm i node-telegram-bot-api @types/node-telegram-bot-api
npm i @types/color colors
npm i dotenv
##Using
you project dir
|
+--dist (generated folder by typescript)
|
+--node_modules
|
+--src (folder for your bot)
| |
| |
| +--...folders module
| |
| +--you module folder
| | |
| | +-- *.module.ts (module file)
| | |
| | +-- *.view.ts (view file)
| | |
| | +-- *.service.ts (service file)
| |
| +--main.ts (input file)
|
+--.env
|
+--package.json
|
+--tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}
{
...,
"scripts": {
"start": "node ./dist/main.js",
"start:dev": "tsc && npm run start"
},
...,
"dependencies": {
"@types/color": "^3.0.1",
"@types/node-telegram-bot-api": "^0.50.2",
"colors": "^1.4.0",
"dotenv": "^8.2.0",
"node-telegram-bot-api": "^0.50.0"
}
}
At the root of the project you need an .env file with the submitted fields
TELEGRAM_TOKEN=you telegram bot token
import { Airbot } from 'tgairbot/airbot'
import { HelloModule } from "./hello/hello.module"
const bot = new Airbot({polling: true})
bot.Create(HelloModule)
import { Module } from "tgairbot/module/module"
import { HelloView } from "./hello.view"
@Module({
name: "HelloModule",
imports: [],
views: [HelloView],
services: []
})
export class HelloModule {
constructor(...args: any[]) {}
}
import { View } from 'tgairbot/view/view'
import { HelloService } from './hello.service'
@View({
name: "HelloView",
service: [HelloService]
})
export class HelloView {
constructor(private helloService: HelloService) {}
first_message() {
return this.helloService.first_message()
}
}
import { Service } from "tgairbot/service/service"
@Service({
name: "HelloService"
})
export class HelloService {
first_message() {
return console.log("Hello")
}
}
FAQs
This is a library for creating progressive bots for Telegram. Based on the principle of MVS (Model, View, Service).
We found that tgairbot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.