Updated TwitcherExtended

Fixed typo in channel_points_voting_enabled.
Changed poll to _poll to avoid name conflicts with poll() function name.
This commit is contained in:
Mario Steele 2026-03-06 21:23:54 -06:00
parent b47df7ad86
commit 2d25921688

View file

@ -454,14 +454,14 @@ func poll(title: String, choices: Array[String], duration: int = 60, channel_poi
var poll_body: TwitchCreatePoll.Body = TwitchCreatePoll.Body.create(streamer_user.id, title, body_choices, duration) var poll_body: TwitchCreatePoll.Body = TwitchCreatePoll.Body.create(streamer_user.id, title, body_choices, duration)
if channel_points_voting_enabled: if channel_points_voting_enabled:
poll_body.channel_points_per_vote = channel_points_per_vote poll_body.channel_points_per_vote = channel_points_per_vote
poll_body.channel_points_voiting_enabled = channel_points_voting_enabled poll_body.channel_points_voting_enabled = channel_points_voting_enabled
var poll_response: TwitchCreatePoll.Response = await api.create_poll(poll_body) var poll_response: TwitchCreatePoll.Response = await api.create_poll(poll_body)
if poll_response.response.response_code != 200: if poll_response.response.response_code != 200:
var error_message: String = poll_response.response.response_data.get_string_from_utf8() var error_message: String = poll_response.response.response_data.get_string_from_utf8()
push_error("Can't create poll response cause of ", error_message) push_error("Can't create poll response cause of ", error_message)
return {} return {}
var poll: TwitchPoll = poll_response.data[0] var _poll: TwitchPoll = poll_response.data[0]
var poll_end_time: int = Time.get_ticks_msec() + duration * 100 * POLL_TIMEOUT_MS var poll_end_time: int = Time.get_ticks_msec() + duration * 1000 * POLL_TIMEOUT_MS
var event: TwitchEventsub.Event var event: TwitchEventsub.Event
if eventsub && eventsub.has_subscription(TwitchEventsubDefinition.CHANNEL_POLL_END, {&"broadcaster_user_id": streamer_user.id}): if eventsub && eventsub.has_subscription(TwitchEventsubDefinition.CHANNEL_POLL_END, {&"broadcaster_user_id": streamer_user.id}):
var poll_ended: bool var poll_ended: bool
@ -469,8 +469,8 @@ func poll(title: String, choices: Array[String], duration: int = 60, channel_poi
if poll_end_time < Time.get_ticks_msec(): if poll_end_time < Time.get_ticks_msec():
return {} return {}
event = await eventsub.event_received event = await eventsub.event_received
if event.Type != TwitchEventsubDefinition.CHANNEL_POLL_END: continue if event.type != TwitchEventsubDefinition.CHANNEL_POLL_END: continue
if event.data[&"id"] != poll.id: continue if event.data[&"id"] != _poll.id: continue
break break
else: else:
_log.i("Can't wait for poll end. Either eventsub is not set to it not listening to ending polls") _log.i("Can't wait for poll end. Either eventsub is not set to it not listening to ending polls")