Last donate command , twitch chat

Hi all , i have python script who in realtime get data from donation service and create json file.Script push info to nightbot in realtime when i recive donate and nightbot post in twitch chat.( i create nightbot app get authtoken and use for this.But i want make command !LASTDONATE.Script save json file on my webserver and my json look like this

“{"id":107730768,"alert_type":"1","is_shown":"0","additional_data":"{\"randomness\":468}","billing_system":"fake","billing_system_type":null,"username":"morningtea","amount":"1.00","amount_formatted":"1","amount_main":1,"currency":"EUR","message":"This is test donate message","header":"","date_created":"2022-12-15 23:53:52","emotes":null,"ap_id":null,"_is_test_alert":true,"message_type":"text","preset_id":0}”

how i can get username,amount,currecy,message and data,time?

It sounds like you’re already successfully using the “send channel message” Nightbot API to have Nightbot post in Twitch chat whenever there is a donation. To have a !LASTDONATE command that posts the same info, the easiest thing to do might be to use the “edit custom command by ID” Nightbot API to update the !LASTDONATE command with your donation info message at the same time your script uses the “send channel message” API to post the message.

Alternatively, you could set up a web server reachable over the internet by Nightbot. The web server would have an API endpoint that would return the current donation message (calculate the message the same way you already do when your existing script posts the message in chat automatically upon a donation). The !LASTDONATE command would use the urlfetch Nightbot command variable to get the donation message from your web server API endpoint.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.