Browse Source

add more know properties to the RESPONSE template

master
Nikky Ai 4 years ago
parent
commit
53e84afc6d
  1. 3
      1.12.2/src/main/kotlin/matterlink/command/MatterLinkCommandSender.kt
  2. 8
      core/src/main/kotlin/matterlink/bridge/command/CustomCommand.kt
  3. 4
      matterbridge-sample.toml

3
1.12.2/src/main/kotlin/matterlink/command/MatterLinkCommandSender.kt

@ -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

8
core/src/main/kotlin/matterlink/bridge/command/CustomCommand.kt

@ -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 }
)
}

4
matterbridge-sample.toml

@ -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"
Loading…
Cancel
Save