From 3947cfcce282c66fc649d443a3f6a5b005b5b543 Mon Sep 17 00:00:00 2001 From: Niklas Date: Sun, 6 Sep 2020 13:44:13 +0200 Subject: [PATCH] print msg in chat when poked --- src/go/tsgo/tsgo.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/go/tsgo/tsgo.go b/src/go/tsgo/tsgo.go index 252c65b..c324f2a 100644 --- a/src/go/tsgo/tsgo.go +++ b/src/go/tsgo/tsgo.go @@ -1,5 +1,10 @@ package tsgo +import ( + "fmt" + "time" +) + type AnyId uint16 type PluginMessageTarget int @@ -39,6 +44,16 @@ func Ts3pluginShutdown() { // Ts3onClientPokeEvent event func Ts3onClientPokeEvent(serverConnectionHandlerID uint64, fromClientID AnyId, pokerName string, pokerUniqueIdentity string, message string, ffIgnored int) int { - Ts3Functions.PrintMessage(serverConnectionHandlerID, "Ayy", PLUGIN_MESSAGE_TARGET_SERVER) + + // TODO add correct color and icon + msg := fmt.Sprintf("[color=blue]<%s> [URL=client://%d/%s]\"%s\"[/URL] pokes you", time.Now().Format("15:04:05"), fromClientID, pokerUniqueIdentity, pokerName) + + if message != "" { + msg += ": " + message + } + + msg += "[/color]" + + Ts3Functions.PrintMessage(serverConnectionHandlerID, msg, PLUGIN_MESSAGE_TARGET_SERVER) return 1 }