From 0e15d236e6b6852b063a6d46a19d5846d72ef606 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Fri, 23 Apr 2021 15:37:13 -0400 Subject: [PATCH] Update standalone_twitch_pubsub copy.py --- standalone_twitch_pubsub copy.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/standalone_twitch_pubsub copy.py b/standalone_twitch_pubsub copy.py index 224da5c..152733c 100644 --- a/standalone_twitch_pubsub copy.py +++ b/standalone_twitch_pubsub copy.py @@ -14,11 +14,12 @@ credentials_manager.load_credentials() twitchCredential = credentials_manager.find_Twitch_Credential(config.credentialsNickname) def callback_channelPoints(self, uuid: UUID, data: dict) -> None: - print("Channel Point Redemption") + print("\nChannel Point Detection") print('got callback for UUID ' + str(uuid)) pprint(data) def callback_whisper(uuid: UUID, data: dict) -> None: + print("\nWhisper Detection") print('got callback for UUID ' + str(uuid)) pprint(data) @@ -27,7 +28,7 @@ twitch = Twitch(twitchCredential.pubsub_client_id, twitchCredential.pubsub_secre twitch.authenticate_app([]) # you can get your user auth token and user auth refresh token following the example in twitchAPI.oauth -target_scope = [AuthScope.WHISPERS_READ, AuthScope.CHANNEL_READ_REDEMPTIONS] +target_scope = [AuthScope.WHISPERS_READ, AuthScope.CHANNEL_READ_REDEMPTIONS, AuthScope.CHANNEL_MANAGE_REDEMPTIONS] auth = UserAuthenticator(twitch, target_scope, force_verify=True) token, refresh_token = auth.authenticate() if token is not None: print("found token") @@ -47,11 +48,11 @@ pubsub = PubSub(twitch) pubsub.ping_frequency = 30 pubsub.start() -#uuid1 = pubsub.listen_whispers(user_id, callback_whisper) +uuid1 = pubsub.listen_whispers(user_id, callback_whisper) uuid2 = pubsub.listen_channel_points(user_id, callback_channelPoints) input('press ENTER to close...') # you do not need to unlisten to topics before stopping but you can listen and unlisten at any moment you want -#pubsub.unlisten(uuid1) +pubsub.unlisten(uuid1) pubsub.unlisten(uuid2) pubsub.stop() \ No newline at end of file