Package org.telegram.abilitybots.api.bot
Class DefaultAbilities
- java.lang.Object
-
- org.telegram.abilitybots.api.bot.DefaultAbilities
-
- All Implemented Interfaces:
AbilityExtension
public final class DefaultAbilities extends Object implements AbilityExtension
-
-
Constructor Summary
Constructors Constructor Description DefaultAbilities(BaseAbilityBot bot)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbilitybackupDB()This backup ability returns the object defined byDBContext.backup()as a message document.AbilitybanUser()Banned users are accumulated in the blacklist.AbilityclaimCreator()Regular users and admins who try to claim the bot will get banned.Abilitycommands()Default format:AbilitydemoteAdmin()protected FiledownloadFileWithId(String fileId)AbilitypromoteAdmin()AbilityrecoverDB()Recovers the bot database usingDBContext.recover(Object).AbilityreportCommands()Format of the report:AbilityunbanUser()Usage:/unban @username
-
-
-
Field Detail
-
CLAIM
public static final String CLAIM
- See Also:
- Constant Field Values
-
BAN
public static final String BAN
- See Also:
- Constant Field Values
-
PROMOTE
public static final String PROMOTE
- See Also:
- Constant Field Values
-
DEMOTE
public static final String DEMOTE
- See Also:
- Constant Field Values
-
UNBAN
public static final String UNBAN
- See Also:
- Constant Field Values
-
BACKUP
public static final String BACKUP
- See Also:
- Constant Field Values
-
RECOVER
public static final String RECOVER
- See Also:
- Constant Field Values
-
COMMANDS
public static final String COMMANDS
- See Also:
- Constant Field Values
-
REPORT
public static final String REPORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultAbilities
public DefaultAbilities(BaseAbilityBot bot)
-
-
Method Detail
-
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
-
backupDB
public Ability backupDB()
This backup ability returns the object defined byDBContext.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 usingDBContext.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. UseDBContext.getSet(String)with name specified byBaseAbilityBot.BLACKLIST.Usage:
/ban @usernameNote 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
-
-