-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
333 additions
and
232 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const util = require('util') | ||
const promisify = util.promisify | ||
const fs = require('fs') | ||
const inquirer = require('inquirer') | ||
const writeFile = promisify(fs.writeFile) | ||
|
||
let domain | ||
|
||
let form = [ | ||
{ | ||
type: 'input', | ||
name: 'domain', | ||
message: 'Instance Domain :', | ||
default: 'misskey.xyz' | ||
} | ||
] | ||
console.log('インスタンスのドメインを入力します。') | ||
inquirer.prompt(form) | ||
.then(as => { | ||
domain = as.domain | ||
let form = [ | ||
{ | ||
type: 'input', | ||
name: 'app_secret', | ||
message: 'App Secret:' | ||
} | ||
] | ||
console.log(`\nhttps://dev.${domain}/apps にアクセスし、アプリを作成してください。\nそして、以下の情報を貼り付けてください。`) // MISSKEY_AOI | ||
return inquirer.prompt(form) | ||
}) | ||
.then(as => { | ||
let data = { | ||
instances: {}, | ||
accounts: [] | ||
} | ||
data.instances[domain] = as.app_secret | ||
return writeFile('misskey/taqz.json', JSON.stringify(data), 'utf8', () => { | ||
console.log('taqz.jsonが作成されました。このファイルは絶対に誰にも見せないでください。') | ||
console.log('node misskey/account を実行し、アカウントを追加してください。\n') | ||
}) | ||
}) | ||
.catch(err => { throw err }) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1 @@ | ||
const util = require('util') | ||
const promisify = util.promisify | ||
const fs = require('fs') | ||
const minimist = require('minimist') | ||
const request = require('request') | ||
|
||
const readFile = promisify(fs.readFile) | ||
|
||
const taqz = require('./taqz.json') | ||
|
||
if(!taqz) throw Error('初期化されていません。 node twitter/init を実行し、初期化してください。') | ||
else if(taqz.accounts.length == 0) throw Error('アカウントがありません。node twitter/account を実行し、アカウントを登録してください。') | ||
|
||
const argv = minimist(process.argv.slice(1)) | ||
|
||
require('../scripts/get_accounts')(argv, taqz, 'username') | ||
.then(async accounts => { | ||
const text = await require('../scripts/get_text')(argv, taqz) | ||
for(n = 0; n < accounts.length; n++){ | ||
const account = accounts[n] | ||
request.post('https://api.misskey.xyz/posts/create', {json: {i: account.i, text: text}}, (err) => { | ||
if(err) throw err | ||
else{ | ||
console.log(`\n✔ 投稿しました。 @${account.username}`) | ||
console.log(text) | ||
} | ||
}) | ||
} | ||
}) | ||
.catch(err => { throw err }) | ||
|
||
require('./post')(require('minimist')(process.argv.slice(1))) |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const request = require('request') | ||
|
||
let taqz | ||
try{ | ||
taqz = require('./taqz.json') | ||
} catch(e) { | ||
throw Error('初期化されていません。 node twitter/init を実行し、初期化してください。') | ||
} | ||
if(taqz.accounts.length == 0) throw Error('アカウントがありません。node twitter/account を実行し、アカウントを登録してください。') | ||
|
||
function post(argv){ | ||
require('../scripts/get_accounts')(argv, taqz, 'name_domain') | ||
.then(async accounts => { | ||
const text = await require('../scripts/get_text')(argv, taqz) | ||
const tags = await require('../scripts/get_tags')(argv, taqz) | ||
let arg = [] | ||
for(n = 0; n < accounts.length; n++){ | ||
const account = accounts[n] | ||
let json = {i: account.i, text: text} | ||
if(tags != null) json.tags = tags | ||
arg.push(new Promise(function(resolve, reject){ | ||
request.post('https://api.misskey.xyz/posts/create', {json: json}, (err) => { | ||
if(err) reject(err) | ||
else{ | ||
console.log(`\n✔ [Misskey] 投稿しました。 @${account.name_domain}`) | ||
console.log(text) | ||
resolve(text) | ||
} | ||
}) | ||
})) | ||
} | ||
return Promise.all(arg) | ||
}) | ||
.catch(err => { throw err }) | ||
} | ||
module.exports = post |
Oops, something went wrong.