Skip to content

Instantly share code, notes, and snippets.

@errormaker74
Created November 30, 2020 02:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save errormaker74/6c539d43de82315663b3c103bc816d59 to your computer and use it in GitHub Desktop.
Save errormaker74/6c539d43de82315663b3c103bc816d59 to your computer and use it in GitHub Desktop.
Misskeyアカウントでログインボーナスを得るためのスクリプト
/**
* ログボ対策スクリプト
*
* ログインボーナスを得るためのnoteをMisskeyから投稿するスクリプト(GASで実行)。
*
* 下記の値はプロジェクトのプロパティに設定しておく。
* - MESSAGE:投稿メッセージ('ログボ'や'ログインボーナス'を含める)
* - VISIBILITY:投稿の公開範囲 "public","home","followers","specified"
* - MISSKEY_TOKEN:Misskey API トークン
* - MISSKEY_HOST:Misskeyインスタンスのホスト(例:misskey.io)
*
MIT License
Copyright (c) 2020 errormaker74
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* Misskeyのアカウントからnoteを投稿する
* @param string message 投稿内容
* @param string visibility 投稿スコープ
* @param string token Misskey API トークン
* @param string host Misskey インスタンスのホスト
*/
function postNote(message, visibility, token, host) {
var payload = {
'visibility': visibility,
'text': message,
'i': token
};
var params = {
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify(payload)
};
// note投稿のURL
var url = 'https://'.concat(host).concat('/api/notes/create');
UrlFetchApp.fetch(url, params);
}
/**
* トリガーで定期的に呼び出すエントリポイント
*/
function myFunction() {
// 投稿メッセージ('ログボ'や'ログインボーナス'を含める)
var message = PropertiesService.getScriptProperties().getProperty("MESSAGE");
// visibility 投稿の公開範囲:"public","home","followers","specified"
var visibility = PropertiesService.getScriptProperties().getProperty("VISIBILITY");
// Misskey API トークン
var token = PropertiesService.getScriptProperties().getProperty("MISSKEY_TOKEN");
// Misskeyインスタンスのホスト(例:misskey.io)
var host = PropertiesService.getScriptProperties().getProperty("MISSKEY_HOST");
postNote(message, visibility, token, host);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment