add more know properties to the RESPONSE template
This commit is contained in:
parent
3591044368
commit
53e84afc6d
|
@ -1,9 +1,6 @@
|
||||||
package matterlink.command
|
package matterlink.command
|
||||||
|
|
||||||
import matterlink.bridge.ApiMessage
|
|
||||||
import matterlink.bridge.MessageHandler
|
|
||||||
import matterlink.bridge.command.IMinecraftCommandSender
|
import matterlink.bridge.command.IMinecraftCommandSender
|
||||||
import matterlink.config.cfg
|
|
||||||
import net.minecraft.command.ICommandSender
|
import net.minecraft.command.ICommandSender
|
||||||
import net.minecraft.server.MinecraftServer
|
import net.minecraft.server.MinecraftServer
|
||||||
import net.minecraft.util.text.ITextComponent
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
|
@ -29,7 +29,7 @@ data class CustomCommand(
|
||||||
commandSender.execute("$execute $args") || commandSender.reply.isNotBlank()
|
commandSender.execute("$execute $args") || commandSender.reply.isNotBlank()
|
||||||
}
|
}
|
||||||
CommandType.RESPONSE -> {
|
CommandType.RESPONSE -> {
|
||||||
MessageHandler.transmit(ApiMessage(text = response.lazyFormat(getReplacements(user, args))))
|
MessageHandler.transmit(ApiMessage(text = response.lazyFormat(getReplacements(user, userId, server, args))))
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,11 @@ data class CustomCommand(
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getReplacements(user: String, args: String): Map<String, () -> String> = mapOf(
|
fun getReplacements(user: String, userId: String, server: String, args: String): Map<String, () -> String> = mapOf(
|
||||||
"{uptime}" to instance::getUptimeAsString,
|
"{uptime}" to instance::getUptimeAsString,
|
||||||
"{users}" to { user },
|
"{user}" to { user },
|
||||||
|
"{userid}" to { userId },
|
||||||
|
"{server}" to { server },
|
||||||
"{args}" to { args }
|
"{args}" to { args }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ RemoteNickFormat="[{PROTOCOL}.{BRIDGE}] <{NOPINGNICK}> "
|
||||||
#Enable to show users joins/parts from other bridges
|
#Enable to show users joins/parts from other bridges
|
||||||
#Currently works for messages from the following bridges: irc, mattermost, slack
|
#Currently works for messages from the following bridges: irc, mattermost, slack
|
||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
ShowJoinPart=false
|
ShowJoinPart=true
|
||||||
|
|
||||||
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
||||||
#It will strip other characters from the nick
|
#It will strip other characters from the nick
|
||||||
|
@ -244,5 +244,5 @@ enable=true
|
||||||
channel="api"
|
channel="api"
|
||||||
|
|
||||||
[[gateway.inout]]
|
[[gateway.inout]]
|
||||||
account="irc.freenode"
|
account="irc.esper"
|
||||||
channel="#matterlink"
|
channel="#matterlink"
|
Loading…
Reference in New Issue