mirror of https://github.com/kami-blue/client
[fix] AutoReply / AntiAFK replying to self
Closes #1560 Signed-off-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
parent
621117e458
commit
72f45d5698
|
@ -20,7 +20,7 @@ object AutoReply : Module() {
|
|||
|
||||
init {
|
||||
listener<PacketEvent.Receive> {
|
||||
if (it.packet !is SPacketChat || !MessageDetectionHelper.isDirect(true, it.packet.getChatComponent().unformattedText)) return@listener
|
||||
if (it.packet !is SPacketChat || !MessageDetectionHelper.isDirectReceived(true, it.packet.getChatComponent().unformattedText)) return@listener
|
||||
if (customMessage.value) {
|
||||
sendServerMessage("/r " + message.value)
|
||||
} else {
|
||||
|
|
|
@ -67,7 +67,7 @@ object AntiAFK : Module() {
|
|||
|
||||
listener<PacketEvent.Receive> {
|
||||
if (!autoReply.value || it.packet !is SPacketChat) return@listener
|
||||
if (MessageDetectionHelper.isDirect(true, it.packet.getChatComponent().unformattedText)) {
|
||||
if (MessageDetectionHelper.isDirectReceived(true, it.packet.getChatComponent().unformattedText)) {
|
||||
sendServerMessage("/r I am currently AFK and using KAMI Blue!")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@ object MessageDetectionHelper {
|
|||
return if (message == "KamiBlueMessageType2") "Disconnected from $server" else ""
|
||||
}
|
||||
|
||||
fun isDirect(direct: Boolean, message: String) = message.detect(direct, Regexes.DIRECT, Regexes.DIRECT_ALT_1, Regexes.DIRECT_ALT_2, Regexes.DIRECT_SENT)
|
||||
fun isDirectReceived(direct: Boolean, message: String) = message.detect(direct, Regexes.DIRECT, Regexes.DIRECT_ALT_1, Regexes.DIRECT_ALT_2)
|
||||
|
||||
fun isDirect(direct: Boolean, message: String) = message.detect(direct, Regexes.DIRECT_SENT) || isDirectReceived(direct, message)
|
||||
|
||||
fun getDirectUsername(message: String): String? {
|
||||
if (!isDirect(true, message)) return null
|
||||
|
|
Loading…
Reference in New Issue