From 1d3076e34b1f649140f835196a00191c46e47425 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sat, 5 Nov 2022 09:39:16 +0100 Subject: [PATCH] Break api hook_chat -> on_chat --- README.md | 2 +- docs/01.md | 4 ++-- examples/01_chat_logger.rb | 2 +- lib/teeworlds-client.rb | 2 +- sample.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1efe45b..f055f15 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ require_relative 'lib/teeworlds-client' client = TeeworldsClient.new(verbose: false) -client.hook_chat do |msg| +client.on_chat do |msg| puts "[chat] #{msg}" end diff --git a/docs/01.md b/docs/01.md index 2514d23..28a19d1 100644 --- a/docs/01.md +++ b/docs/01.md @@ -22,7 +22,7 @@ ## TeeworldsClient -### #hook_chat(&block) +### #on_chat(&block) **Parameter: block [Block]** @@ -34,7 +34,7 @@ The block takes one parameter of type [ChatMessage](#chatmessage). ```ruby client = TeeworldsClient.new -client.hook_chat do |msg| +client.on_chat do |msg| puts "[chat] #{msg}" end diff --git a/examples/01_chat_logger.rb b/examples/01_chat_logger.rb index 14e7a3a..94fc41f 100644 --- a/examples/01_chat_logger.rb +++ b/examples/01_chat_logger.rb @@ -15,7 +15,7 @@ client = TeeworldsClient.new(verbose: false) # msg.author.team # msg.author.name # msg.author.clan -client.hook_chat do |msg| +client.on_chat do |msg| puts "[chat] #{msg}" end diff --git a/lib/teeworlds-client.rb b/lib/teeworlds-client.rb index 9fa41f6..1a19ba8 100644 --- a/lib/teeworlds-client.rb +++ b/lib/teeworlds-client.rb @@ -52,7 +52,7 @@ class TeeworldsClient } end - def hook_chat(&block) + def on_chat(&block) @hooks[:chat] = block end diff --git a/sample.rb b/sample.rb index 556a949..4f15e53 100755 --- a/sample.rb +++ b/sample.rb @@ -30,7 +30,7 @@ client = TeeworldsClient.new(verbose: args[:verbose]) client.set_startinfo( name: "ruby gamer") -client.hook_chat do |msg| +client.on_chat do |msg| puts "[chat] #{msg}" end