tg-rs / carapax

A Telegram Bot API framework
MIT License
113 stars 12 forks source link

Handlers overlapping #64

Closed RicoGit closed 4 years ago

RicoGit commented 4 years ago

I make 2 handlers

    #[handler(command = "/start")]
    async fn command_handler(ctx: &Ctx, cmd: Command) -> HandlerResult { ... }

    #[handler]
    async fn message_handler(ctx: &Ctx, msg: Message) -> HandlerResult { ... }

I expect that /start command will be handled once in the first handler. Actually /start will handled twice in each handler.

The current behavior is quite counterintuitive. What do you think?

rossnomann commented 4 years ago

You can use HandlerResult::Stop in order to stop update propagation.