twitchrb 1.2.1 → 1.2.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: 15c7d6175a906c3469b5d3ac691f66ef8f86d0682959a648b69cb0d35f39523f
4
- data.tar.gz: 8a505c88b94833d36805006b7a8ab1e6cb54e76ecb05cb99ffb81cca5c7bd491
3
+ metadata.gz: efe6dbb90fcec7a7f5ce13ca4b812349bfa16ff95140b30ba344b2b352d5176c
4
+ data.tar.gz: 7e954ca5c0f4462e35d9950af57d43da72871ac708398dc97561912a8ae535c9
5
5
  SHA512:
6
- metadata.gz: 197a13bac91e7f1ff361bf021cff8f2c15a7d9b6f1812a393908fffd9cf0df34cf71863521c8ca85253dfeeab4ac9c81388ced713a047babfcc449fc1d906672
7
- data.tar.gz: 992d0eb6c70cde046b94b42d2c969c3530ebbc9dfc3b14cf288b0d804280fc4af03347361fc311889aa268049bdf1e7fdec2c8121f924492850dd6eb365a994d
6
+ metadata.gz: 9438a27de32ba91ea58e3a95ab705e0138d5274ba61274c1c190d1b88d1e2003d3171fcfdbaecdb230434b05db384ec200e8b49c90f7ced6096d2c2ef4967c49
7
+ data.tar.gz: 20c286d14a3dfa432deec04f62864bf70282e124d346b2594f769021db3bca4c768319614a7689b9756b33bd224507f8f503fd7e7e5e302a9f7ef37dc1b1f24c
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitchrb (1.2.1)
4
+ twitchrb (1.2.3)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- base64 (0.2.0)
11
10
  dotenv (2.7.6)
12
- faraday (2.8.1)
13
- base64
14
- faraday-net_http (>= 2.0, < 3.1)
15
- ruby2_keywords (>= 0.0.4)
16
- faraday-net_http (3.0.2)
11
+ faraday (2.9.0)
12
+ faraday-net_http (>= 2.0, < 3.2)
13
+ faraday-net_http (3.1.0)
14
+ net-http
17
15
  minitest (5.15.0)
16
+ net-http (0.4.1)
17
+ uri
18
18
  rake (12.3.3)
19
- ruby2_keywords (0.0.5)
19
+ uri (0.13.0)
20
20
 
21
21
  PLATFORMS
22
22
  ruby
data/README.md CHANGED
@@ -251,6 +251,13 @@ These require an application OAuth access token.
251
251
 
252
252
  ### Moderators
253
253
 
254
+ ```ruby
255
+ # List all channels a user has moderator privileges on
256
+ # Required scope: user:read:moderated_channels
257
+ # user_id must be the currently authenticated user
258
+ @client.moderators.channels user_id: 123
259
+ ```
260
+
254
261
  ```ruby
255
262
  # List all moderators for a broadcaster
256
263
  # Required scope: moderation:read
@@ -310,7 +317,15 @@ These require an application OAuth access token.
310
317
  @client.raids.delete broadcaster_id: 123
311
318
  ```
312
319
 
320
+ ### Chat Messages
321
+
313
322
  ```ruby
323
+ # Send a chat message to a broadcaster's chat room
324
+ # Requires an app or user access token that includes user:write:chat then either user:bot or channel:bot
325
+ # sender_id must be the currently authenticated user
326
+ # reply_to is optional and is the UUID of the message to reply to
327
+ @client.chat_messages.create broadcaster_id: 123, sender_id: 321, message: "A test message", reply_to: "aabbcc"
328
+
314
329
  # Removes a single chat message from the broadcaster's chat room
315
330
  # Requires moderator:manage:chat_messages
316
331
  # moderator_id can be either the currently authenticated moderator or the broadcaster
@@ -0,0 +1,4 @@
1
+ module Twitch
2
+ class ChatMessage < Object
3
+ end
4
+ end
@@ -1,6 +1,13 @@
1
1
  module Twitch
2
2
  class ChatMessagesResource < Resource
3
-
3
+
4
+ def create(broadcaster_id:, sender_id:, message:, reply_to: nil)
5
+ attrs = {broadcaster_id: broadcaster_id, sender_id: sender_id, message: message, reply_parent_message_id: reply_to}
6
+
7
+ response = post_request("chat/messages", body: attrs)
8
+ ChatMessage.new(response.body.dig("data")[0])
9
+ end
10
+
4
11
  # moderator_id must match the user in the OAuth token
5
12
  def delete(broadcaster_id:, moderator_id:, message_id:)
6
13
  delete_request("moderation/chat?broadcaster_id=#{broadcaster_id}&moderator_id=#{moderator_id}&message_id=#{message_id}")
@@ -1,6 +1,12 @@
1
1
  module Twitch
2
2
  class ModeratorsResource < Resource
3
-
3
+
4
+ # User ID must match the user in the OAuth token
5
+ def channels(user_id:)
6
+ response = get_request("moderation/channels", params: {user_id: user_id})
7
+ Collection.from_response(response, type: Channel)
8
+ end
9
+
4
10
  # Broadcaster ID must match the user in the OAuth token
5
11
  def list(broadcaster_id:, **params)
6
12
  response = get_request("moderation/moderators", params: params.merge(broadcaster_id: broadcaster_id))
@@ -1,3 +1,3 @@
1
1
  module Twitch
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.3"
3
3
  end
data/lib/twitch.rb CHANGED
@@ -85,5 +85,6 @@ module Twitch
85
85
  autoload :BlockedTerm, "twitch/objects/blocked_term"
86
86
  autoload :CharityCampaign, "twitch/objects/charity_campaign"
87
87
  autoload :Chatter, "twitch/objects/chatter"
88
+ autoload :ChatMessage, "twitch/objects/chat_message"
88
89
 
89
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitchrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-02 00:00:00.000000000 Z
11
+ date: 2024-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -57,6 +57,7 @@ files:
57
57
  - lib/twitch/objects/channel.rb
58
58
  - lib/twitch/objects/channel_editor.rb
59
59
  - lib/twitch/objects/charity_campaign.rb
60
+ - lib/twitch/objects/chat_message.rb
60
61
  - lib/twitch/objects/chatter.rb
61
62
  - lib/twitch/objects/clip.rb
62
63
  - lib/twitch/objects/custom_reward.rb