Browse Source

change key word of Telegram to Potato

master
pimhwang 2 years ago
parent
commit
6b28c699d4
  1. 2
      src/polling.ts
  2. 58
      src/types/index.ts
  3. 20
      src/types/inline.ts
  4. 4
      src/types/internal.ts
  5. 36
      src/types/passport.ts
  6. 8
      src/types/payment.ts
  7. 8
      src/types/sticker.ts
  8. 6
      src/types/update.ts

2
src/polling.ts

@ -51,7 +51,7 @@ export class HttpPolling extends Adapter<PotatoBot> { @@ -51,7 +51,7 @@ export class HttpPolling extends Adapter<PotatoBot> {
// Other error
logger.warn('failed to get updates. reason: %s', e.message)
} else {
// Telegram error
// Potato error
const { error_code, description } = e.response.data as any
logger.warn('failed to get updates: %c %s', error_code, description)
}

58
src/types/index.ts

@ -40,7 +40,7 @@ declare module './update' { @@ -40,7 +40,7 @@ declare module './update' {
}
/**
* This object represents a Telegram user or bot.
* This object represents a Potato user or bot.
* @see https://potato.im/api#user
*/
export interface User {
@ -56,7 +56,7 @@ export interface User { @@ -56,7 +56,7 @@ export interface User {
username?: string
/** Optional. IETF language tag of the user's language */
language_code?: string
/** Optional. True, if this user is a Telegram Premium user */
/** Optional. True, if this user is a Potato Premium user */
is_premium?: boolean
/** Optional. True, if this user added the bot to the attachment menu */
added_to_attachment_menu?: boolean
@ -236,7 +236,7 @@ export interface Message { @@ -236,7 +236,7 @@ export interface Message {
migrate_from_chat_id?: Integer
/** Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
pinned_message?: Message
/** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */
/** Optional. The domain name of the website on which the user has logged in. More about Potato Login » */
connected_website?: string
/** Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */
proximity_alert_triggered?: ProximityAlertTriggered
@ -397,7 +397,7 @@ export interface Animation { @@ -397,7 +397,7 @@ export interface Animation {
}
/**
* This object represents an audio file to be treated as music by the Telegram clients.
* This object represents an audio file to be treated as music by the Potato clients.
* @see https://potato.im/api#audio
*/
export interface Audio {
@ -466,7 +466,7 @@ export interface Video { @@ -466,7 +466,7 @@ export interface Video {
}
/**
* This object represents a video message (available in Telegram apps as of v.4.0).
* This object represents a video message (available in Potato apps as of v.4.0).
* @see https://potato.im/api#videonote
*/
export interface VideoNote {
@ -512,7 +512,7 @@ export interface Contact { @@ -512,7 +512,7 @@ export interface Contact {
first_name?: string
/** Optional. Contact's last name */
last_name?: string
/** Optional. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
/** Optional. Contact's user identifier in Potato. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
user_id?: Integer
/** Optional. Additional data about the contact in the form of a vCard */
vcard?: string
@ -831,7 +831,7 @@ export interface KeyboardButtonPollType { @@ -831,7 +831,7 @@ export interface KeyboardButtonPollType {
}
/**
* Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
* Upon receiving a message with this object, Potato clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
* @see https://potato.im/api#replykeyboardremove
*/
export interface ReplyKeyboardRemove {
@ -861,7 +861,7 @@ export interface InlineKeyboardButton { @@ -861,7 +861,7 @@ export interface InlineKeyboardButton {
text?: string
/** Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
url?: string
/** Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
/** Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Potato Login Widget. */
login_url?: LoginUrl
/** Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
callback_data?: string
@ -894,9 +894,9 @@ export interface InlineKeyboardButton { @@ -894,9 +894,9 @@ export interface InlineKeyboardButton {
}
/**
* This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
* This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Potato Login Widget when the user is coming from Potato. All the user needs to do is tap/click a button and confirm that they want to log in:
*
* Telegram apps support these buttons as of version 5.7.
* Potato apps support these buttons as of version 5.7.
* Sample bot: @discussbot
* @see https://potato.im/api#loginurl
*/
@ -937,7 +937,7 @@ export interface CallbackQuery { @@ -937,7 +937,7 @@ export interface CallbackQuery {
}
/**
* Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
* Upon receiving a message with this object, Potato clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
* @see https://potato.im/api#forcereply
*/
export interface ForceReply {
@ -1428,7 +1428,7 @@ export type InputMedia = @@ -1428,7 +1428,7 @@ export type InputMedia =
export interface InputMediaPhoto {
/** Type of the result, must be photo */
type?: string
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
/** File to send. Pass a file_id to send a file that exists on the Potato servers (recommended), pass an HTTP URL for Potato to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
media?: string
/** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */
caption?: string
@ -1447,7 +1447,7 @@ export interface InputMediaPhoto { @@ -1447,7 +1447,7 @@ export interface InputMediaPhoto {
export interface InputMediaVideo {
/** Type of the result, must be video */
type?: string
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
/** File to send. Pass a file_id to send a file that exists on the Potato servers (recommended), pass an HTTP URL for Potato to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
media?: string
/** Optional. 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>. More info on Sending Files » */
thumb?: InputFile | string
@ -1476,7 +1476,7 @@ export interface InputMediaVideo { @@ -1476,7 +1476,7 @@ export interface InputMediaVideo {
export interface InputMediaAnimation {
/** Type of the result, must be animation */
type?: string
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
/** File to send. Pass a file_id to send a file that exists on the Potato servers (recommended), pass an HTTP URL for Potato to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
media?: string
/** Optional. 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>. More info on Sending Files » */
thumb?: InputFile | string
@ -1503,7 +1503,7 @@ export interface InputMediaAnimation { @@ -1503,7 +1503,7 @@ export interface InputMediaAnimation {
export interface InputMediaAudio {
/** Type of the result, must be audio */
type?: string
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
/** File to send. Pass a file_id to send a file that exists on the Potato servers (recommended), pass an HTTP URL for Potato to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
media?: string
/** Optional. 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>. More info on Sending Files » */
thumb?: InputFile | string
@ -1528,7 +1528,7 @@ export interface InputMediaAudio { @@ -1528,7 +1528,7 @@ export interface InputMediaAudio {
export interface InputMediaDocument {
/** Type of the result, must be document */
type?: string
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
/** File to send. Pass a file_id to send a file that exists on the Potato servers (recommended), pass an HTTP URL for Potato to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » */
media?: string
/** Optional. 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>. More info on Sending Files » */
thumb?: InputFile | string
@ -1620,7 +1620,7 @@ export interface SendPhotoPayload { @@ -1620,7 +1620,7 @@ export interface SendPhotoPayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More info on Sending Files » */
/** Photo to send. Pass a file_id as String to send a photo that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More info on Sending Files » */
photo?: InputFile | string
/** Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing */
caption?: string
@ -1647,7 +1647,7 @@ export interface SendAudioPayload { @@ -1647,7 +1647,7 @@ export interface SendAudioPayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
/** Audio file to send. Pass a file_id as String to send an audio file that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get an audio file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
audio?: InputFile | string
/** Audio caption, 0-1024 characters after entities parsing */
caption?: string
@ -1680,7 +1680,7 @@ export interface SendDocumentPayload { @@ -1680,7 +1680,7 @@ export interface SendDocumentPayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
/** File to send. Pass a file_id as String to send a file that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
document?: InputFile | 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>. More info on Sending Files » */
thumb?: InputFile | string
@ -1709,7 +1709,7 @@ export interface SendVideoPayload { @@ -1709,7 +1709,7 @@ export interface SendVideoPayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More info on Sending Files » */
/** Video to send. Pass a file_id as String to send a video that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get a video from the Internet, or upload a new video using multipart/form-data. More info on Sending Files » */
video?: InputFile | string
/** Duration of sent video in seconds */
duration?: Integer
@ -1746,7 +1746,7 @@ export interface SendAnimationPayload { @@ -1746,7 +1746,7 @@ export interface SendAnimationPayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More info on Sending Files » */
/** Animation to send. Pass a file_id as String to send an animation that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get an animation from the Internet, or upload a new animation using multipart/form-data. More info on Sending Files » */
animation?: InputFile | string
/** Duration of sent animation in seconds */
duration?: Integer
@ -1781,7 +1781,7 @@ export interface SendVoicePayload { @@ -1781,7 +1781,7 @@ export interface SendVoicePayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
/** Audio file to send. Pass a file_id as String to send a file that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
voice?: InputFile | string
/** Voice message caption, 0-1024 characters after entities parsing */
caption?: string
@ -1808,7 +1808,7 @@ export interface SendVideoNotePayload { @@ -1808,7 +1808,7 @@ export interface SendVideoNotePayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported */
/** Video note to send. Pass a file_id as String to send a video note that exists on the Potato servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported */
video_note?: InputFile | string
/** Duration of sent video in seconds */
duration?: Integer
@ -2374,7 +2374,7 @@ export interface AnswerCallbackQueryPayload { @@ -2374,7 +2374,7 @@ export interface AnswerCallbackQueryPayload {
* Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
*/
url?: string
/** The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. */
/** The maximum amount of time in seconds that the result of the callback query may be cached client-side. Potato apps will support caching starting in version 3.14. Defaults to 0. */
cache_time?: Integer
}
@ -2539,7 +2539,7 @@ declare module './internal' { @@ -2539,7 +2539,7 @@ declare module './internal' {
*/
sendPhoto(payload: SendPhotoPayload): Promise<Message>
/**
* Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
* Use this method to send audio files, if you want Potato clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
*
* For sending voice messages, use the sendVoice method instead.
* @see https://potato.im/api#sendaudio
@ -2551,7 +2551,7 @@ declare module './internal' { @@ -2551,7 +2551,7 @@ declare module './internal' {
*/
sendDocument(payload: SendDocumentPayload): Promise<Message>
/**
* Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
* Use this method to send video files, Potato clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
* @see https://potato.im/api#sendvideo
*/
sendVideo(payload: SendVideoPayload): Promise<Message>
@ -2561,12 +2561,12 @@ declare module './internal' { @@ -2561,12 +2561,12 @@ declare module './internal' {
*/
sendAnimation(payload: SendAnimationPayload): Promise<Message>
/**
* Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
* Use this method to send audio files, if you want Potato clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
* @see https://potato.im/api#sendvoice
*/
sendVoice(payload: SendVoicePayload): Promise<Message>
/**
* As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
* As of v.4.0, Potato clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
* @see https://potato.im/api#sendvideonote
*/
sendVideoNote(payload: SendVideoNotePayload): Promise<Message>
@ -2611,7 +2611,7 @@ declare module './internal' { @@ -2611,7 +2611,7 @@ declare module './internal' {
*/
sendDice(payload: SendDicePayload): Promise<Message>
/**
* Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
* Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Potato clients clear its typing status). Returns True on success.
*
* Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of "Retrieving image, please wait...", the bot may use sendChatAction with action = upload_photo. The user will see a "sending photo" status for the bot.
*

20
src/types/inline.ts

@ -41,7 +41,7 @@ export interface AnswerInlineQueryPayload { @@ -41,7 +41,7 @@ export interface AnswerInlineQueryPayload {
}
/**
* This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
* This object represents one result of an inline query. Potato clients currently support results of the following 20 types:
* - InlineQueryResultCachedAudio
* - InlineQueryResultCachedDocument
* - InlineQueryResultCachedGif
@ -465,7 +465,7 @@ export interface InlineQueryResultGame { @@ -465,7 +465,7 @@ export interface InlineQueryResultGame {
}
/**
* Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
* Represents a link to a photo stored on the Potato servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
* @see https://potato.im/api#inlinequeryresultcachedphoto
*/
export interface InlineQueryResultCachedPhoto {
@ -492,7 +492,7 @@ export interface InlineQueryResultCachedPhoto { @@ -492,7 +492,7 @@ export interface InlineQueryResultCachedPhoto {
}
/**
* Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
* Represents a link to an animated GIF file stored on the Potato servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
* @see https://potato.im/api#inlinequeryresultcachedgif
*/
export interface InlineQueryResultCachedGif {
@ -517,7 +517,7 @@ export interface InlineQueryResultCachedGif { @@ -517,7 +517,7 @@ export interface InlineQueryResultCachedGif {
}
/**
* Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
* Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Potato servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
* @see https://potato.im/api#inlinequeryresultcachedmpeg4gif
*/
export interface InlineQueryResultCachedMpeg4Gif {
@ -542,7 +542,7 @@ export interface InlineQueryResultCachedMpeg4Gif { @@ -542,7 +542,7 @@ export interface InlineQueryResultCachedMpeg4Gif {
}
/**
* Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
* Represents a link to a sticker stored on the Potato servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
* @see https://potato.im/api#inlinequeryresultcachedsticker
*/
export interface InlineQueryResultCachedSticker {
@ -559,7 +559,7 @@ export interface InlineQueryResultCachedSticker { @@ -559,7 +559,7 @@ export interface InlineQueryResultCachedSticker {
}
/**
* Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
* Represents a link to a file stored on the Potato servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
* @see https://potato.im/api#inlinequeryresultcacheddocument
*/
export interface InlineQueryResultCachedDocument {
@ -586,7 +586,7 @@ export interface InlineQueryResultCachedDocument { @@ -586,7 +586,7 @@ export interface InlineQueryResultCachedDocument {
}
/**
* Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
* Represents a link to a video file stored on the Potato servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
* @see https://potato.im/api#inlinequeryresultcachedvideo
*/
export interface InlineQueryResultCachedVideo {
@ -613,7 +613,7 @@ export interface InlineQueryResultCachedVideo { @@ -613,7 +613,7 @@ export interface InlineQueryResultCachedVideo {
}
/**
* Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
* Represents a link to a voice message stored on the Potato servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
* @see https://potato.im/api#inlinequeryresultcachedvoice
*/
export interface InlineQueryResultCachedVoice {
@ -638,7 +638,7 @@ export interface InlineQueryResultCachedVoice { @@ -638,7 +638,7 @@ export interface InlineQueryResultCachedVoice {
}
/**
* Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
* Represents a link to an MP3 audio file stored on the Potato servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
* @see https://potato.im/api#inlinequeryresultcachedaudio
*/
export interface InlineQueryResultCachedAudio {
@ -662,7 +662,7 @@ export interface InlineQueryResultCachedAudio { @@ -662,7 +662,7 @@ export interface InlineQueryResultCachedAudio {
/**
* This object represents the content of a message to be sent as a result of an inline query.
* Telegram clients currently support the following 5 types:
* Potato clients currently support the following 5 types:
* - InputTextMessageContent
* - InputLocationMessageContent
* - InputVenueMessageContent

4
src/types/internal.ts

@ -24,10 +24,10 @@ export class Internal { @@ -24,10 +24,10 @@ export class Internal {
logger.debug('[response] %o', response)
const { ok, result } = response
if (ok) return result
throw new Error(`Telegram API error ${response.data.error_code}. ${response.data.description}`)
throw new Error(`Potato API error ${response.data.error_code}. ${response.data.description}`)
} catch (err) {
if (err.response?.data?.error_code && err.response.data.description) {
throw new Error(`Telegram API error ${err.response.data.error_code}. ${err.response.data.description}`)
throw new Error(`Potato API error ${err.response.data.error_code}. ${err.response.data.description}`)
} else {
throw err
}

36
src/types/passport.ts

@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
import { Integer, Internal } from '.'
/**
* Contains information about Telegram Passport data shared with the bot by the user.
* Contains information about Potato Passport data shared with the bot by the user.
* @see https://potato.im/api#passportdata
*/
export interface PassportData {
/** Array with information about documents and other Telegram Passport elements that was shared with the bot */
/** Array with information about documents and other Potato Passport elements that was shared with the bot */
data?: EncryptedPassportElement[]
/** Encrypted credentials required to decrypt the data */
credentials?: EncryptedCredentials
}
/**
* This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
* This object represents a file uploaded to Potato Passport. Currently all Potato Passport files are in JPEG format when decrypted and don't exceed 10MB.
* @see https://potato.im/api#passportfile
*/
export interface PassportFile {
@ -27,13 +27,13 @@ export interface PassportFile { @@ -27,13 +27,13 @@ export interface PassportFile {
}
/**
* Contains information about documents or other Telegram Passport elements shared with the bot by the user.
* Contains information about documents or other Potato Passport elements shared with the bot by the user.
* @see https://potato.im/api#encryptedpassportelement
*/
export interface EncryptedPassportElement {
/** Element type. One of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration", "phone_number", "email". */
type?: string
/** Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for "personal_details", "passport", "driver_license", "identity_card", "internal_passport" and "address" types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
/** Optional. Base64-encoded encrypted Potato Passport element data provided by the user, available for "personal_details", "passport", "driver_license", "identity_card", "internal_passport" and "address" types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
data?: string
/** Optional. User's verified phone number, available only for "phone_number" type */
phone_number?: string
@ -54,7 +54,7 @@ export interface EncryptedPassportElement { @@ -54,7 +54,7 @@ export interface EncryptedPassportElement {
}
/**
* Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
* Contains data required for decrypting and authenticating EncryptedPassportElement. See the Potato Passport Documentation for a complete description of the data decryption and authentication processes.
* @see https://potato.im/api#encryptedcredentials
*/
export interface EncryptedCredentials {
@ -74,7 +74,7 @@ export interface SetPassportDataErrorsPayload { @@ -74,7 +74,7 @@ export interface SetPassportDataErrorsPayload {
}
/**
* This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
* This object represents an error in the Potato Passport element which was submitted that should be resolved by the user. It should be one of:
* - PassportElementErrorDataField
* - PassportElementErrorFrontSide
* - PassportElementErrorReverseSide
@ -104,7 +104,7 @@ export type PassportElementError = @@ -104,7 +104,7 @@ export type PassportElementError =
export interface PassportElementErrorDataField {
/** Error source, must be data */
source?: string
/** The section of the user's Telegram Passport which has the error, one of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address" */
/** The section of the user's Potato Passport which has the error, one of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address" */
type?: string
/** Name of the data field which has the error */
field_name?: string
@ -121,7 +121,7 @@ export interface PassportElementErrorDataField { @@ -121,7 +121,7 @@ export interface PassportElementErrorDataField {
export interface PassportElementErrorFrontSide {
/** Error source, must be front_side */
source?: string
/** The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport" */
/** The section of the user's Potato Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport" */
type?: string
/** Base64-encoded hash of the file with the front side of the document */
file_hash?: string
@ -136,7 +136,7 @@ export interface PassportElementErrorFrontSide { @@ -136,7 +136,7 @@ export interface PassportElementErrorFrontSide {
export interface PassportElementErrorReverseSide {
/** Error source, must be reverse_side */
source?: string
/** The section of the user's Telegram Passport which has the issue, one of "driver_license", "identity_card" */
/** The section of the user's Potato Passport which has the issue, one of "driver_license", "identity_card" */
type?: string
/** Base64-encoded hash of the file with the reverse side of the document */
file_hash?: string
@ -151,7 +151,7 @@ export interface PassportElementErrorReverseSide { @@ -151,7 +151,7 @@ export interface PassportElementErrorReverseSide {
export interface PassportElementErrorSelfie {
/** Error source, must be selfie */
source?: string
/** The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport" */
/** The section of the user's Potato Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport" */
type?: string
/** Base64-encoded hash of the file with the selfie */
file_hash?: string
@ -166,7 +166,7 @@ export interface PassportElementErrorSelfie { @@ -166,7 +166,7 @@ export interface PassportElementErrorSelfie {
export interface PassportElementErrorFile {
/** Error source, must be file */
source?: string
/** The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
/** The section of the user's Potato Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
type?: string
/** Base64-encoded file hash */
file_hash?: string
@ -181,7 +181,7 @@ export interface PassportElementErrorFile { @@ -181,7 +181,7 @@ export interface PassportElementErrorFile {
export interface PassportElementErrorFiles {
/** Error source, must be files */
source?: string
/** The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
/** The section of the user's Potato Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
type?: string
/** List of base64-encoded file hashes */
file_hashes?: string[]
@ -196,7 +196,7 @@ export interface PassportElementErrorFiles { @@ -196,7 +196,7 @@ export interface PassportElementErrorFiles {
export interface PassportElementErrorTranslationFile {
/** Error source, must be translation_file */
source?: string
/** Type of element of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
/** Type of element of the user's Potato Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
type?: string
/** Base64-encoded file hash */
file_hash?: string
@ -211,7 +211,7 @@ export interface PassportElementErrorTranslationFile { @@ -211,7 +211,7 @@ export interface PassportElementErrorTranslationFile {
export interface PassportElementErrorTranslationFiles {
/** Error source, must be translation_files */
source?: string
/** Type of element of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
/** Type of element of the user's Potato Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
type?: string
/** List of base64-encoded file hashes */
file_hashes?: string[]
@ -226,7 +226,7 @@ export interface PassportElementErrorTranslationFiles { @@ -226,7 +226,7 @@ export interface PassportElementErrorTranslationFiles {
export interface PassportElementErrorUnspecified {
/** Error source, must be unspecified */
source?: string
/** Type of element of the user's Telegram Passport which has the issue */
/** Type of element of the user's Potato Passport which has the issue */
type?: string
/** Base64-encoded element hash */
element_hash?: string
@ -236,7 +236,7 @@ export interface PassportElementErrorUnspecified { @@ -236,7 +236,7 @@ export interface PassportElementErrorUnspecified {
declare module '.' {
interface Message {
/** Optional. Telegram Passport data */
/** Optional. Potato Passport data */
passport_data?: PassportData
}
}
@ -244,7 +244,7 @@ declare module '.' { @@ -244,7 +244,7 @@ declare module '.' {
declare module './internal' {
interface Internal {
/**
* Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
* Informs a user that some of the Potato Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
*
* Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
* @see https://potato.im/api#setpassportdataerrors

8
src/types/payment.ts

@ -109,7 +109,7 @@ export interface AnswerShippingQueryPayload { @@ -109,7 +109,7 @@ export interface AnswerShippingQueryPayload {
ok?: boolean
/** Required if ok is True. A JSON-serialized array of available shipping options. */
shipping_options?: ShippingOption[]
/** Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. */
/** Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Potato will display this message to the user. */
error_message?: string
}
@ -118,7 +118,7 @@ export interface AnswerPreCheckoutQueryPayload { @@ -118,7 +118,7 @@ export interface AnswerPreCheckoutQueryPayload {
pre_checkout_query_id?: string
/** Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. */
ok?: boolean
/** Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. */
/** Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Potato will display this message to the user. */
error_message?: string
}
@ -212,8 +212,8 @@ export interface SuccessfulPayment { @@ -212,8 +212,8 @@ export interface SuccessfulPayment {
shipping_option_id?: string
/** Optional. Order info provided by the user */
order_info?: OrderInfo
/** Telegram payment identifier */
telegram_payment_charge_id?: string
/** Potato payment identifier */
potato_payment_charge_id?: string
/** Provider payment identifier */
provider_payment_charge_id?: string
}

8
src/types/sticker.ts

@ -79,7 +79,7 @@ export interface SendStickerPayload { @@ -79,7 +79,7 @@ export interface SendStickerPayload {
chat_id?: Integer | string
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
message_thread_id?: number
/** Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
/** Sticker to send. Pass a file_id as String to send a file that exists on the Potato servers (recommended), pass an HTTP URL as a String for Potato to get a .WEBP file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
sticker?: InputFile | string
/** Sends the message silently. Users will receive a notification with no sound. */
disable_notification?: boolean
@ -117,7 +117,7 @@ export interface CreateNewStickerSetPayload { @@ -117,7 +117,7 @@ export interface CreateNewStickerSetPayload {
name?: string
/** Sticker set title, 1-64 characters */
title?: string
/** PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
/** PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Potato servers, pass an HTTP URL as a String for Potato to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
png_sticker?: InputFile | string
/** TGS animation with the sticker, uploaded using multipart/form-data. See https://core.potato.org/stickers#animated-sticker-requirements for technical requirements */
tgs_sticker?: InputFile
@ -141,7 +141,7 @@ export interface AddStickerToSetPayload { @@ -141,7 +141,7 @@ export interface AddStickerToSetPayload {
user_id?: Integer
/** Sticker set name */
name?: string
/** PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
/** PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Potato servers, pass an HTTP URL as a String for Potato to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » */
png_sticker?: InputFile | string
/** TGS animation with the sticker, uploaded using multipart/form-data. See https://core.potato.org/stickers#animated-sticker-requirements for technical requirements */
tgs_sticker?: InputFile
@ -170,7 +170,7 @@ export interface SetStickerSetThumbPayload { @@ -170,7 +170,7 @@ export interface SetStickerSetThumbPayload {
name?: string
/** User identifier of the sticker set owner */
user_id?: Integer
/** A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.potato.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.potato.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnails can't be uploaded via HTTP URL. */
/** A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.potato.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.potato.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Potato servers, pass an HTTP URL as a String for Potato to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnails can't be uploaded via HTTP URL. */
thumb?: InputFile | string
}

6
src/types/update.ts

@ -40,7 +40,7 @@ export interface SetWebhookPayload { @@ -40,7 +40,7 @@ export interface SetWebhookPayload {
allowed_updates?: string[]
/** Pass True to drop all pending updates */
drop_pending_updates?: boolean
/** A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. */
/** A secret token to be sent in a header “X-Potato-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. */
secret_token?: string
}
@ -66,7 +66,7 @@ export interface WebhookInfo { @@ -66,7 +66,7 @@ export interface WebhookInfo {
last_error_date?: Integer
/** Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */
last_error_message?: string
/** Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */
/** Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Potato datacenters */
last_synchronization_error_date?: number
/** Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
max_connections?: Integer
@ -84,7 +84,7 @@ declare module './internal' { @@ -84,7 +84,7 @@ declare module './internal' {
/**
* Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
*
* If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot's token, you can be pretty sure it's us.
* If you'd like to make sure that the Webhook request comes from Potato, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot's token, you can be pretty sure it's us.
* @see https://potato.im/api#setwebhook
*/
setWebhook(payload: SetWebhookPayload): Promise<boolean>

Loading…
Cancel
Save