Package top.focess.qq.api.bot
Interface BotManager
-
public interface BotManagerThis class is used to manage all the bots.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @Nullable BotgetBot(long id)Get the bot with special id@UnmodifiableView List<Bot>getBots()Get the list of botsdefault @NotNull Future<Bot>login(long id, String password, Plugin plugin)Login and get the bot with id and passwordFuture<Bot>login(long id, String password, Plugin plugin, BotProtocol botProtocol)Login and get the bot with id and passwordbooleanlogin(Bot bot)Login the botdefault @NotNull BotloginDirectly(long id, String password, Plugin plugin)Login and get the bot with id and password@NotNull BotloginDirectly(long id, String password, Plugin plugin, BotProtocol botProtocol)Login and get the bot with id and passwordbooleanlogout(@NotNull Bot bot)Logout the botbooleanrelogin(@NotNull Bot bot)Relogin the botBotremove(long id)Remove the botvoidremove(Plugin plugin)Remove all the bots logined by the pluginvoidremoveAll()Remove all the bots
-
-
-
Method Detail
-
login
Future<Bot> login(long id, String password, Plugin plugin, BotProtocol botProtocol)
Login and get the bot with id and password- Parameters:
id- the id of the botpassword- the password of the botplugin- the pluginbotProtocol- the bot protocol- Returns:
- the bot
-
login
@NotNull default @NotNull Future<Bot> login(long id, String password, Plugin plugin)
Login and get the bot with id and password- Parameters:
id- the id of the botpassword- the password of the botplugin- the plugin- Returns:
- the bot
-
loginDirectly
@NotNull @NotNull Bot loginDirectly(long id, String password, Plugin plugin, BotProtocol botProtocol) throws BotLoginException
Login and get the bot with id and passwordNote: this is a blocking method.
- Parameters:
id- the id of the botpassword- the password of the botplugin- the pluginbotProtocol- the bot protocol- Returns:
- the bot
- Throws:
BotLoginException- if the bot login failed
-
loginDirectly
@NotNull default @NotNull Bot loginDirectly(long id, String password, Plugin plugin) throws BotLoginException
Login and get the bot with id and passwordNote: this is a blocking method.
- Parameters:
id- the id of the botpassword- the password of the botplugin- the plugin- Returns:
- the bot
- Throws:
BotLoginException- if the bot login failed
-
login
boolean login(Bot bot) throws BotLoginException
Login the bot- Parameters:
bot- the bot need to log in- Returns:
- true if the bot is not online, false otherwise
- Throws:
BotLoginException- if the bot login failed
-
logout
boolean logout(@NotNull @NotNull Bot bot)Logout the bot- Parameters:
bot- the bot need to log out- Returns:
- true if the bot is online, false otherwise
-
getBot
@Nullable @Nullable Bot getBot(long id)
Get the bot with special id- Parameters:
id- the id of the bot- Returns:
- the bot with special id
-
relogin
boolean relogin(@NotNull @NotNull Bot bot) throws BotLoginExceptionRelogin the bot- Parameters:
bot- the bot need to relogin- Returns:
- true if the bot is online, false otherwise
- Throws:
BotLoginException- if the bot login failed
-
remove
Bot remove(long id)
Remove the bot- Parameters:
id- the bot id- Returns:
- the previous bot
-
removeAll
void removeAll()
Remove all the bots
-
remove
void remove(Plugin plugin)
Remove all the bots logined by the plugin- Parameters:
plugin- the plugin
-
-