twitch-bot 4.1.0 → 4.1.1

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: 59dabc57f451a9054c650af520cacc2b05b2532538d22080404a19a30be51c35
4
- data.tar.gz: d6f75053e902744d29c512abc89ebfca97acfb46fc4f7a5362c61faec9902534
3
+ metadata.gz: b95458f55a188c3e08f200675f0147561f9316aea8eeac3f570eb5a1f984e755
4
+ data.tar.gz: b63b75edbe1b0f2fa6f31e8e0ca1064e8a6c6b0cf9defd9f91f13646ca48fdc6
5
5
  SHA512:
6
- metadata.gz: 9d25aae7bfcf9b00aca8d9cfde3d76e480c933aa12ac03ea7b74406f96645db3d374455b5152dd420e854bb87f15048ffa03eea59e7b266fe5c9a5207df25d43
7
- data.tar.gz: 5baf4cf1ca8392c2d92c80b1d7582c01fe0a9ec3911e14decd8aca2d0e72503f7a20cb3521367c833e7c6de4f874dbbeeb62cbde6f3dfcd365cdc714cd20e264
6
+ metadata.gz: 9b1be2870429a4748980a9490749181275a0d59ac9cae46be6538e7a93e98dcbd6fbdf6614b9a6701e508156e35d5db77c98685ea44dcae8263461a3dc8f58e9
7
+ data.tar.gz: a6be65d6a5369df67ec3243c7c17313a45fb7df135ea862c0b04e92b2d5ac6953c18993277e33772f373dfbdc6d46154edfc36e287788c6f388e5829a80104a7
@@ -1,5 +1,9 @@
1
1
  # Changelog Twitch::Bot
2
2
 
3
+ ## v4.1.1
4
+
5
+ - [NEW] `CommandHandler` by default responds to `:user_message` events.
6
+
3
7
  ## v4.1.0
4
8
 
5
9
  * [NEW] New `CommandHandler` class that simplifies building chat commands.
@@ -4,6 +4,10 @@ module Twitch
4
4
  module Bot
5
5
  # Base class for implementing chat commands
6
6
  class CommandHandler < EventHandler
7
+ def self.handled_events
8
+ [:user_message]
9
+ end
10
+
7
11
  def initialize(event:, client:)
8
12
  super
9
13
  @command_aliases = []
@@ -6,6 +6,21 @@ module Twitch
6
6
  class EventHandler
7
7
  attr_reader :event, :client
8
8
 
9
+ #
10
+ # Return a list of event types this handler subscribes to
11
+ #
12
+ # @return [Array] list of event types
13
+ #
14
+ def self.handled_events
15
+ []
16
+ end
17
+
18
+ #
19
+ # Inititalize an event handler object
20
+ #
21
+ # @parameter event The latest event of a subscribed type
22
+ # @parameter client The current chat client object
23
+ #
9
24
  def initialize(event:, client:)
10
25
  @event = event
11
26
  @client = client
@@ -19,15 +34,6 @@ module Twitch
19
34
  def call
20
35
  raise "Unhandled #{event.type}"
21
36
  end
22
-
23
- #
24
- # Return a list of event types this handler can handle
25
- #
26
- # @return [Array] event type list
27
- #
28
- def self.handled_events
29
- []
30
- end
31
37
  end
32
38
  end
33
39
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Twitch
4
4
  module Bot
5
- VERSION = "4.1.0"
5
+ VERSION = "4.1.1"
6
6
  end
7
7
  end
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe Twitch::Bot::CommandHandler do
4
+ it "responds to user_message" do
5
+ expect(described_class.handled_events).to include(:user_message)
6
+ end
7
+
4
8
  it "responds to a known command" do
5
9
  config = Twitch::Bot::Config.new
6
10
  client = Twitch::Bot::Client.new(config: config)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitch-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jochen Lillich