ptgb
A complete Telegram Bot API client for Dart

Bot Profile & Commands

Part of the API Reference.

setMyCommands

Future<bool> setMyCommands(
    List<Json> commands, {
    Json? scope,
    String? languageCode,
  }) async =>

Sets the list of commands shown in the chat’s / menu, optionally scoped via [scope]/[languageCode].

deleteMyCommands

Future<bool> deleteMyCommands({Json? scope, String? languageCode}) async =>

Clears the command list for the given [scope]/[languageCode], falling back to a higher-level scope.

getMyCommands

Future<List<Json>> getMyCommands({Json? scope, String? languageCode}) async =>

Returns the currently configured command list for a given [scope]/[languageCode].

setMyName

Future<bool> setMyName({String? name, String? languageCode}) async => _b(await call('setMyName', {
        if (name != null) 'name': name,
        if (languageCode != null) 'language_code': languageCode,
      }),);

Sets the bot’s display name.

getMyName

Future<Json> getMyName({String? languageCode}) async => _o(await call('getMyName', {
        if (languageCode != null) 'language_code': languageCode,
      }),);

Returns the bot’s current display name.

setMyDescription

Future<bool> setMyDescription({String? description, String? languageCode}) async =>

Sets the description shown on the bot’s profile page before a user has started it.

getMyDescription

Future<Json> getMyDescription({String? languageCode}) async => _o(await call('getMyDescription', {
        if (languageCode != null) 'language_code': languageCode,
      }),);

Returns the bot’s current profile description.

setMyShortDescription

Future<bool> setMyShortDescription({String? shortDescription, String? languageCode}) async =>

Sets the short description shown alongside the bot’s profile photo and in chat sharing.

getMyShortDescription

Future<Json> getMyShortDescription({String? languageCode}) async =>

Returns the bot’s current short description.

setChatMenuButton

Future<bool> setChatMenuButton({Object? chatId, Json? menuButton}) async =>

Configures the menu button shown in a private chat (e.g. to open a Web App).

getChatMenuButton

Future<Json> getChatMenuButton({Object? chatId}) async => _o(await call('getChatMenuButton', {
        if (chatId != null) 'chat_id': chatId,
      }),);

Returns the currently configured menu button for a chat.

setMyDefaultAdministratorRights

Future<bool> setMyDefaultAdministratorRights({
    ChatAdministratorRights? rights,
    bool? forChannels,
  }) async =>

Sets the default admin rights requested when the bot is added as an admin.

getMyDefaultAdministratorRights

Future<Json> getMyDefaultAdministratorRights({bool? forChannels}) async =>

Returns the bot’s currently configured default admin rights.

setMyProfilePhoto

Future<bool> setMyProfilePhoto(InputProfilePhoto photo) async {

Sets the bot's profile photo. [photo] can be a static image ([InputProfilePhotoStatic]) or a short animation ([InputProfilePhotoAnimated]).

removeMyProfilePhoto

Future<bool> removeMyProfilePhoto() async =>

Removes the bot's current profile photo.