|
1
|
|
|
<?php |
|
2
|
|
|
namespace Redbox\Twitch\Resource; |
|
3
|
|
|
use Redbox\Twitch\Exception; |
|
4
|
|
|
use Redbox\Twitch; |
|
5
|
|
|
|
|
6
|
|
|
class Chat extends ResourceAbstract |
|
7
|
|
|
{ |
|
8
|
|
|
|
|
9
|
|
|
public function getChannelLinks($args = array()) |
|
10
|
|
|
{ |
|
11
|
|
|
$response = $this->call('getChannelLinks', $args); |
|
12
|
|
|
|
|
13
|
|
|
if (is_object($response) === true && isset($response->_links) === true) { |
|
14
|
|
|
$channel_link = new Twitch\ChatChannelLink; |
|
15
|
|
|
$channel_link->setEmoticons($response->_links->emoticons); |
|
16
|
|
|
$channel_link->setBadges($response->_links->badges); |
|
17
|
|
|
$channel_link->setSelf($response->_links->self); |
|
18
|
|
|
|
|
19
|
|
|
return $channel_link; |
|
20
|
|
|
} |
|
21
|
|
|
return false; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* NOTE: /chat/emoticons seems no longer supported a since march 2015 it returns a 504 |
|
26
|
|
|
* see https://github.com/johnnymast/redbox-twitch/issues/4 |
|
27
|
|
|
* |
|
28
|
|
|
* @deprecated |
|
29
|
|
|
* @param array $args |
|
30
|
|
|
* @throws Exception\RuntimeException |
|
31
|
|
|
*/ |
|
32
|
|
|
public function getEmoticons($args = array()) |
|
|
|
|
|
|
33
|
|
|
{ |
|
34
|
|
|
// TODO Not done |
|
35
|
|
|
throw new Exception\RuntimeException('Not implemented do to 504 on twitch API.'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function getChannelEmoticons($args = array()) |
|
39
|
|
|
{ |
|
40
|
|
|
$response = $this->call('getChannelEmoticons', $args); |
|
41
|
|
|
|
|
42
|
|
|
$channel_emoticons = new Twitch\ChatChannelEmoticons; |
|
43
|
|
|
|
|
44
|
|
|
if (is_object($response) === true && isset($response->emoticons) === true) { |
|
45
|
|
|
$channel_emoticons->setEmoticons($response->emoticons); |
|
46
|
|
|
return $channel_emoticons; |
|
47
|
|
|
} |
|
48
|
|
|
return false; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getChannelBadges($args = array()) |
|
52
|
|
|
{ |
|
53
|
|
|
$response = $this->call('getChannelBadges', $args); |
|
54
|
|
|
|
|
55
|
|
|
$channel_badges = new Twitch\ChatChannelBadges; |
|
56
|
|
|
|
|
57
|
|
|
if (is_object($response) === true && isset($response->broadcaster) === true) { |
|
58
|
|
|
|
|
59
|
|
|
$channel_badges->setAdmin($response->admin); |
|
60
|
|
|
$channel_badges->setBroadcaster($response->broadcaster); |
|
61
|
|
|
$channel_badges->setSubscriber($response->subscriber); |
|
62
|
|
|
$channel_badges->setGlobalMod($response->global_mod); |
|
63
|
|
|
$channel_badges->setStaff($response->staff); |
|
64
|
|
|
$channel_badges->setTurbo($response->turbo); |
|
65
|
|
|
$channel_badges->setMod($response->mod); |
|
66
|
|
|
return $channel_badges; |
|
67
|
|
|
} |
|
68
|
|
|
return false; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getEmoticonImages($args = array()) |
|
72
|
|
|
{ |
|
73
|
|
|
$response = $this->call('getEmoticonImages', $args); |
|
74
|
|
|
|
|
75
|
|
|
$emoticon_images = new Twitch\ChatEmoticonImages; |
|
76
|
|
|
|
|
77
|
|
|
if (is_object($response) === true && isset($response->emoticons) === true) { |
|
78
|
|
|
$emoticon_images->setEmoticons($response->emoticons); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
return $emoticon_images; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getEmoticonSets($args = array()) |
|
85
|
|
|
{ |
|
86
|
|
|
$response = $this->call('getEmoticonSets', $args); |
|
87
|
|
|
|
|
88
|
|
|
$emoticon_sets = new Twitch\ChatEmoticonImageSets; |
|
89
|
|
|
print_r($emoticon_sets); |
|
90
|
|
|
if (is_object($response) === true && isset($response->emoticon_sets) === true) { |
|
91
|
|
|
$emoticon_sets->setEmoticonSets($response->emoticon_sets); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
return $emoticon_sets; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.