Interface BotManager


  • public interface BotManager
    This class is used to manage 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 bot
        password - the password of the bot
        plugin - the plugin
        botProtocol - 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 bot
        password - the password of the bot
        plugin - 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 password

        Note: this is a blocking method.

        Parameters:
        id - the id of the bot
        password - the password of the bot
        plugin - the plugin
        botProtocol - 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 password

        Note: this is a blocking method.

        Parameters:
        id - the id of the bot
        password - the password of the bot
        plugin - 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 BotLoginException
        Relogin 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
      • getBots

        @UnmodifiableView List<Bot> getBots()
        Get the list of bots
        Returns:
        the list of bots
      • 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