Skip to content

Commit 180ddd9

Browse files
author
cp6
committed
Add get streamLanguage
Add get streamLanguage
1 parent fe0ccb4 commit 180ddd9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

twitch-class.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,22 @@ public function streamStart()
294294
}
295295
}
296296

297+
/**
298+
* Gets users stream language
299+
* @return string
300+
* @throws Exception
301+
*
302+
*/
303+
public function streamLanguage()
304+
{
305+
$data = json_decode($this->data, true);
306+
if (!isset($data['data'][0]['language'])) {
307+
throw new Exception("No data found");
308+
} else {
309+
return $data['data'][0]['language'];
310+
}
311+
}
312+
297313
/**
298314
* Gets users current stream thumbnail
299315
* @return string

0 commit comments

Comments
 (0)