Interface Bot

  • All Known Implementing Classes:
    SimpleBot

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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      net.mamoe.mirai.contact.Friend getAsFriend()
      Get the bot itself as a friend
      net.mamoe.mirai.contact.Friend getFriend​(long id)
      Get the friend with special id
      net.mamoe.mirai.contact.Friend getFriendOrFail​(long id)
      Get the friend with special id
      List<net.mamoe.mirai.contact.Friend> getFriends()
      Get all the friends
      net.mamoe.mirai.contact.Group getGroup​(long id)
      Get the group with special id
      List<net.mamoe.mirai.contact.Group> getGroups()
      Get all the groups
      long getId()
      Get the id of the bot
      net.mamoe.mirai.Bot getNativeBot()
      Get the Mirai Bot Instance
      boolean isDefaultBot()
      Indicate this is the default bot
      boolean isOnline()
      Indicate the bot is online
      boolean login()
      Login the bot
      boolean logout()
      Logout the bot
      boolean relogin()
      Relogin the bot
    • Method Detail

      • getNativeBot

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

        boolean relogin()
        Relogin the bot
        Returns:
        true if the bot is online, false otherwise
      • login

        boolean login()
        Login the bot
        Returns:
        true if the bot is not online, false otherwise
      • logout

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

        @NotNull
        net.mamoe.mirai.contact.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
      • getGroup

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

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

        @NotNull
        List<net.mamoe.mirai.contact.Friend> getFriends()
        Get all the friends
        Returns:
        all the friends
      • getGroups

        @NotNull
        List<net.mamoe.mirai.contact.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

        @NotNull
        net.mamoe.mirai.contact.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