Skip to content
Snippets Groups Projects
Verified Commit 81a31a67 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Improve local echo slightly in bot example

parent bfd8ad60
Branches
Tags
No related merge requests found
...@@ -56,11 +56,11 @@ class MatrixBot ...@@ -56,11 +56,11 @@ class MatrixBot
room = client.ensure_room message.room_id room = client.ensure_room message.room_id
sender = client.get_user message.sender sender = client.get_user message.sender
puts "[#{Time.now.strftime '%H:%M'}] <#{sender.id} in #{room.id}> #{message.content[:body]}"
origin_ts = Time.at(message[:origin_server_ts] / 1000.0) origin_ts = Time.at(message[:origin_server_ts] / 1000.0)
diff = Time.now - origin_ts diff = Time.now - origin_ts
puts "[#{Time.now.strftime '%H:%M'}] <#{sender.id} in #{room.id} @ #{diff}ms> \"#{message.content[:body]}\""
plaintext = '%<sender>s: Pong! (ping%<msg>s took %<time>u ms to arrive)' plaintext = '%<sender>s: Pong! (ping%<msg>s took %<time>u ms to arrive)'
html = '<a href="https://matrix.to/#/%<sender>s">%<sender>s</a>: Pong! (<a href="https://matrix.to/#/%<room>s/%<event>s">ping</a>%<msg>s took %<time>u ms to arrive)' html = '<a href="https://matrix.to/#/%<sender>s">%<sender>s</a>: Pong! (<a href="https://matrix.to/#/%<room>s/%<event>s">ping</a>%<msg>s took %<time>u ms to arrive)'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment