Last active
September 8, 2022 23:32
-
-
Save tajuszk/b26d27132cc03a99ec271d2e7ef502ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CONSUMER_KEY = '***'; | |
const CONSUMER_SECRET = '***'; | |
const client = TwitterClient2.getInstance(CONSUMER_KEY, CONSUMER_SECRET) | |
/** | |
* メイン処理 | |
*/ | |
function main() { | |
// ↓のシートを参考に | |
// https://docs.google.com/spreadsheets/d/1LeFz9KS8l5Ozk6JvFr0_TEJbCQhe8jgx_RMpmyl89IA/edit#gid=0 | |
const data = GasBotKit.pickUpDataInOrder('シート1'); | |
const firstResult = client.postTweet(data[1]); // 左端が0番目とすると投稿文は1番目 | |
// 【補足】 | |
// console.log(firstResult); | |
// firstResultの中身は { data: { id: '1568003003549982725', text: 'テスト2' } } となっていて firstResult.data.id で投稿した TweetID が取れる | |
const secondResult = client.postTweet(data[6], firstResult.data.id); // 左端が0番目とすると2つ目の投稿文は6番目 | |
// const thirdResult = client.postTweet(data[○], secondResult.data.id); // 左端が0番目とすると×つ目の投稿文は○番目なので.... | |
} | |
/** | |
* 認証実行 | |
*/ | |
function authorize () { | |
client.authorize(); | |
} | |
/** | |
* 認証を削除したい時はこれを実行する | |
*/ | |
function reset () { | |
client.reset() | |
} | |
/** | |
* Twitterの developer portal に登録するURLを取得する | |
*/ | |
function getCallbackUrl () { | |
console.log(client.getCallbackUrl()); | |
} | |
/** | |
* authorizeでTwitterでの認証後に実行される処理 | |
* ※手動で実行はしません | |
*/ | |
function authCallback (request) { | |
return client.authCallback(request) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment