tdlib-native
Version:
🚀 Telegram TDLib native nodejs wrapper
213 lines (212 loc) • 5.36 kB
TypeScript
import { replyMarkupForceReply, replyMarkupRemoveKeyboard, replyMarkupShowKeyboard$Input, KeyboardButtonType$Input, replyMarkupInlineKeyboard$Input, InlineKeyboardButtonType$Input } from './generated/types';
/**
*
*
* @export
* @param {object} []
* @returns {replyMarkupForceReply} {replyMarkupForceReply}
*/
export declare function forceReply({ placeholder, personal }?: {
placeholder?: string | undefined;
personal?: boolean | undefined;
}): replyMarkupForceReply;
/**
*
*
* @export
* @param {object} []
* @returns {replyMarkupRemoveKeyboard} {replyMarkupRemoveKeyboard}
*/
export declare function removeKeyboard({ personal }?: {
personal?: boolean | undefined;
}): replyMarkupRemoveKeyboard;
type KeyboardOptions = {
persistent: boolean;
resize: boolean;
personal: boolean;
oneTime: boolean;
placeholder: string;
};
/**
*
*
* @class KeyboardBuilder
*/
declare class KeyboardBuilder {
private readonly _options;
private _row;
private _buttons;
/**
*
*
* @readonly
* @private
* @memberof KeyboardBuilder
*/
private get _currentRow();
/**
* Creates an instance of KeyboardBuilder.
* @param {Partial<KeyboardOptions>} options
* @memberof KeyboardBuilder
*/
constructor(options: Partial<KeyboardOptions>);
/**
* Adds text button
*
* @param {string} text
* @returns {this}
* @memberof KeyboardBuilder
*/
textButton(text: string): this;
/**
* Adds button to current row
*
* @param {string} text
* @param {KeyboardButtonType} [type]
* @returns {this}
* @memberof KeyboardBuilder
*/
button(text: string, type: KeyboardButtonType$Input): this;
/**
* Creates new row
*
* @returns {this}
* @memberof KeyboardBuilder
*/
row(): this;
/**
* Sets {@link replyMarkupShowKeyboard$Input.is_persistent}
*
* @param {boolean} [isPersistent=true]
* @returns {this}
* @memberof KeyboardBuilder
*/
persistent(isPersistent?: boolean): this;
/**
* Sets {@link replyMarkupShowKeyboard$Input.resize_keyboard}
*
* @param {boolean} [doResize=true]
* @returns {this}
* @memberof KeyboardBuilder
*/
resize(doResize?: boolean): this;
/**
* Sets {@link replyMarkupShowKeyboard$Input.is_personal}
*
* @param {boolean} [isPersonal=true]
* @returns {this}
* @memberof KeyboardBuilder
*/
personal(isPersonal?: boolean): this;
/**
* Sets {@link replyMarkupShowKeyboard$Input.one_time}
*
* @param {boolean} [isOneTime=true]
* @returns {this}
* @memberof KeyboardBuilder
*/
oneTime(isOneTime?: boolean): this;
/**
* Sets {@link replyMarkupShowKeyboard$Input.input_field_placeholder}
*
* @param {string} value
* @returns {this}
* @memberof KeyboardBuilder
*/
placeholder(value: string): this;
/**
* Generates keyboard
*
* @returns {replyMarkupShowKeyboard$Input} {@link replyMarkupShowKeyboard$Input}
* @memberof KeyboardBuilder
*/
build(): replyMarkupShowKeyboard$Input;
/**
* Generates keyboard
*
* @returns {replyMarkupShowKeyboard} {@link replyMarkupShowKeyboard$Input}
* @memberof KeyboardBuilder
*/
toJSON(): replyMarkupShowKeyboard$Input;
}
/**
*
*
* @export
* @param {KeyboardOptions} [options={}]
* @returns {KeyboardBuilder} {@link KeyboardBuilder}
*/
export declare function keyboard(options?: Partial<KeyboardOptions>): KeyboardBuilder;
/**
*
*
* @class InlineKeyboardBuilder
*/
declare class InlineKeyboardBuilder {
private _buttons;
private _row;
/**
*
*
* @readonly
* @private
* @memberof InlineKeyboardBuilder
*/
private get _currentRow();
/**
* Adds callback button
*
* @param {string} text
* @param {string} data
* @returns {this}
* @memberof InlineKeyboardBuilder
*/
callbackButton(text: string, data: string | Uint8Array): this;
/**
* Adds url button
*
* @param {string} text
* @param {string|URL} url
* @returns {this}
* @memberof InlineKeyboardBuilder
*/
urlButton(text: string, url: string | URL): this;
/**
*
*
* @param {string} text
* @param {InlineKeyboardButtonType$Input} type
* @returns {this}
* @memberof InlineKeyboardBuilder
*/
button(text: string, type: InlineKeyboardButtonType$Input): this;
/**
* Creates new row
*
* @returns {this}
* @memberof KeyboardBuilder
*/
row(): this;
/**
* Generates keyboard
*
* @returns {replyMarkupInlineKeyboard$Input} {@link replyMarkupInlineKeyboard$Input}
* @memberof InlineKeyboardBuilder
*/
build(): replyMarkupInlineKeyboard$Input;
/**
* Generates keyboard
*
* @returns {replyMarkupInlineKeyboard$Input} {@link replyMarkupInlineKeyboard$Input}
* @memberof InlineKeyboardBuilder
*/
toJSON(): replyMarkupInlineKeyboard$Input;
}
/**
*
*
* @export
* @returns {InlineKeyboardBuilder} {@link InlineKeyboardBuilder}
*/
export declare function inlineKeyboard(): InlineKeyboardBuilder;
export { type InlineKeyboardBuilder, type KeyboardBuilder };