Skip to content

Commit

Permalink
corrected the imports and exports, added methods options interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Feb 28, 2022
1 parent e713ab6 commit ea6402e
Show file tree
Hide file tree
Showing 4 changed files with 406 additions and 43 deletions.
31 changes: 21 additions & 10 deletions src/structure/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
export { TelegramAPI } from "./TelegramAPI";
export {
IMessageCallback,
IInlineQueryCallback,
IChosenInlineResultCallback,
ICallbackQueryCallback,
IShippingQueryCallback,
IPreCheckoutQueryCallback,
IPollCallback,
IPollAnswerCallback,
OnError,
sendPollOptions,
TMessageCallback,
TInlineQueryCallback,
TChosenInlineResultCallback,
TCallbackQueryCallback,
TShippingQueryCallback,
TPreCheckoutQueryCallback,
TPollCallback,
TPollAnswerCallback,
TOnError,
IMessageId,
} from "./types";

export {
sendPollOptions,
sendMessageOptions,
forwardMessageOptions,
copyMessageOptions,
sendPhotoOptions,
sendAudioOptions,
sendVideoOptions,
sendDocumentOptions,
} from "./methodsOptions";
363 changes: 363 additions & 0 deletions src/structure/methodsOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,363 @@
import {
IInlineKeyboardMarkup,
IMessageEntity,
IReplayKeyboardRemove,
IForceReply,
IReplyKeyboardMarkup,
} from "../types/index";

export interface sendPollOptions {
/**
* True, if the poll needs to be anonymous, defaults to True
*/
is_anonymous?: boolean;
/**
* Poll type, “quiz” or “regular”, defaults to “regular”
*/
type?: string;
/**
* True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
*/
allows_multiple_answers?: boolean;
/**
* 0-based identifier of the correct answer option, required for polls in quiz mode
*/
correct_option_id?: number;
/**
* Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
*/
explanation?: string;
/**
* Mode for parsing entities in the explanation. See formatting options for more details.
*/
explanation_parse_mode?: string;
/**
* A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of parse_mode
*/
explanation_entities?: IMessageEntity[];
/**
* Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
*/
open_period?: number;
/**
* Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
*/
close_date?: number;
/**
* Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.
*/
is_closed?: boolean;
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}

export interface sendMessageOptions {
/**
* Mode for parsing entities in the message text. See formatting options for more details.
*/
parse_mode?: "MarkdownV2" | "HTML" | "Markdown";
/**
* A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
*/
entities?: IMessageEntity[];
/**
* Disables link previews for links in this message
*/
disable_web_page_preview?: boolean;
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}

export interface forwardMessageOptions {
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the forwarded message from forwarding and saving
*/
protect_content?: boolean;
}

export interface copyMessageOptions {
/**
* New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
*/
caption?: string;
/**
* Mode for parsing entities in the new caption. See formatting options for more details.
*/
parse_mode?: "MarkdownV2" | "HTML" | "Markdown";
/**
* A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode
*/
caption_entities?: IMessageEntity[];
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}

export interface sendPhotoOptions {
/**
* Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
*/
caption?: string;
/**
* Mode for parsing entities in the photo caption. See formatting options for more details.
*/
parse_mode?: "MarkdownV2" | "HTML" | "Markdown";
/**
* A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
*/
caption_entities?: IMessageEntity[];
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}

export interface sendAudioOptions {
/**
* Audio caption, 0-1024 characters after entities parsing
*/
caption?: string;
/**
* Mode for parsing entities in the audio caption. See formatting options for more details.
*/
parse_mode?: "MarkdownV2" | "HTML" | "Markdown";
/**
* A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
*/
caption_entities?: IMessageEntity[];
/**
* Duration of the audio in seconds
*/
duration?: number;
/**
* Performer
*/
performer?: string;
/**
* Track name
*/
title?: string;
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
*/
thumb?: Buffer | string;
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}

export interface sendVideoOptions {
/**
* Duration of sent video in seconds
*/
duration?: number;
/**
* Video width
*/
width?: number;
/**
* Video height
*/
height?: number;
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
*/
thumb?: Buffer | string;
/**
* Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
*/
caption?: string;
/**
* Mode for parsing entities in the video caption.
*/
parse_mode?: "MarkdownV2" | "HTML" | "Markdown";
/**
* A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
*/
caption_entities?: IMessageEntity[];
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Pass True, if the uploaded video is suitable for streaming
*/
supports_streaming?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}

export interface sendDocumentOptions {
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
*/
thumb?: Buffer | string;
/**
* Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
*/
caption?: string;
/**
* Mode for parsing entities in the document caption.
*/
parse_mode?: "MarkdownV2" | "HTML" | "Markdown";
/**
* A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
*/
caption_entities?: IMessageEntity[];
/**
* Disables automatic server-side content type detection for files uploaded using multipart/form-data
*/
disable_content_type_detection?: boolean;
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean;
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean;
/**
* If the message is a reply, ID of the original message
*/
reply_to_message_id?: number;
/**
* Pass True, if the message should be sent even if the specified replied-to message is not found
*/
allow_sending_without_reply?: boolean;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?:
| IInlineKeyboardMarkup
| IReplyKeyboardMarkup
| IReplayKeyboardRemove
| IForceReply;
}
Loading

0 comments on commit ea6402e

Please sign in to comment.