Comparing version 0.0.21 to 0.0.22
@@ -85,2 +85,4 @@ import type { Context, ContextType, MaybeArray, UpdateName } from "@gramio/contexts"; | ||
}) => unknown, options?: Omit<SetMyCommandsParams, "commands"> & Omit<TelegramBotCommand, "command">): this; | ||
/** Currently not isolated!!! */ | ||
group(grouped: (bot: typeof this) => Bot<any, any>): Bot<any, any>; | ||
start({ webhook, dropPendingUpdates, allowedUpdates, }?: { | ||
@@ -87,0 +89,0 @@ webhook?: Omit<APIMethodParams<"setWebhook">, "drop_pending_updates" | "allowed_updates">; |
@@ -271,2 +271,12 @@ "use strict"; | ||
} | ||
for (const value of plugin.preRequests) { | ||
const [preRequest, updateName] = value; | ||
if (!updateName) | ||
this.preRequest(preRequest); | ||
else | ||
this.preRequest(updateName, preRequest); | ||
} | ||
for (const handler of plugin.groups) { | ||
this.group(handler); | ||
} | ||
this.dependencies.push(plugin.name); | ||
@@ -314,2 +324,6 @@ return this; | ||
} | ||
/** Currently not isolated!!! */ | ||
group(grouped) { | ||
return grouped(this); | ||
} | ||
async start({ webhook, dropPendingUpdates, allowedUpdates, } = {}) { | ||
@@ -316,0 +330,0 @@ await Promise.all(this.lazyloadPlugins.map(async (plugin) => this.extend(await plugin))); |
import type { BotLike, Context, ContextType, MaybeArray, UpdateName } from "@gramio/contexts"; | ||
import type { APIMethods } from "@gramio/types"; | ||
import type { DeriveDefinitions, ErrorDefinitions, Hooks } from "./types"; | ||
import type { Bot } from "./bot"; | ||
export declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions> { | ||
@@ -12,2 +13,3 @@ Errors: Errors; | ||
][]; | ||
groups: ((bot: Bot<any, any>) => Bot<any, any>)[]; | ||
name: string; | ||
@@ -22,2 +24,4 @@ errorsDefinitions: Record<string, { | ||
}); | ||
/** Currently not isolated!!! */ | ||
group(grouped: (bot: Bot<Errors, Derives>) => Bot<any, any>): this; | ||
/** | ||
@@ -24,0 +28,0 @@ * Register custom class-error in plugin |
@@ -64,2 +64,3 @@ "use strict"; | ||
preRequests = []; | ||
groups = []; | ||
name; | ||
@@ -73,2 +74,7 @@ errorsDefinitions = {}; | ||
} | ||
/** Currently not isolated!!! */ | ||
group(grouped) { | ||
this.groups.push(grouped); | ||
return this; | ||
} | ||
/** | ||
@@ -75,0 +81,0 @@ * Register custom class-error in plugin |
{ | ||
"name": "gramio", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "Powerful Telegram Bot API framework", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
39547
895
1