-
Notifications
You must be signed in to change notification settings - Fork 0
Send chat messages
Yazaar edited this page Jul 16, 2019
·
2 revisions
To send a chat message thru Python, send a post request to the main program as the following:
requests.post('http://localhost:' + str(port) + '/SendMessage', json={'bot':'local', 'message':'Hi from twitch chat!'})
requests.post('http://localhost:' + str(port) + '/SendMessage', json={'bot':'streamelements', 'message':'Hi from twitch chat!'})
EventData.SendMessage({'bot':'local', 'message':'Hi from twitch chat!'})I would recommend to use the local bot for the reason that the TMI has better privileges for sending messages (Sending messages more often thru TMI than StreamElements). The amount of post requests thru StreamElements are limited so it might be a good idea to save the quotas for more relevant StreamElements requests.
To send a chat message thru HTML/JavaScript, send a socket event to the main program as the following:
sio.emit('SendMessage', {'bot':'local', 'message':'Hi from twitch chat!'})
sio.emit('SendMessage', {'bot':'streamelements', 'message':'Hi from twitch chat!'})I would recommend to use the local bot for the reason written above.