mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 23:00:14 +08:00
Fix endsWith
This commit is contained in:
parent
02b4f10e0a
commit
24d7d49a24
@ -305,12 +305,12 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
|
||||
): Listener<T> {
|
||||
return if (trim) {
|
||||
val toCheck = suffix.trim()
|
||||
content({ it.trimStart().startsWith(toCheck) }, {
|
||||
if (removeSuffix) this.onEvent(this.message.toString().substringBeforeLast(toCheck).trim())
|
||||
content({ it.trimEnd().endsWith(toCheck) }, {
|
||||
if (removeSuffix) this.onEvent(this.message.toString().removeSuffix(toCheck).trim())
|
||||
else onEvent(this, this.message.toString().trim())
|
||||
})
|
||||
} else {
|
||||
content({ it.startsWith(suffix) }, {
|
||||
content({ it.endsWith(suffix) }, {
|
||||
if (removeSuffix) this.onEvent(this.message.toString().removeSuffix(suffix))
|
||||
else onEvent(this, this.message.toString())
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user