Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public changeTitle = (new_title: string, callback: any): void => {
  2. let t = this;
  3. let request = require('request');
  4. request.get("https://api.twitch.tv/kraken/channels/" + this.settings.current_channel + "?client_id="+this.settings.clientId, { json: true }, function (err, res) {
  5. if (!err && res.statusCode === 200) {
  6. let current_title = res.body.status;
  7. console.log(current_title);
  8. let request2 = require('request');
  9. let options = {
  10. url: "https://api.twitch.tv/kraken/channels/"+t.settings.current_channel+"?channel[status]="+current_title+new_title,
  11. headers: {
  12. "Authorization": "OAuth "+t.settings.clientId,
  13. "Accept": "application/vnd.twitchtv.v2+json"
  14. }
  15. };
  16. request2.put(options, (error: Error, response: any, body: any): void => {
  17. console.log("Title changed?");
  18. });
  19. }
  20. });
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement