https://github.com/irandeno/tea
Modern and Modular telegram framework for deno
https://github.com/irandeno/tea
deno telegram typescript
Last synced: 4 months ago
JSON representation
Modern and Modular telegram framework for deno
- Host: GitHub
- URL: https://github.com/irandeno/tea
- Owner: irandeno
- License: mit
- Created: 2021-05-29T05:06:28.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-07T12:33:59.000Z (almost 5 years ago)
- Last Synced: 2025-10-19T21:49:26.742Z (8 months ago)
- Topics: deno, telegram, typescript
- Language: TypeScript
- Homepage:
- Size: 92.8 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tea

A telegram framework with built-in dynamic module system and dependency
injection.
> highly inspired by angular and nest.js
## Getting Started
```typescript
// main.ts
import { TeaFactory } from "https://deno.land/x/tea@v0.3.1/packages/core/mod.ts";
import { BotModule } from "./bot.module.ts";
function bootstrap() {
const bot = TeaFactory.create(BotModule, "BOT_TOKEN");
bot.start();
}
bootstrap();
```
```typescript
// bot.module.ts
import { Module } from "https://deno.land/x/tea@v0.3.1/packages/common/mod.ts";
import { GreetController } from "./greet.controller.ts";
@Module({
controllers: [GreetController],
})
export class BotModule {}
```
```typescript
// greet.controller.ts
import { Controller, Hears, Param, Start } from "../../packages/common/mod.ts";
@Controller()
export class GreetController {
@Start()
start() {
return "🥳 welcome to the bot buddy.\n can you tell me your name and age ?";
}
@Hears("{age:number}")
getAge() {
return "🤖 oh, I am less than a year old too";
}
@Hears("{name:string}")
getName(@Param("name") name: string) {
return `💁🏻♂️ Hello again ${name}.`;
}
}
```
## Execution
```shell
deno run --allow-net=api.telegram.org --allow-env=DEBUG,DENO_ENV -c tsconfig.json --no-check main.ts
```
> p.s1: `--no-check` is temporary until the adapter typing problem is resolved.
> p.s2: `tsconfig.json` file content can be copied from
> [this file](https://github.com/irandeno/tea/blob/main/tsconfig.json).