mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-24 23:14:39 +03:00
fix(sample): use new options
This commit is contained in:
parent
751b15b4b2
commit
f8872663d8
@ -23,12 +23,12 @@
|
|||||||
"@nestjs/common": "7.5.1",
|
"@nestjs/common": "7.5.1",
|
||||||
"@nestjs/core": "7.5.1",
|
"@nestjs/core": "7.5.1",
|
||||||
"@nestjs/platform-express": "7.5.1",
|
"@nestjs/platform-express": "7.5.1",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"nestjs-telegraf": "*",
|
"nestjs-telegraf": "*",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"rxjs": "6.6.3",
|
"rxjs": "6.6.3",
|
||||||
"telegraf": "^3.38.0"
|
"telegraf": "3.38.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nestjs/cli": "7.5.1",
|
"@nestjs/cli": "7.5.1",
|
||||||
|
@ -12,11 +12,13 @@ import { GreeterBotName } from './app.constants';
|
|||||||
middlewares: [sessionMiddleware],
|
middlewares: [sessionMiddleware],
|
||||||
include: [EchoModule],
|
include: [EchoModule],
|
||||||
}),
|
}),
|
||||||
TelegrafModule.forRoot({
|
TelegrafModule.forRootAsync({
|
||||||
name: GreeterBotName,
|
botName: GreeterBotName,
|
||||||
token: process.env.GREETER_BOT_TOKEN,
|
useFactory: () => ({
|
||||||
middlewares: [sessionMiddleware],
|
token: process.env.GREETER_BOT_TOKEN,
|
||||||
include: [GreeterModule],
|
middlewares: [sessionMiddleware],
|
||||||
|
include: [GreeterModule],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
EchoModule,
|
EchoModule,
|
||||||
GreeterModule,
|
GreeterModule,
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
import { Telegraf } from 'telegraf';
|
import { Telegraf } from 'telegraf';
|
||||||
import { Command, Help, InjectBot, On, Start, Update } from 'nestjs-telegraf';
|
import {
|
||||||
|
Command,
|
||||||
|
getBotToken,
|
||||||
|
Help,
|
||||||
|
InjectBot,
|
||||||
|
On,
|
||||||
|
Start,
|
||||||
|
Update,
|
||||||
|
} from 'nestjs-telegraf';
|
||||||
import { EchoService } from './echo.service';
|
import { EchoService } from './echo.service';
|
||||||
import { HELLO_SCENE_ID } from '../app.constants';
|
import { GreeterBotName, HELLO_SCENE_ID } from '../app.constants';
|
||||||
import { Context } from '../interfaces/context.interface';
|
import { Context } from '../interfaces/context.interface';
|
||||||
|
|
||||||
@Update()
|
@Update()
|
||||||
export class EchoUpdate {
|
export class EchoUpdate {
|
||||||
constructor(
|
constructor(
|
||||||
@InjectBot()
|
@InjectBot(GreeterBotName)
|
||||||
private readonly bot: Telegraf<Context>,
|
private readonly bot: Telegraf<Context>,
|
||||||
private readonly echoService: EchoService,
|
private readonly echoService: EchoService,
|
||||||
) {}
|
) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user