public class CommandSender extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static CommandSender |
CONSOLE
Present CONSOLE or we call it Terminate
|
| 构造器和说明 |
|---|
CommandSender(@NonNull net.mamoe.mirai.contact.Friend friend)
Present Friend
|
CommandSender(@NonNull net.mamoe.mirai.contact.Member member)
Present Member in Group
|
CommandSender(@NonNull net.mamoe.mirai.contact.Stranger stranger)
Present Stranger
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object o) |
void |
exec(String command)
Execute command with this CommandSender
|
@Nullable Bot |
getBot()
Get the bot
|
@Nullable net.mamoe.mirai.contact.Friend |
getFriend()
Get the Mirai Friend instance, or null if this CommandSender does not present a Mirai Friend instance.
|
IOHandler |
getIOHandler()
Get the receiver by this CommandSender
|
@Nullable net.mamoe.mirai.contact.Member |
getMember()
Get the Mirai Member instance, or null if this CommandSender does not present a Mirai Member instance.
|
@NonNull CommandPermission |
getPermission()
Get permission
|
Session |
getSession()
Get Session of a special CommandSender.
|
int |
hashCode() |
boolean |
hasPermission(CommandPermission permission)
Indicate whether this CommandSender owns the permission
|
boolean |
hasPermission(net.mamoe.mirai.contact.MemberPermission permission)
已过时。
|
boolean |
isAuthor()
Indicate whether this is an Author Mirai Friend Instance or an Author Mirai Member Instance
|
boolean |
isConsole()
Indicate whether it is CONSOLE
|
boolean |
isFriend()
Indicate whether this is a Mirai Friend instance
|
boolean |
isMember()
Indicate whether this is a Mirai Member instance
|
boolean |
isStranger()
Indicate whether this is a Mirai Stranger instance
|
String |
toString() |
public static final CommandSender CONSOLE
public CommandSender(@NonNull net.mamoe.mirai.contact.Friend friend)
friend - the Mirai Friend instancepublic CommandSender(@NonNull net.mamoe.mirai.contact.Member member)
member - The Mirai Member Instancepublic CommandSender(@NonNull net.mamoe.mirai.contact.Stranger stranger)
stranger - The Mirai Stranger Instancepublic @Nullable net.mamoe.mirai.contact.Friend getFriend()
public boolean isFriend()
@Deprecated public boolean hasPermission(net.mamoe.mirai.contact.MemberPermission permission)
permission - the compared permissionpublic boolean hasPermission(CommandPermission permission)
permission - the compared permissionpublic @Nullable net.mamoe.mirai.contact.Member getMember()
@EnsuresNonNullIf(expression="getMember()",
result=true)
public boolean isMember()
public boolean isAuthor()
public @NonNull CommandPermission getPermission()
public boolean isConsole()
CONSOLE, false otherwisepublic IOHandler getIOHandler()
public void exec(String command)
command - the command CommandSender executeMain.CommandLine#exec(CommandSender, String)public Session getSession()
public @Nullable Bot getBot()
public boolean isStranger()
Copyright © 2022. All rights reserved.