only trigger if !ping is beginning of line

master
lub 5 years ago
parent 77e4515b3d
commit 7c4cdfdf9d

@ -185,7 +185,7 @@ function Join-Pong {
) )
if($Ball) { if($Ball) {
$padded_ball = $Ball+' ' $padded_ball = '"{0}" ' -f $Ball
} }
$body = '{0}: Pong! (ping {1}took {2} to arrive)' -f $SenderMxId,$padded_ball,$ReadableTimespan $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 #the "ball" is a string returned by the bot
if($Event.content.msgtype -eq 'm.text' -and $Event.content.body -match '!ping( (?<ball>.*))?') { if($Event.content.msgtype -eq 'm.text' -and $Event.content.body -match '^!ping( (?<ball>.*))?') {
$difference = Compare-Timestamps -OriginServerTs $Event.origin_server_ts $difference = Compare-Timestamps -OriginServerTs $Event.origin_server_ts
$readable_timespan = ConvertTo-HumanReadableTimespan -TimeSpan $difference $readable_timespan = ConvertTo-HumanReadableTimespan -TimeSpan $difference

Loading…
Cancel
Save