First build
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
export function chunk<T>(array: T[], size: number) {
|
||||
const result = []
|
||||
const result = [];
|
||||
for (let index = 0; index < array.length; index += size)
|
||||
result.push(array.slice(index, index + size))
|
||||
result.push(array.slice(index, index + size));
|
||||
|
||||
return result
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import type { Context } from '#root/bot/context.js'
|
||||
import type { Update } from '@grammyjs/types'
|
||||
import type { Middleware } from 'grammy'
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import type { Update } from "@grammyjs/types";
|
||||
import type { Middleware } from "grammy";
|
||||
|
||||
export function getUpdateInfo(ctx: Context): Omit<Update, 'update_id'> {
|
||||
const { update_id, ...update } = ctx.update
|
||||
export function getUpdateInfo(ctx: Context): Omit<Update, "update_id"> {
|
||||
const { /*update_id,*/ ...update } = ctx.update;
|
||||
|
||||
return update
|
||||
return update;
|
||||
}
|
||||
|
||||
export function logHandle(id: string): Middleware<Context> {
|
||||
return (ctx, next) => {
|
||||
ctx.logger.info({
|
||||
msg: `Handle "${id}"`,
|
||||
...(id.startsWith('unhandled') ? { update: getUpdateInfo(ctx) } : {}),
|
||||
})
|
||||
...(id.startsWith("unhandled") ? { update: getUpdateInfo(ctx) } : {})
|
||||
});
|
||||
|
||||
return next()
|
||||
}
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user