Discordで作成したサーバールーム内にいるメンバーを別サーバーからBanしたいのですが
php
1define("API_ENDPOINT",'https://discordapp.com/api/v6'); 2https://discordapp.com/api/oauth2/authorize?response_type=code&client_id=".CLIENT_ID."&scope=***&state=***&permissions=8&redirect_uri=".urlencode(REDIRECT_URI);
これでrefresh_tokenを取得し
下記コードでBanしようとしましたがうまくいきません。
php
1$params = array( 2 'client_id'=>CLIENT_ID, 3 'client_secret'=>CLIENT_SECRET, 4 'grant_type'=>'refresh_token', 5 'refresh_token'=>$refresh_token, 6 'permissions'=>8, 7 'scope'=>'identify connections', 8 'redirect_uri'=>REDIRECT_URI 9 ); 10 11 $ch = curl_init(); 12 curl_setopt($ch, CURLOPT_URL, API_ENDPOINT."/guilds/****/bans/******"); 13 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 14 curl_setopt($ch, CURLOPT_HEADER, TRUE); 15 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 16 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 17 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); 18 curl_setopt($ch, CURLOPT_POST, TRUE); 19 curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 20 $output2 = curl_exec($ch) or dir('error ' . curl_error($ch)); 21 curl_close($ch); 22
そもそもやり方が間違っているのでしょうか。。。
回答3件
あなたの回答
tips
プレビュー