Module: bot-utils

Classes

FormData
InputFile
InputMedia
InputMediaAnimation
InputMediaAudio
InputMediaDocument
InputMediaPhoto
InputMediaVideo

Methods

(inner) get(url, body, headersopt) → {Promise.<Buffer>}

Parameters:
Name Type Attributes Description
url String

Target URL.

body String | Buffer | Object

Object will be JSON-serialized.

headers Object <optional>
Source:
Returns:
Type
Promise.<Buffer>

(inner) isArray(o) → {Boolean}

Parameters:
Name Type Description
o *
Source:
Returns:
Type
Boolean

(inner) isBuffer(o) → {Boolean}

Parameters:
Name Type Description
o *
Source:
Returns:
Type
Boolean

(inner) isFormData(o) → {Boolean}

Parameters:
Name Type Description
o *
Source:
Returns:
Type
Boolean

(inner) isFunction(o) → {Boolean}

Parameters:
Name Type Description
o *
Source:
Returns:
Type
Boolean

(inner) isObject(o) → {Boolean}

Parameters:
Name Type Description
o *
Source:
Returns:

Return false when o == null.

Type
Boolean

(inner) isString(o) → {Boolean}

Parameters:
Name Type Description
o *
Source:
Returns:
Type
Boolean

(inner) perChatID(update) → {String}

Parameters:
Name Type Description
update Object

Telegram update.

Source:
Returns:

A string which can be used as key.

Type
String

(inner) perFromID(update) → {String}

Parameters:
Name Type Description
update Object

Telegram update.

Source:
Returns:

A string which can be used as key.

Type
String

(inner) post(url, body, headersopt) → {Promise.<Buffer>}

Parameters:
Name Type Attributes Description
url String

Target URL.

body String | Buffer | Object

Object will be JSON-serialized.

headers Object <optional>
Source:
Returns:
Type
Promise.<Buffer>

(inner) toSnakeCase(camelCase) → {String}

Replace camelCase to snake_case, e.g. _ChatID to _chat_id.

Parameters:
Name Type Description
camelCase String
Source:
Returns:

snake_case of input.

Type
String

(inner) toSnakeCaseFormData() → {FormData}

Assign Objects into one FormData which keys are all transfered into snake_case.

Parameters:
Type Attributes Description
Object <repeatable>
Source:
Returns:

Assigned snake_case FormData.

Type
FormData

(inner) toSnakeCaseObject() → {Object}

Assign Objects into one Object which keys are all transfered into snake_case.

Parameters:
Type Attributes Description
Object <repeatable>
Source:
Returns:

Assigned snake_case Object.

Type
Object