Interface Bot


  • public interface Bot
    This class is used to define a Mirai Bot Instance
    • Method Detail

      • getNativeBot

        net.mamoe.mirai.Bot getNativeBot()
        Get the Mirai Bot Instance
        Returns:
        the Mirai Bot Instance
      • relogin

        boolean relogin()
                 throws BotLoginException
        Relogin the bot
        Returns:
        true if the bot is online, false otherwise
        Throws:
        BotLoginException - throw if the bot login failed
      • login

        boolean login()
               throws BotLoginException
        Login the bot
        Returns:
        true if the bot is not online, false otherwise
        Throws:
        BotLoginException - throw if the bot login failed
      • logout

        boolean logout()
        Logout the bot
        Returns:
        true if the bot is online, false otherwise
      • getFriendOrFail

        @NonNull Friend getFriendOrFail​(long id)
        Get the friend with special id
        Parameters:
        id - the friend id
        Returns:
        the friend with special id
        Throws:
        NullPointerException - throw if the friend with special id does not exist
      • getGroupOrFail

        @NonNull Group getGroupOrFail​(long id)
        Get the group with special id
        Parameters:
        id - the group id
        Returns:
        the group with special id
        Throws:
        NullPointerException - throw if the group with special id does not exist
      • getGroup

        @Nullable Group getGroup​(long id)
        Get the group with special id
        Parameters:
        id - the group id
        Returns:
        the group with special id
      • getFriend

        @Nullable Friend getFriend​(long id)
        Get the friend with special id
        Parameters:
        id - the friend id
        Returns:
        the friend with special id
      • getFriends

        @NonNull List<Friend> getFriends()
        Get all the friends
        Returns:
        all the friends
      • getGroups

        @NonNull List<Group> getGroups()
        Get all the groups
        Returns:
        all the groups
      • isOnline

        boolean isOnline()
        Indicate the bot is online
        Returns:
        true if the bot is online, false otherwise
      • getAsFriend

        @NonNull Friend getAsFriend()
        Get the bot itself as a friend
        Returns:
        the bot itself as a friend
      • getId

        long getId()
        Get the id of the bot
        Returns:
        the id of the bot
      • isDefaultBot

        boolean isDefaultBot()
        Indicate this is the default bot
        Returns:
        true if this is the default bot, false otherwise
      • getPlugin

        Plugin getPlugin()
        Get the plugin of the bot
        Returns:
        the plugin of the bot
      • isAdministrator

        boolean isAdministrator()
        Indicate this is the Administrator
        Returns:
        true if this is the Administrator, false otherwise