mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-10-01 20:41:27 +03:00
fix(sample): remove relation path import
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Hears, Start, Update } from 'nestjs-telegraf';
|
||||
import { Command, Hears, Start, Update } from 'nestjs-telegraf';
|
||||
import { Context } from '../interfaces/context.interface';
|
||||
import { HELLO_SCENE_ID } from '../app.constants';
|
||||
|
||||
@Update()
|
||||
export class GreeterUpdate {
|
||||
@@ -13,4 +14,9 @@ export class GreeterUpdate {
|
||||
const { first_name } = ctx.from;
|
||||
await ctx.reply(`Hey ${first_name}`);
|
||||
}
|
||||
|
||||
@Command('scene')
|
||||
async onSceneCommand(ctx: Context): Promise<void> {
|
||||
await ctx.scene.enter(HELLO_SCENE_ID);
|
||||
}
|
||||
}
|
||||
|
29
sample/01-complete-app/src/greeter/scenes/hello.scene.ts
Normal file
29
sample/01-complete-app/src/greeter/scenes/hello.scene.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Scene, SceneEnter, SceneLeave, Command } from 'nestjs-telegraf';
|
||||
import { HELLO_SCENE_ID } from '../../app.constants';
|
||||
import { Context } from '../../interfaces/context.interface';
|
||||
|
||||
@Scene(HELLO_SCENE_ID)
|
||||
export class HelloScene {
|
||||
@SceneEnter()
|
||||
async onSceneEnter(ctx: Context): Promise<void> {
|
||||
console.log('Enter to scene');
|
||||
await ctx.reply('Welcome on scene ✋');
|
||||
}
|
||||
|
||||
@SceneLeave()
|
||||
async onSceneLeave(ctx: Context): Promise<void> {
|
||||
console.log('Leave from scene');
|
||||
await ctx.reply('Bye Bye 👋');
|
||||
}
|
||||
|
||||
@Command('hello')
|
||||
async onHelloCommand(ctx: Context): Promise<void> {
|
||||
console.log('Use say hello');
|
||||
await ctx.reply('Hi');
|
||||
}
|
||||
|
||||
@Command('leave')
|
||||
async onLeaveCommand(ctx: Context): Promise<void> {
|
||||
await ctx.scene.leave();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user