1 |
|
2 | import * as http from 'http';
|
3 | import * as tg from './core/types/typegram';
|
4 | import * as tt from './telegram-types';
|
5 | import { Composer, MaybePromise } from './composer';
|
6 | import ApiClient from './core/network/client';
|
7 | import Context from './context';
|
8 | import Telegram from './telegram';
|
9 | import { TlsOptions } from 'tls';
|
10 | export declare namespace Telegraf {
|
11 | interface Options<TContext extends Context> {
|
12 | contextType: new (...args: ConstructorParameters<typeof Context>) => TContext;
|
13 | handlerTimeout: number;
|
14 | telegram?: Partial<ApiClient.Options>;
|
15 | }
|
16 | interface LaunchOptions {
|
17 | dropPendingUpdates?: boolean;
|
18 |
|
19 | allowedUpdates?: tt.UpdateType[];
|
20 |
|
21 | webhook?: {
|
22 |
|
23 | domain?: string;
|
24 |
|
25 | hookPath?: string;
|
26 | host?: string;
|
27 | port?: number;
|
28 |
|
29 | tlsOptions?: TlsOptions;
|
30 | cb?: http.RequestListener;
|
31 | };
|
32 | }
|
33 | }
|
34 | export declare class Telegraf<C extends Context = Context> extends Composer<C> {
|
35 | private readonly options;
|
36 | private webhookServer?;
|
37 | private polling?;
|
38 |
|
39 | botInfo?: tg.UserFromGetMe;
|
40 | telegram: Telegram;
|
41 | readonly context: Partial<C>;
|
42 | private handleError;
|
43 | constructor(token: string, options?: Partial<Telegraf.Options<C>>);
|
44 | private get token();
|
45 | /** @deprecated use `ctx.telegram.webhookReply` */
|
46 | set webhookReply(webhookReply: boolean);
|
47 | get webhookReply(): boolean;
|
48 | /**
|
49 | * _Override_ error handling
|
50 | */
|
51 | catch(handler: (err: unknown, ctx: C) => MaybePromise<void>): this;
|
52 | webhookCallback(path?: string): (req: http.IncomingMessage & {
|
53 | body?: tg.Update | undefined;
|
54 | }, res: http.ServerResponse, next?: () => void) => Promise<void>;
|
55 | private startPolling;
|
56 | private startWebhook;
|
57 | secretPathComponent(): string;
|
58 | /**
|
59 | * @see https://github.com/telegraf/telegraf/discussions/1344#discussioncomment-335700
|
60 | */
|
61 | launch(config?: Telegraf.LaunchOptions): Promise<void>;
|
62 | stop(reason?: string): void;
|
63 | private handleUpdates;
|
64 | private botInfoCall?;
|
65 | handleUpdate(update: tg.Update, webhookResponse?: http.ServerResponse): Promise<void>;
|
66 | }
|
67 | //# sourceMappingURL=telegraf.d.ts.map |
\ | No newline at end of file |