Updated TwitcherExtended
Fixed get_users(), check if user_ids[0] is an array, and if so, set user_ids to user_ids[0]. Remove debugging prints in get_live_streamers_data() Added get_team_info() to get Twitch Team information by name.
This commit is contained in:
parent
2e2f8b47c0
commit
63eb02eb27
1 changed files with 11 additions and 5 deletions
|
|
@ -308,6 +308,8 @@ func reply_message(message: String, msg_id: String, as_streamer: bool = false) -
|
||||||
func get_users_by_id(...user_ids: Array) -> Array[TwitchUser]:
|
func get_users_by_id(...user_ids: Array) -> Array[TwitchUser]:
|
||||||
var tusers: Array[TwitchUser] = []
|
var tusers: Array[TwitchUser] = []
|
||||||
var qusers: Array[String] = []
|
var qusers: Array[String] = []
|
||||||
|
if user_ids[0] is Array:
|
||||||
|
user_ids = user_ids[0]
|
||||||
for user_id in user_ids:
|
for user_id in user_ids:
|
||||||
if _cache_users.has(user_id):
|
if _cache_users.has(user_id):
|
||||||
tusers.append(_cache_users[user_id])
|
tusers.append(_cache_users[user_id])
|
||||||
|
|
@ -521,15 +523,19 @@ func get_live_streamers_data(user_ids: Array = []) -> Dictionary[String, TwitchS
|
||||||
user_ids = user_ids.slice(99)
|
user_ids = user_ids.slice(99)
|
||||||
opt.user_id = new_batch
|
opt.user_id = new_batch
|
||||||
var streams_iterator := await api.get_streams(opt)
|
var streams_iterator := await api.get_streams(opt)
|
||||||
print("Fetching live...")
|
|
||||||
for stream_promise in streams_iterator:
|
for stream_promise in streams_iterator:
|
||||||
var stream_data: TwitchStream = await stream_promise
|
var stream_data: TwitchStream = await stream_promise
|
||||||
if stream_data:
|
if stream_data:
|
||||||
print("%s(%s) is live" % [stream_data.user_name, stream_data.user_id])
|
|
||||||
streams_data[stream_data.user_id] = stream_data
|
streams_data[stream_data.user_id] = stream_data
|
||||||
else:
|
|
||||||
print("WTF!!!! Iter is null?")
|
|
||||||
print("Fetching is done.")
|
|
||||||
_is_processing_streams = false
|
_is_processing_streams = false
|
||||||
return streams_data
|
return streams_data
|
||||||
|
|
||||||
|
func get_team_info(team_name: String) -> TwitchTeam:
|
||||||
|
var opt := TwitchGetTeams.Opt.new()
|
||||||
|
opt.name = team_name
|
||||||
|
var team_resp := await api.get_teams(opt)
|
||||||
|
if team_resp and team_resp.data.size() > 0:
|
||||||
|
return team_resp.data[0]
|
||||||
|
else:
|
||||||
|
return null
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue