Package top.focess.qq.api.bot
Interface Bot
-
public interface BotThis class is used to define a Mirai Bot Instance
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddeleteFriend(Friend friend)@NonNull FriendgetAsFriend()Get the bot itself as a friendMembergetAsMember(Group group)BotManagergetBotManager()Get the Bot Manager of the bot@Nullable FriendgetFriend(long id)Get the friend with special id@NonNull FriendgetFriendOrFail(long id)Get the friend with special id@NonNull @UnmodifiableView List<Friend>getFriends()Get all the friends@Nullable GroupgetGroup(long id)Get the group with special id@NonNull GroupgetGroupOrFail(long id)Get the group with special id@NonNull @UnmodifiableView List<Group>getGroups()Get all the groupslonggetId()Get the id of the bot@Nullable MembergetMember(Group group, long id)MembergetMemberOrFail(Group group, long id)List<Member>getMembers(Group group)@Nullable OtherClientgetOtherClient(long id)OtherClientgetOtherClientOrFail(long id)PlugingetPlugin()Get the plugin of the bot@Nullable StrangergetStranger(long id)StrangergetStrangerOrFail(long id)booleanisAdministrator()Indicate this is the AdministratorbooleanisDefaultBot()Indicate this is the default botdefault booleanisOffline()Indicate the bot is offlinebooleanisOnline()Indicate the bot is onlinebooleanlogin()Login the botbooleanlogout()Logout the botvoidquitGroup(Group group)booleanrelogin()Relogin the botvoidsendMessage(Transmitter transmitter, String message)voidsendMessage(Transmitter transmitter, Message message)@Nullable AudiouploadAudio(Speaker speaker, InputStream inputStream)ImageuploadImage(Transmitter transmitter, InputStream resource)
-
-
-
Method Detail
-
relogin
boolean relogin() throws BotLoginExceptionRelogin the bot- Returns:
- true if the bot is online, false otherwise
- Throws:
BotLoginException- throw if the bot login failed
-
login
boolean login() throws BotLoginExceptionLogin 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 @UnmodifiableView List<Friend> getFriends()
Get all the friends- Returns:
- all the friends
-
getGroups
@NonNull @UnmodifiableView 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
-
isOffline
default boolean isOffline()
Indicate the bot is offline- Returns:
- true if the bot is offline, false otherwise
-
getBotManager
BotManager getBotManager()
Get the Bot Manager of the bot- Returns:
- the Bot Manager of the bot
-
sendMessage
void sendMessage(Transmitter transmitter, Message message)
-
sendMessage
void sendMessage(Transmitter transmitter, String message)
-
uploadImage
Image uploadImage(Transmitter transmitter, InputStream resource)
-
uploadAudio
@Nullable Audio uploadAudio(Speaker speaker, InputStream inputStream)
-
deleteFriend
void deleteFriend(Friend friend)
-
quitGroup
void quitGroup(Group group)
-
getStranger
@Nullable Stranger getStranger(long id)
-
getStrangerOrFail
Stranger getStrangerOrFail(long id)
-
getOtherClientOrFail
OtherClient getOtherClientOrFail(long id)
-
getOtherClient
@Nullable OtherClient getOtherClient(long id)
-
-