Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public changeTitle = (new_title: string, callback: any): void => {
- let t = this;
- let request = require('request');
- request.get("https://api.twitch.tv/kraken/channels/" + this.settings.current_channel + "?client_id="+this.settings.clientId, { json: true }, function (err, res) {
- if (!err && res.statusCode === 200) {
- let current_title = res.body.status;
- console.log(current_title);
- let request2 = require('request');
- let options = {
- url: "https://api.twitch.tv/kraken/channels/"+t.settings.current_channel+"?channel[status]="+current_title+new_title,
- headers: {
- "Authorization": "OAuth "+t.settings.clientId,
- "Accept": "application/vnd.twitchtv.v2+json"
- }
- };
- request2.put(options, (error: Error, response: any, body: any): void => {
- console.log("Title changed?");
- });
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement