natsim

NATS ↔ Instant Messaging Bridge
git clone https://git.instinctive.eu/natsim.git
Log | Files | Refs | README | LICENSE

commit 15d696239ca01acfaea01daa50e1f67266efecf7
parent efdb116759e0c1f87226668c80b6dd625fd6724c
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Thu, 12 Jun 2025 21:31:36 +0000

Formatted-string send to IRC
Diffstat:
Mmain.go | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/main.go b/main.go @@ -206,10 +206,10 @@ func (natsim *NatsIM) doCommands() { } case "version": - natsim.ircSend("natsim " + version) + natsim.ircSendf("natsim %s", version) default: - natsim.ircSend("Unknown command: " + cmd.name) + natsim.ircSendf("Unknown command %q", cmd.name) } } } @@ -233,7 +233,7 @@ func (natsim *NatsIM) ircReceive(e *irc.Event) { } func (natsim *NatsIM) ircSendError(context string, err error) { - prefix := "[E]" + prefix := "[E] " if context != "" { prefix += context + ": " } @@ -265,6 +265,10 @@ func (natsim *NatsIM) ircSend(s string) { } } +func (natsim *NatsIM) ircSendf(format string, a ...interface{}) { + natsim.ircSend(fmt.Sprintf(format, a...)) +} + func (natsim *NatsIM) ircSender() { for { line, ok := <-natsim.ircQueue