This commit is contained in:
syuilo 2018-08-05 21:19:06 +09:00
parent 9ef87837fc
commit f27dd1c673

View file

@ -142,7 +142,7 @@ class Session {
/** /**
* *
*/ */
private onEnded = (msg: any) => { private onEnded = async (msg: any) => {
// ストリームから切断 // ストリームから切断
process.send({ process.send({
type: 'close' type: 'close'
@ -178,7 +178,7 @@ class Session {
} }
} }
this.post(text, this.startedNote ? this.startedNote.id : null); await this.post(text, this.startedNote);
process.exit(); process.exit();
} }
@ -363,15 +363,25 @@ class Session {
*/ */
private post = async (text: string, renote?: any) => { private post = async (text: string, renote?: any) => {
if (this.allowPost) { if (this.allowPost) {
const res = await request.post(`${config.host}/api/notes/create`, { const body = {
json: { i: config.i,
i: config.i, text: text
text: text, } as any;
renoteId: renote ? renote.id : undefined
}
});
return res.createdNote; if (renote) {
body.renoteId = renote.id;
}
try {
const res = await request.post(`${config.host}/api/notes/create`, {
json: body
});
return res.createdNote;
} catch (e) {
console.error(e);
return null;
}
} else { } else {
return null; return null;
} }