+16
-12
@@ -51,6 +51,7 @@ func (bot *Bot[T]) handle(parentCtx context.Context, u *tgapi.Update) {
|
||||
draftProvider: bot.draftProvider,
|
||||
sceneRuntime: bot,
|
||||
observer: bot.observer,
|
||||
eventEmitter: bot.safeEmitEvent,
|
||||
payloadType: bot.payloadType,
|
||||
botID: bot.userID,
|
||||
ctx: ctx,
|
||||
@@ -81,7 +82,7 @@ func (bot *Bot[T]) handle(parentCtx context.Context, u *tgapi.Update) {
|
||||
|
||||
sceneHandled, err := bot.tryHandleScene(msgCtx)
|
||||
if err != nil {
|
||||
bot.logger.Errorln(err)
|
||||
msgCtx.error(err)
|
||||
bot.safeEmitEvent(ctx, UpdateHandledEvent{
|
||||
UpdateID: u.UpdateID,
|
||||
UpdateType: u.Type,
|
||||
@@ -90,17 +91,20 @@ func (bot *Bot[T]) handle(parentCtx context.Context, u *tgapi.Update) {
|
||||
Duration: time.Since(startTime),
|
||||
Handled: false,
|
||||
})
|
||||
bot.safeEmitEvent(ctx, ErrorEvent{
|
||||
UpdateID: u.UpdateID,
|
||||
UpdateType: u.Type,
|
||||
Plugin: "bot",
|
||||
HandlerKind: HandlerSceneKind,
|
||||
HandlerName: "tryHandleScene",
|
||||
FromID: msgCtx.FromID,
|
||||
ChatID: msgCtx.ChatID,
|
||||
Err: err,
|
||||
UserFacing: false,
|
||||
})
|
||||
var reported *reportedSceneError
|
||||
if !errors.As(err, &reported) {
|
||||
bot.safeEmitEvent(ctx, ErrorEvent{
|
||||
UpdateID: u.UpdateID,
|
||||
UpdateType: u.Type,
|
||||
Plugin: "bot",
|
||||
HandlerKind: HandlerSceneKind,
|
||||
HandlerName: "tryHandleScene",
|
||||
FromID: msgCtx.FromID,
|
||||
ChatID: msgCtx.ChatID,
|
||||
Err: err,
|
||||
UserFacing: IsUserError(err),
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
if sceneHandled {
|
||||
|
||||
Reference in New Issue
Block a user