re-assign zulip messages
parent
e106dc3c28
commit
a5b423c8b4
|
@ -20,7 +20,7 @@ final class IrcApi(
|
||||||
|
|
||||||
def commReportBurst(user: User): Funit = {
|
def commReportBurst(user: User): Funit = {
|
||||||
val md = markdown.linkifyUsers(s"Burst of comm reports about @${user.username}")
|
val md = markdown.linkifyUsers(s"Burst of comm reports about @${user.username}")
|
||||||
discord.comms(md) >> zulip.mod()(md)
|
discord.comms(md) >> zulip(_.mod.commsPrivate, "burst")(md)
|
||||||
}
|
}
|
||||||
|
|
||||||
def userMod(user: User, mod: Holder): Funit =
|
def userMod(user: User, mod: Holder): Funit =
|
||||||
|
@ -36,7 +36,7 @@ final class IrcApi(
|
||||||
text = s"Let's have a look at _*${slackdown.userLink(user.username)}*_",
|
text = s"Let's have a look at _*${slackdown.userLink(user.username)}*_",
|
||||||
channel = SlackClient.rooms.tavern
|
channel = SlackClient.rooms.tavern
|
||||||
)
|
)
|
||||||
) >> zulip.mod()(
|
) >> zulip(_.mod.hunterCheat, user.username)(
|
||||||
s":eyes: ${markdown.userLink(mod.user.username)}: Let's have a look at **${markdown.userLink(user.username)}**"
|
s":eyes: ${markdown.userLink(mod.user.username)}: Let's have a look at **${markdown.userLink(user.username)}**"
|
||||||
)
|
)
|
||||||
case Some(note) =>
|
case Some(note) =>
|
||||||
|
@ -49,7 +49,7 @@ final class IrcApi(
|
||||||
slackdown.linkifyUsers(note.text take 2000),
|
slackdown.linkifyUsers(note.text take 2000),
|
||||||
channel = SlackClient.rooms.tavern
|
channel = SlackClient.rooms.tavern
|
||||||
)
|
)
|
||||||
) >> zulip.mod()(
|
) >> zulip(_.mod.hunterCheat, user.username)(
|
||||||
s"${markdown.userLink(mod.user.username)} :note: **${markdown
|
s"${markdown.userLink(mod.user.username)} :note: **${markdown
|
||||||
.userLink(user.username)}** (${markdown.userNotesLink(user.username)}):\n" +
|
.userLink(user.username)}** (${markdown.userNotesLink(user.username)}):\n" +
|
||||||
markdown.linkifyUsers(note.text take 2000)
|
markdown.linkifyUsers(note.text take 2000)
|
||||||
|
@ -66,7 +66,7 @@ final class IrcApi(
|
||||||
channel = SlackClient.rooms.tavernNotes
|
channel = SlackClient.rooms.tavernNotes
|
||||||
)
|
)
|
||||||
) >>
|
) >>
|
||||||
zulip.mod(ZulipClient.topic.notes)(
|
zulip(_.mod.adminLog, "notes")(
|
||||||
s":note: ${markdown.userLink(modName)} **${markdown.userLink(username)}** (${markdown.userNotesLink(username)}):\n" +
|
s":note: ${markdown.userLink(modName)} **${markdown.userLink(username)}** (${markdown.userNotesLink(username)}):\n" +
|
||||||
markdown.linkifyUsers(note take 2000)
|
markdown.linkifyUsers(note take 2000)
|
||||||
)
|
)
|
||||||
|
@ -79,7 +79,7 @@ final class IrcApi(
|
||||||
text = s"[*$typ*] ${slackdown.userLink(user)}@$ip ${slackdown.gameLink(path)}",
|
text = s"[*$typ*] ${slackdown.userLink(user)}@$ip ${slackdown.gameLink(path)}",
|
||||||
channel = SlackClient.rooms.tavernBots
|
channel = SlackClient.rooms.tavernBots
|
||||||
)
|
)
|
||||||
) >> zulip.mod(ZulipClient.topic.clientReports)(
|
) >> zulip(_.mod.log, "self report")(
|
||||||
s"[*$typ*] ${markdown.userLink(user)}@$ip ${markdown.gameLink(path)}"
|
s"[*$typ*] ${markdown.userLink(user)}@$ip ${markdown.gameLink(path)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ final class IrcApi(
|
||||||
},
|
},
|
||||||
channel = "commlog"
|
channel = "commlog"
|
||||||
)
|
)
|
||||||
) >> zulip.mod(ZulipClient.topic.commLog)({
|
) >> zulip(_.mod.adminLog, "private comms checks")({
|
||||||
val finalS = if (user.username endsWith "s") "" else "s"
|
val finalS = if (user.username endsWith "s") "" else "s"
|
||||||
s"**${markdown userLink mod.user.username}** checked out **${markdown userLink user.username}**'$finalS communications "
|
s"**${markdown userLink mod.user.username}** checked out **${markdown userLink user.username}**'$finalS communications "
|
||||||
} + reportBy.filter(mod.id !=).fold("spontaneously") { by =>
|
} + reportBy.filter(mod.id !=).fold("spontaneously") { by =>
|
||||||
|
@ -116,8 +116,8 @@ final class IrcApi(
|
||||||
val md = s"${markdown.userLink(mod.name)} :$icon: ${markdown.linkifyUsers(text)}"
|
val md = s"${markdown.userLink(mod.name)} :$icon: ${markdown.linkifyUsers(text)}"
|
||||||
slack(msg) >>
|
slack(msg) >>
|
||||||
slack(msg.copy(channel = SlackClient.rooms.tavernMonitorAll)) >>
|
slack(msg.copy(channel = SlackClient.rooms.tavernMonitorAll)) >>
|
||||||
zulip.mod(s"monitor-${tpe.toString.toLowerCase}")(md) >>
|
zulip(_.mod.adminMonitor(tpe), mod.name)(md) >>
|
||||||
zulip.mod(ZulipClient.topic.monitor)(md)
|
zulip(_.mod.adminMonitorAll, mod.name)(md)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ final class IrcApi(
|
||||||
channel = SlackClient.rooms.tavernLog
|
channel = SlackClient.rooms.tavernLog
|
||||||
)
|
)
|
||||||
) >>
|
) >>
|
||||||
zulip.mod(ZulipClient.topic.actionLog)(
|
zulip(_.mod.log, "actions")(
|
||||||
s"${markdown.userLink(modId)} :$icon: ${markdown.linkifyUsers(text)}"
|
s"${markdown.userLink(modId)} :$icon: ${markdown.linkifyUsers(text)}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ final class IrcApi(
|
||||||
s"${if (v) "Enabled" else "Disabled"} ${slackdown.lichessLink("mod/chat-panic", " Chat Panic")}",
|
s"${if (v) "Enabled" else "Disabled"} ${slackdown.lichessLink("mod/chat-panic", " Chat Panic")}",
|
||||||
channel = SlackClient.rooms.tavern
|
channel = SlackClient.rooms.tavern
|
||||||
)
|
)
|
||||||
) >> zulip.mod()(
|
) >> zulip(_.mod.log, "chat panic")(
|
||||||
s":stop: ${if (v) "Enabled" else "Disabled"} ${markdown.lichessLink("mod/chat-panic", " Chat Panic")}"
|
s":stop: ${if (v) "Enabled" else "Disabled"} ${markdown.lichessLink("mod/chat-panic", " Chat Panic")}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ final class IrcApi(
|
||||||
text = slackdown.linkifyUsers(msg),
|
text = slackdown.linkifyUsers(msg),
|
||||||
channel = SlackClient.rooms.tavernBots
|
channel = SlackClient.rooms.tavernBots
|
||||||
)
|
)
|
||||||
) >> zulip.mod(ZulipClient.topic.altLog)(s":put_litter_in_its_place: ${markdown linkifyUsers msg}")
|
) >> zulip(_.mod.log, "garbage collector")(markdown linkifyUsers msg)
|
||||||
|
|
||||||
def broadcastError(id: String, name: String, error: String): Funit =
|
def broadcastError(id: String, name: String, error: String): Funit =
|
||||||
slack(
|
slack(
|
||||||
|
@ -172,7 +172,7 @@ final class IrcApi(
|
||||||
text = s"${slackdown.broadcastLink(id, name)}: $error",
|
text = s"${slackdown.broadcastLink(id, name)}: $error",
|
||||||
channel = SlackClient.rooms.broadcast
|
channel = SlackClient.rooms.broadcast
|
||||||
)
|
)
|
||||||
) >> zulip(ZulipClient.stream.broadcast)(s":lightning: ${markdown.broadcastLink(id, name)}: $error")
|
) >> zulip(_.broadcast, "main")(s":lightning: ${markdown.broadcastLink(id, name)}: $error")
|
||||||
|
|
||||||
def userAppeal(user: User, mod: Holder): Funit =
|
def userAppeal(user: User, mod: Holder): Funit =
|
||||||
slack(
|
slack(
|
||||||
|
@ -183,7 +183,7 @@ final class IrcApi(
|
||||||
s"Let's have a look at the appeal of _*${slackdown.lichessLink(s"/appeal/${user.username}", user.username)}*_",
|
s"Let's have a look at the appeal of _*${slackdown.lichessLink(s"/appeal/${user.username}", user.username)}*_",
|
||||||
channel = SlackClient.rooms.tavernAppeal
|
channel = SlackClient.rooms.tavernAppeal
|
||||||
)
|
)
|
||||||
) >> zulip.mod(ZulipClient.topic.appeal)(
|
) >> zulip(_.mod.adminAppeal, user.username)(
|
||||||
s"Let's have a look at the appeal of _*${markdown.lichessLink(s"/appeal/${user.username}", user.username)}*_"
|
s"Let's have a look at the appeal of _*${markdown.lichessLink(s"/appeal/${user.username}", user.username)}*_"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ final class IrcApi(
|
||||||
icon = "horsey",
|
icon = "horsey",
|
||||||
text = "Lichess is being updated! Brace for impact."
|
text = "Lichess is being updated! Brace for impact."
|
||||||
)
|
)
|
||||||
) >> zulip()("Lichess is restarting.")
|
) >> zulip(_.general, "lila")("Lichess is restarting.")
|
||||||
|
|
||||||
def publishEvent(event: Event): Funit = event match {
|
def publishEvent(event: Event): Funit = event match {
|
||||||
case Error(msg) => publishError(msg)
|
case Error(msg) => publishError(msg)
|
||||||
|
@ -210,7 +210,7 @@ final class IrcApi(
|
||||||
icon = "lightning",
|
icon = "lightning",
|
||||||
text = slackdown.linkifyUsers(msg)
|
text = slackdown.linkifyUsers(msg)
|
||||||
)
|
)
|
||||||
) >> zulip()(s":lightning: ${markdown linkifyUsers msg}")
|
) >> zulip(_.general, "lila")(s":lightning: ${markdown linkifyUsers msg}")
|
||||||
|
|
||||||
private def publishWarning(msg: String): Funit =
|
private def publishWarning(msg: String): Funit =
|
||||||
slack(
|
slack(
|
||||||
|
@ -219,7 +219,7 @@ final class IrcApi(
|
||||||
icon = "thinking_face",
|
icon = "thinking_face",
|
||||||
text = slackdown.linkifyUsers(msg)
|
text = slackdown.linkifyUsers(msg)
|
||||||
)
|
)
|
||||||
) >> zulip()(s":thinking: ${markdown linkifyUsers msg}")
|
) >> zulip(_.general, "lila")(s":thinking: ${markdown linkifyUsers msg}")
|
||||||
|
|
||||||
private def publishVictory(msg: String): Funit =
|
private def publishVictory(msg: String): Funit =
|
||||||
slack(
|
slack(
|
||||||
|
@ -228,7 +228,7 @@ final class IrcApi(
|
||||||
icon = "tada",
|
icon = "tada",
|
||||||
text = slackdown.linkifyUsers(msg)
|
text = slackdown.linkifyUsers(msg)
|
||||||
)
|
)
|
||||||
) >> zulip()(s":tada: ${markdown linkifyUsers msg}")
|
) >> zulip(_.general, "lila")(s":tada: ${markdown linkifyUsers msg}")
|
||||||
|
|
||||||
private[irc] def publishInfo(msg: String): Funit =
|
private[irc] def publishInfo(msg: String): Funit =
|
||||||
slack(
|
slack(
|
||||||
|
@ -237,7 +237,7 @@ final class IrcApi(
|
||||||
icon = "horsey",
|
icon = "horsey",
|
||||||
text = slackdown linkifyUsers msg
|
text = slackdown linkifyUsers msg
|
||||||
)
|
)
|
||||||
) >> zulip()(s":info: ${markdown linkifyUsers msg}")
|
) >> zulip(_.general, "lila")(s":info: ${markdown linkifyUsers msg}")
|
||||||
|
|
||||||
object charge {
|
object charge {
|
||||||
import lila.hub.actorApi.plan.ChargeEvent
|
import lila.hub.actorApi.plan.ChargeEvent
|
||||||
|
@ -268,7 +268,7 @@ final class IrcApi(
|
||||||
text = slackdown.linkifyUsers(text),
|
text = slackdown.linkifyUsers(text),
|
||||||
channel = "team"
|
channel = "team"
|
||||||
)
|
)
|
||||||
) >> zulip()(markdown.linkifyUsers(text))
|
) >> zulip(_.general, "lila")(markdown.linkifyUsers(text))
|
||||||
|
|
||||||
private def userAt(username: String) =
|
private def userAt(username: String) =
|
||||||
if (username == "Anonymous") "Anonymous"
|
if (username == "Anonymous") "Anonymous"
|
||||||
|
@ -280,7 +280,9 @@ final class IrcApi(
|
||||||
|
|
||||||
object IrcApi {
|
object IrcApi {
|
||||||
|
|
||||||
sealed trait MonitorType
|
sealed trait MonitorType {
|
||||||
|
def key = toString.toLowerCase
|
||||||
|
}
|
||||||
object MonitorType {
|
object MonitorType {
|
||||||
case object Hunt extends MonitorType
|
case object Hunt extends MonitorType
|
||||||
case object Comm extends MonitorType
|
case object Comm extends MonitorType
|
||||||
|
|
|
@ -19,12 +19,12 @@ final private class ZulipClient(ws: StandaloneWSClient, config: ZulipClient.Conf
|
||||||
key = "zulip.client"
|
key = "zulip.client"
|
||||||
)
|
)
|
||||||
|
|
||||||
def apply(stream: String = ZulipClient.stream.default, topic: String = ZulipClient.topic.default)(
|
def apply(stream: ZulipClient.stream.Selector, topic: String)(
|
||||||
content: String
|
content: String
|
||||||
): Funit =
|
): Funit =
|
||||||
apply(ZulipMessage(stream = stream, topic = topic, content = content))
|
apply(
|
||||||
|
ZulipMessage(stream = stream(ZulipClient.stream), topic = topic, content = content)
|
||||||
def mod(topic: String = ZulipClient.topic.default) = apply(stream = ZulipClient.stream.mod, topic = topic) _
|
)
|
||||||
|
|
||||||
def apply(msg: ZulipMessage): Funit =
|
def apply(msg: ZulipMessage): Funit =
|
||||||
limiter(msg.hashCode) {
|
limiter(msg.hashCode) {
|
||||||
|
@ -55,22 +55,18 @@ private object ZulipClient {
|
||||||
implicit val zulipConfigLoader = AutoConfig.loader[Config]
|
implicit val zulipConfigLoader = AutoConfig.loader[Config]
|
||||||
|
|
||||||
object stream {
|
object stream {
|
||||||
val general = "general"
|
object mod {
|
||||||
val modLog = "mod-log"
|
val log = "mod-log"
|
||||||
val modAdminLog = "mod-admin-log"
|
val adminLog = "mod-admin-log"
|
||||||
val broadcast = "broadcast"
|
val commsPrivate = "mod-comms-private"
|
||||||
}
|
val hunterCheat = "mod-hunter-cheat"
|
||||||
object topic {
|
def adminMonitor(tpe: IrcApi.MonitorType) = s"mod-admin-monitor-${tpe.key}"
|
||||||
val main = "main"
|
def adminMonitorAll = "mod-admin-monitor-all"
|
||||||
val lila = "lila"
|
def adminAppeal = "mod-admin-appeal"
|
||||||
val notes = "notes"
|
}
|
||||||
val clientReports = "client reports"
|
val general = "general"
|
||||||
val commLog = "comm log"
|
val broadcast = "broadcast"
|
||||||
val monitor = "monitor"
|
type Selector = ZulipClient.stream.type => String
|
||||||
val actionLog = "action log"
|
|
||||||
val altLog = "alt log"
|
|
||||||
val appeal = "appeal"
|
|
||||||
val default = main
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue