From 7c4cdfdf9db042ba07c127bc4a2943b311c329b8 Mon Sep 17 00:00:00 2001 From: lub Date: Thu, 28 Nov 2019 15:15:40 +0100 Subject: [PATCH] only trigger if !ping is beginning of line --- bot.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.ps1 b/bot.ps1 index dd36eaf..46726b1 100755 --- a/bot.ps1 +++ b/bot.ps1 @@ -185,7 +185,7 @@ function Join-Pong { ) if($Ball) { - $padded_ball = $Ball+' ' + $padded_ball = '"{0}" ' -f $Ball } $body = '{0}: Pong! (ping {1}took {2} to arrive)' -f $SenderMxId,$padded_ball,$ReadableTimespan @@ -207,7 +207,7 @@ function Open-JoinEvent { ) #the "ball" is a string returned by the bot - if($Event.content.msgtype -eq 'm.text' -and $Event.content.body -match '!ping( (?.*))?') { + if($Event.content.msgtype -eq 'm.text' -and $Event.content.body -match '^!ping( (?.*))?') { $difference = Compare-Timestamps -OriginServerTs $Event.origin_server_ts $readable_timespan = ConvertTo-HumanReadableTimespan -TimeSpan $difference