rodbot 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bf9f1ee8fd09d93797a5ba276aa6fec09be9620e540f118240525c73a6fda6b
4
- data.tar.gz: b36fdd850e38596aaf7da805107d0cbbbcb46de823e76cad151676fbcc14dd9c
3
+ metadata.gz: 6e6caa3fc8d7a38fb433cc01dedd9e521f2a7c2cd79ebaa4f78396c39f1a5cfc
4
+ data.tar.gz: 8d7f438f66d0d8494c7629ea3f1f363f730ce34a0c5178aaca0ee580e6a7a512
5
5
  SHA512:
6
- metadata.gz: 37a9346640167dc0543d9361b1d53789e363d27e6c57129fde777897f7e8ec3fff51e735129accdfaf8caee943a29fa19daae2ea5acdab6023d11d7dbf4ebaaa
7
- data.tar.gz: 6fec833877807a7b6dc85e19682c5bf88172ad2ff32ce0d0c5e83565cecbf60e54517f1aaeda451e17ee610f5338969bd05ffe5a8c002b649c28c3e35f25949b
6
+ metadata.gz: 7ddbdf27810f750712ff0a7990ec6da94d084a289c9364d380ae33d1107dd6693ce60b099ea0826aba551a61fc3033b2ea6c6808ef67aa367eac29802cae5e30
7
+ data.tar.gz: 5160f0113df885f7ec1597b18eaee70420d82eb0cc11b66d54ee7bb5642f7e95224b1a33c97ced6d75bd89ad6b061627e4a518811a828bbc10c6d66cfbcb4194
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Nothing so far
4
4
 
5
+ ## 0.3.3
6
+
7
+ #### Additions
8
+ * Support placeholders when using `Rodbot.say` and add `[[EVERYBODY]]`
9
+ placeholder to mention all hands in a room or channel.
10
+
5
11
  ## 0.3.2
6
12
 
7
13
  #### Additions
data/README.md CHANGED
@@ -166,6 +166,7 @@ The response may contain special tags which have to be replace appropriately by
166
166
  Tag | Replaced with
167
167
  ----|--------------
168
168
  `[[SENDER]]` | Mention the sender of the command.
169
+ `[[EVERYBODY]]` | Mention everybody.
169
170
 
170
171
  #### Other Routes
171
172
 
@@ -0,0 +1 @@
1
+ de9183abfb13dd5098ca5e8e2cba6b0e27f349c2e90b85ef387e5b81730ff7d911f29b47b7e4900719e198514d097513f109916c6e64f2b9361237b35b5b0a70
@@ -57,10 +57,10 @@ module Rodbot
57
57
  server = TCPServer.new(*bind)
58
58
  loop do
59
59
  Thread.start(server.accept) do |remote|
60
- body = remote.gets("\x04")
60
+ md = remote.gets("\x04").chop
61
61
  remote.close
62
- body.force_encoding('UTF-8')
63
- room.send_html body.md_to_html
62
+ md.force_encoding('UTF-8')
63
+ room.send_html md.psub(placeholders).md_to_html
64
64
  end
65
65
  end
66
66
  end
@@ -78,12 +78,13 @@ module Rodbot
78
78
  def reply_to(message)
79
79
  command(*message.content[:body][1..].split(/\s+/, 2)).
80
80
  md_to_html.
81
- psub(placeholders(client.get_user(message.sender)))
81
+ psub(placeholders(sender: client.get_user(message.sender)))
82
82
  end
83
83
 
84
- def placeholders(sender)
84
+ def placeholders(locals={})
85
85
  {
86
- sender: "https://matrix.to/#/#{sender.id}"
86
+ sender: ("https://matrix.to/#/#{locals[:sender].id}" if locals[:sender]),
87
+ everybody: "https://matrix.to/#room"
87
88
  }
88
89
  end
89
90
 
@@ -39,12 +39,12 @@ module Rodbot
39
39
  server = TCPServer.new(*bind)
40
40
  loop do
41
41
  Thread.start(server.accept) do |remote|
42
- body = remote.gets("\x04")
42
+ md = remote.gets("\x04").chop
43
43
  remote.close
44
- body.force_encoding('UTF-8')
44
+ md.force_encoding('UTF-8')
45
45
  client.web_client.chat_postMessage(
46
46
  channel: channel_id,
47
- text: md_to_slack_text(body),
47
+ text: md_to_slack_text(md.psub(placeholders)),
48
48
  as_user: true
49
49
  )
50
50
  end
@@ -70,14 +70,15 @@ module Rodbot
70
70
 
71
71
  def reply_to(message)
72
72
  command(*message.text[1..].split(/\s+/, 2)).
73
- psub(placeholders(message.user)).
73
+ psub(placeholders(sender: message.user)).
74
74
  then { md_to_slack_text(_1) }
75
75
  end
76
76
 
77
77
  # @see https://api.slack.com/reference/surfaces/formatting
78
- def placeholders(sender)
78
+ def placeholders(locals={})
79
79
  {
80
- sender: "<@#{sender}>"
80
+ sender: ("<@#{locals[:sender]}>" if locals[:sender]),
81
+ everybody: "<!channel>"
81
82
  }
82
83
  end
83
84
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rodbot
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
@@ -29,7 +29,7 @@ cert_chain:
29
29
  kAyiRqgxF4dJviwtqI7mZIomWL63+kXLgjOjMe1SHxfIPo/0ji6+r1p4KYa7o41v
30
30
  fwIwU1MKlFBdsjkd
31
31
  -----END CERTIFICATE-----
32
- date: 2023-10-18 00:00:00.000000000 Z
32
+ date: 2023-10-21 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: zeitwerk
@@ -452,6 +452,7 @@ files:
452
452
  - checksums/rodbot-0.3.0.gem.sha512
453
453
  - checksums/rodbot-0.3.1.gem.sha512
454
454
  - checksums/rodbot-0.3.2.gem.sha512
455
+ - checksums/rodbot-0.3.3.gem.sha512
455
456
  - doc/rodbot.afphoto
456
457
  - doc/rodbot.avif
457
458
  - exe/rodbot
metadata.gz.sig CHANGED
Binary file