Class SimpleBot

  • All Implemented Interfaces:
    Bot

    public class SimpleBot
    extends Object
    implements Bot
    • Constructor Detail

      • SimpleBot

        public SimpleBot​(long username,
                         String password,
                         net.mamoe.mirai.Bot bot,
                         Plugin plugin)
    • Method Detail

      • getNativeBot

        @NotNull
        public net.mamoe.mirai.Bot getNativeBot()
        Description copied from interface: Bot
        Get the Mirai Bot Instance
        Specified by:
        getNativeBot in interface Bot
        Returns:
        the Mirai Bot Instance
      • relogin

        public boolean relogin()
                        throws BotLoginException
        Description copied from interface: Bot
        Relogin the bot
        Specified by:
        relogin in interface Bot
        Returns:
        true if the bot is online, false otherwise
        Throws:
        BotLoginException - throw if the bot login failed
      • login

        public boolean login()
                      throws BotLoginException
        Description copied from interface: Bot
        Login the bot
        Specified by:
        login in interface Bot
        Returns:
        true if the bot is not online, false otherwise
        Throws:
        BotLoginException - throw if the bot login failed
      • logout

        public boolean logout()
        Description copied from interface: Bot
        Logout the bot
        Specified by:
        logout in interface Bot
        Returns:
        true if the bot is online, false otherwise
      • getFriendOrFail

        @NotNull
        public net.mamoe.mirai.contact.Friend getFriendOrFail​(long id)
        Description copied from interface: Bot
        Get the friend with special id
        Specified by:
        getFriendOrFail in interface Bot
        Parameters:
        id - the friend id
        Returns:
        the friend with special id
      • getGroup

        @Nullable
        public net.mamoe.mirai.contact.Group getGroup​(long id)
        Description copied from interface: Bot
        Get the group with special id
        Specified by:
        getGroup in interface Bot
        Parameters:
        id - the group id
        Returns:
        the group with special id
      • getFriend

        @Nullable
        public net.mamoe.mirai.contact.Friend getFriend​(long id)
        Description copied from interface: Bot
        Get the friend with special id
        Specified by:
        getFriend in interface Bot
        Parameters:
        id - the friend id
        Returns:
        the friend with special id
      • getFriends

        @NotNull
        public List<net.mamoe.mirai.contact.Friend> getFriends()
        Description copied from interface: Bot
        Get all the friends
        Specified by:
        getFriends in interface Bot
        Returns:
        all the friends
      • getGroups

        @NotNull
        public List<net.mamoe.mirai.contact.Group> getGroups()
        Description copied from interface: Bot
        Get all the groups
        Specified by:
        getGroups in interface Bot
        Returns:
        all the groups
      • isOnline

        public boolean isOnline()
        Description copied from interface: Bot
        Indicate the bot is online
        Specified by:
        isOnline in interface Bot
        Returns:
        true if the bot is online, false otherwise
      • getAsFriend

        @NotNull
        public net.mamoe.mirai.contact.Friend getAsFriend()
        Description copied from interface: Bot
        Get the bot itself as a friend
        Specified by:
        getAsFriend in interface Bot
        Returns:
        the bot itself as a friend
      • getId

        public long getId()
        Description copied from interface: Bot
        Get the id of the bot
        Specified by:
        getId in interface Bot
        Returns:
        the id of the bot
      • isDefaultBot

        public boolean isDefaultBot()
        Description copied from interface: Bot
        Indicate this is the default bot
        Specified by:
        isDefaultBot in interface Bot
        Returns:
        true if this is the default bot, false otherwise
      • getUsername

        public long getUsername()
      • getPassword

        public String getPassword()
      • setNativeBot

        public void setNativeBot​(net.mamoe.mirai.Bot nativeBot)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getPlugin

        public Plugin getPlugin()
        Description copied from interface: Bot
        Get the plugin of the bot
        Specified by:
        getPlugin in interface Bot
        Returns:
        the plugin of the bot
      • isAdministrator

        public boolean isAdministrator()
        Description copied from interface: Bot
        Indicate this is the Administrator
        Specified by:
        isAdministrator in interface Bot
        Returns:
        true if this is the Administrator, false otherwise