Post --> Note

Closes #1411
This commit is contained in:
syuilo
2018-04-08 02:30:37 +09:00
parent c7106d250c
commit a1b490afa7
167 changed files with 4440 additions and 1762 deletions

View File

@@ -24,7 +24,7 @@ const id = conf.othello_ai.id;
*/
const i = conf.othello_ai.i;
let post;
let note;
process.on('message', async msg => {
// 親プロセスからデータをもらう
@@ -51,13 +51,13 @@ process.on('message', async msg => {
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんの接待を始めました!`
: `対局を?[${getUserName(user)}](${conf.url}/@${user.username})さんと始めました! (強さ${form[0].value})`;
const res = await request.post(`${conf.api_url}/posts/create`, {
const res = await request.post(`${conf.api_url}/notes/create`, {
json: { i,
text: `${text}\n→[観戦する](${url})`
}
});
post = res.createdPost;
note = res.createdNote;
//#endregion
}
@@ -83,9 +83,9 @@ process.on('message', async msg => {
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんに勝ちました♪`
: `?[${getUserName(user)}](${conf.url}/@${user.username})さんに負けました...`;
await request.post(`${conf.api_url}/posts/create`, {
await request.post(`${conf.api_url}/notes/create`, {
json: { i,
repostId: post.id,
renoteId: note.id,
text: text
}
});

View File

@@ -46,28 +46,28 @@ homeStream.on('message', message => {
// タイムライン上でなんか言われたまたは返信されたとき
if (msg.type == 'mention' || msg.type == 'reply') {
const post = msg.body;
const note = msg.body;
if (post.userId == id) return;
if (note.userId == id) return;
// リアクションする
request.post(`${conf.api_url}/posts/reactions/create`, {
request.post(`${conf.api_url}/notes/reactions/create`, {
json: { i,
postId: post.id,
noteId: note.id,
reaction: 'love'
}
});
if (post.text) {
if (post.text.indexOf('オセロ') > -1) {
request.post(`${conf.api_url}/posts/create`, {
if (note.text) {
if (note.text.indexOf('オセロ') > -1) {
request.post(`${conf.api_url}/notes/create`, {
json: { i,
replyId: post.id,
replyId: note.id,
text: '良いですよ~'
}
});
invite(post.userId);
invite(note.userId);
}
}
}