When a Channel Point reward requires text input from the viewer, this event is available over Chat. Tags are provided with each Message, and these will have a custom-reward-id
field.
If a Channel Point reward does not require text input, I have no known method of capturing the event.
Assuming you're on Python/IRC and have something similar to
# ####################################################################
# When a message is sent to the channel
def on_pubmsg(self, c, e):
msg = e.arguments[0]
tags = {}
for t in e.tags:
tags.update({t.get('key'): t.get('value')})
balls = tags.get('custom-reward-id')
if balls:
self.on_balls(balls, msg, c, e)
We create a few variables to reference and pass. Here we detect the request and pass it to on_balls
method...
Here is my on_balls
method:
def on_balls(self, balls, msg, c, e):
print("Balls!")
if balls in [
'd6f36783-e794-4846-95fc-e61b52c83b34'
]:
return tts(msg)
if balls in [
'91507c6d-59f6-45eb-8e8d-416951e4821a'
]:
return self.play_clip(msg)
if balls in [
'6578a38b-8fc4-4298-90df-2d5ac7591022'
]:
self.c.privmsg(self.channel, ".timeout %s 69" % (msg))