Class DefaultAbilities

java.lang.Object
org.telegram.abilitybots.api.bot.DefaultAbilities
All Implemented Interfaces:
AbilityExtension

public final class DefaultAbilities extends Object implements AbilityExtension
  • Field Details

  • Constructor Details

  • Method Details

    • reportCommands

      public Ability reportCommands()

      Format of the report:

      [command1] - [description1]

      [command2] - [description2]

      ...

      Once you invoke it, the bot will send the available commands to the chat. This is a public ability so anyone can invoke it.

      Usage: /commands

      Returns:
      the ability to report commands defined by the child bot.
    • commands

      public Ability commands()
      Default format:

      PUBLIC

      [command1] - [description1]

      [command2] - [description2]

      GROUP_ADMIN

      [command1] - [description1]

      ...

      Returns:
      the ability to print commands based on the privacy of the requesting user
    • reportStats

      public Ability reportStats()
      Returns:
      the ability to report statistics for abilities and replies.
    • backupDB

      public Ability backupDB()
      This backup ability returns the object defined by DBContext.backup() as a message document.

      This is a high-profile ability and is restricted to the CREATOR only.

      Usage: /backup

      Returns:
      the ability to back-up the database of the bot
    • recoverDB

      public Ability recoverDB()
      Recovers the bot database using DBContext.recover(Object).

      The bot recovery process hugely depends on the implementation of the recovery method of DBContext.

      Usage: /recover

      Returns:
      the ability to recover the database of the bot
    • banUser

      public Ability banUser()
      Banned users are accumulated in the blacklist. Use DBContext.getSet(String) with name specified by BaseAbilityBot.BLACKLIST.

      Usage: /ban @username

      Note that admins who try to ban the creator, get banned.

      Returns:
      the ability to ban the user from any kind of bot interaction
    • unbanUser

      public Ability unbanUser()
      Usage: /unban @username
      Returns:
      the ability to unban a user
    • promoteAdmin

      public Ability promoteAdmin()
      Returns:
      the ability to promote a user to a bot admin
    • demoteAdmin

      public Ability demoteAdmin()
      Returns:
      the ability to demote an admin to a user
    • claimCreator

      public Ability claimCreator()
      Regular users and admins who try to claim the bot will get banned.
      Returns:
      the ability to claim yourself as the master and creator of the bot
    • downloadFileWithId

      protected File downloadFileWithId(String fileId) throws org.telegram.telegrambots.meta.exceptions.TelegramApiException
      Throws:
      org.telegram.telegrambots.meta.exceptions.TelegramApiException