55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
|
/**
|
||
|
* Contains lists of constants which are useful when working with the Bot API.
|
||
|
*/
|
||
|
export declare const API_CONSTANTS: Readonly<{
|
||
|
/**
|
||
|
* List of all available update types. Useful if you want to receive all
|
||
|
* updates from the Bot API, rather than just those that are delivered by
|
||
|
* default.
|
||
|
*
|
||
|
* The main use case for this is when you want to receive `chat_member`
|
||
|
* updates, as they need to be enabled first. Use it like so:
|
||
|
*
|
||
|
* ```ts
|
||
|
* // Built-in polling:
|
||
|
* bot.start({ allowed_updates: ALL_UPDATE_TYPES });
|
||
|
* // grammY runner:
|
||
|
* run(bot, { runner: { fetch: { allowed_updates: ALL_UPDATE_TYPES } } });
|
||
|
* // Webhooks:
|
||
|
* await bot.api.setWebhook(url, { allowed_updates: ALL_UPDATE_TYPES });
|
||
|
* ```
|
||
|
*/
|
||
|
readonly ALL_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_member"];
|
||
|
/**
|
||
|
* An object containing all available chat permissions. Useful if you want
|
||
|
* to lift restrictions from a user, as this action requires you to pass
|
||
|
* `true` for all permissions. Use it like so:
|
||
|
*
|
||
|
* ```ts
|
||
|
* // On `Bot`:
|
||
|
* await bot.api.restrictChatMember(chat_id, user_id, ALL_CHAT_PERMISSIONS);
|
||
|
* // On `Api`:
|
||
|
* await ctx.api.restrictChatMember(chat_id, user_id, ALL_CHAT_PERMISSIONS);
|
||
|
* // On `Context`:
|
||
|
* await ctx.restrictChatMember(user_id, ALL_CHAT_PERMISSIONS);
|
||
|
* await ctx.restrictAuthor(ALL_CHAT_PERMISSIONS);
|
||
|
* ```
|
||
|
*/
|
||
|
readonly ALL_CHAT_PERMISSIONS: {
|
||
|
readonly can_send_messages: true;
|
||
|
readonly can_send_audios: true;
|
||
|
readonly can_send_documents: true;
|
||
|
readonly can_send_photos: true;
|
||
|
readonly can_send_videos: true;
|
||
|
readonly can_send_video_notes: true;
|
||
|
readonly can_send_voice_notes: true;
|
||
|
readonly can_send_polls: true;
|
||
|
readonly can_send_other_messages: true;
|
||
|
readonly can_add_web_page_previews: true;
|
||
|
readonly can_change_info: true;
|
||
|
readonly can_invite_users: true;
|
||
|
readonly can_pin_messages: true;
|
||
|
readonly can_manage_topics: true;
|
||
|
};
|
||
|
}>;
|