add more know properties to the RESPONSE template

This commit is contained in:
Nikky Ai 2018-02-24 21:03:02 +01:00
parent 3591044368
commit 53e84afc6d
3 changed files with 7 additions and 8 deletions

View File

@ -1,9 +1,6 @@
package matterlink.command
import matterlink.bridge.ApiMessage
import matterlink.bridge.MessageHandler
import matterlink.bridge.command.IMinecraftCommandSender
import matterlink.config.cfg
import net.minecraft.command.ICommandSender
import net.minecraft.server.MinecraftServer
import net.minecraft.util.text.ITextComponent

View File

@ -29,7 +29,7 @@ data class CustomCommand(
commandSender.execute("$execute $args") || commandSender.reply.isNotBlank()
}
CommandType.RESPONSE -> {
MessageHandler.transmit(ApiMessage(text = response.lazyFormat(getReplacements(user, args))))
MessageHandler.transmit(ApiMessage(text = response.lazyFormat(getReplacements(user, userId, server, args))))
true
}
}
@ -48,9 +48,11 @@ data class CustomCommand(
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,
"{users}" to { user },
"{user}" to { user },
"{userid}" to { userId },
"{server}" to { server },
"{args}" to { args }
)
}

View File

@ -132,7 +132,7 @@ RemoteNickFormat="[{PROTOCOL}.{BRIDGE}] <{NOPINGNICK}> "
#Enable to show users joins/parts from other bridges
#Currently works for messages from the following bridges: irc, mattermost, slack
#OPTIONAL (default false)
ShowJoinPart=false
ShowJoinPart=true
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
#It will strip other characters from the nick
@ -244,5 +244,5 @@ enable=true
channel="api"
[[gateway.inout]]
account="irc.freenode"
account="irc.esper"
channel="#matterlink"