mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Support parsing an At to a Bot, close #128
This commit is contained in:
parent
5a5d45778a
commit
1bd1b5a4fd
@ -97,6 +97,12 @@ public object ExistingBotArgumentParser : InternalCommandArgumentParserExtension
|
||||
public override fun parse(raw: String, sender: CommandSender): Bot =
|
||||
if (raw == "~") sender.inferBotOrFail()
|
||||
else raw.findBotOrFail()
|
||||
|
||||
public override fun parse(raw: SingleMessage, sender: CommandSender): Bot =
|
||||
if (raw is At) {
|
||||
Bot.getInstanceOrNull(raw.target)
|
||||
?: illegalArgument("@ 的对象不是一个 Bot")
|
||||
} else super.parse(raw, sender)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user