0

Twitch 用の小さなチャット ボットがあり、ストリームのタイトルを変更できる機能を作りたいと考えています。私の関数は現時点で次のように見えます:

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?");
            });
        }
    });
};

console.log(current_title) で、現在のストリーム タイトルを確認できます。console.log("Title changed?") の後、何も起こりませんでした。エラー 410 GONE が表示されます。そのため、タイトルを変更する私の方法はサポートされなくなりました。誰かがタイトルを変更する方法を教えてもらえますか?

前もって感謝します :)

4

1 に答える 1

0

これはUpdate Channelでカバーされているようです

channel[status]具体的には、単にstatusクエリ パラメータとして使用するのではなく、 .

let options = {
            url: "https://api.twitch.tv/kraken/channels/"+t.settings.current_channel+"?status="+new_title,
            headers: {
                "Authorization": "OAuth "+t.settings.clientId,
                "Accept": "application/vnd.twitchtv.v2+json"
            }

channel_editor特定のチャネルでこれを使用するには、スコープも必要です。

于 2017-07-24T17:20:32.773 に答える