mirror of
https://github.com/syuilo/ai.git
synced 2025-04-20 09:36:43 +00:00
Compare commits
No commits in common. "f43aac7291a087dbebf5b12a5e55a4569b4c5136" and "b49cd2d44ce37a32b379c0c0911d23e2227d1075" have entirely different histories.
f43aac7291
...
b49cd2d44c
9 changed files with 80 additions and 149 deletions
10
package.json
10
package.json
|
@ -11,7 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/chalk": "2.2.0",
|
"@types/chalk": "2.2.0",
|
||||||
"@types/lokijs": "1.5.14",
|
"@types/lokijs": "1.5.14",
|
||||||
"@types/node": "22.13.13",
|
"@types/node": "20.11.5",
|
||||||
"@types/promise-retry": "1.1.6",
|
"@types/promise-retry": "1.1.6",
|
||||||
"@types/random-seed": "0.3.5",
|
"@types/random-seed": "0.3.5",
|
||||||
"@types/seedrandom": "3.0.8",
|
"@types/seedrandom": "3.0.8",
|
||||||
|
@ -30,12 +30,12 @@
|
||||||
"random-seed": "0.3.0",
|
"random-seed": "0.3.0",
|
||||||
"reconnecting-websocket": "4.4.0",
|
"reconnecting-websocket": "4.4.0",
|
||||||
"seedrandom": "3.0.5",
|
"seedrandom": "3.0.5",
|
||||||
"ts-patch": "3.3.0",
|
"ts-patch": "3.1.2",
|
||||||
"twemoji-parser": "14.0.0",
|
"twemoji-parser": "14.0.0",
|
||||||
"typescript": "5.8.2",
|
"typescript": "5.3.3",
|
||||||
"typescript-transform-paths": "3.5.5",
|
"typescript-transform-paths": "3.4.6",
|
||||||
"uuid": "9.0.1",
|
"uuid": "9.0.1",
|
||||||
"ws": "8.18.1"
|
"ws": "8.16.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
},
|
},
|
||||||
|
|
94
src/ai.ts
94
src/ai.ts
|
@ -54,7 +54,6 @@ export default class 藍 {
|
||||||
private meta: loki.Collection<Meta>;
|
private meta: loki.Collection<Meta>;
|
||||||
|
|
||||||
private contexts: loki.Collection<{
|
private contexts: loki.Collection<{
|
||||||
isChat: boolean;
|
|
||||||
noteId?: string;
|
noteId?: string;
|
||||||
userId?: string;
|
userId?: string;
|
||||||
module: string;
|
module: string;
|
||||||
|
@ -147,7 +146,7 @@ export default class 藍 {
|
||||||
if (data.text && data.text.startsWith('@' + this.account.username)) {
|
if (data.text && data.text.startsWith('@' + this.account.username)) {
|
||||||
// Misskeyのバグで投稿が非公開扱いになる
|
// Misskeyのバグで投稿が非公開扱いになる
|
||||||
if (data.text == null) data = await this.api('notes/show', { noteId: data.id });
|
if (data.text == null) data = await this.api('notes/show', { noteId: data.id });
|
||||||
this.onReceiveMessage(new Message(this, data, false));
|
this.onReceiveMessage(new Message(this, data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,7 +156,7 @@ export default class 藍 {
|
||||||
if (data.text && data.text.startsWith('@' + this.account.username)) return;
|
if (data.text && data.text.startsWith('@' + this.account.username)) return;
|
||||||
// Misskeyのバグで投稿が非公開扱いになる
|
// Misskeyのバグで投稿が非公開扱いになる
|
||||||
if (data.text == null) data = await this.api('notes/show', { noteId: data.id });
|
if (data.text == null) data = await this.api('notes/show', { noteId: data.id });
|
||||||
this.onReceiveMessage(new Message(this, data, false));
|
this.onReceiveMessage(new Message(this, data));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Renoteされたとき
|
// Renoteされたとき
|
||||||
|
@ -172,48 +171,16 @@ export default class 藍 {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// メッセージ
|
||||||
|
mainStream.on('messagingMessage', data => {
|
||||||
|
if (data.userId == this.account.id) return; // 自分は弾く
|
||||||
|
this.onReceiveMessage(new Message(this, data));
|
||||||
|
});
|
||||||
|
|
||||||
// 通知
|
// 通知
|
||||||
mainStream.on('notification', data => {
|
mainStream.on('notification', data => {
|
||||||
this.onNotification(data);
|
this.onNotification(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
// チャット
|
|
||||||
mainStream.on('newChatMessage', data => {
|
|
||||||
const fromUser = data.fromUser;
|
|
||||||
if (data.fromUserId == this.account.id) return; // 自分は弾く
|
|
||||||
this.onReceiveMessage(new Message(this, data, true));
|
|
||||||
|
|
||||||
// 一定期間 chatUser / chatRoom のストリームに接続して今後のやり取りに備える
|
|
||||||
if (data.fromUserId) {
|
|
||||||
const chatStream = this.connection.connectToChannel('chatUser', {
|
|
||||||
otherId: data.fromUserId,
|
|
||||||
});
|
|
||||||
|
|
||||||
let timer;
|
|
||||||
function setTimer() {
|
|
||||||
if (timer) clearTimeout(timer);
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
chatStream.dispose();
|
|
||||||
}, 1000 * 60 * 2);
|
|
||||||
}
|
|
||||||
setTimer();
|
|
||||||
|
|
||||||
chatStream.on('message', (data) => {
|
|
||||||
if (data.fromUserId == this.account.id) return; // 自分は弾く
|
|
||||||
chatStream.send('read', {
|
|
||||||
id: data.id,
|
|
||||||
});
|
|
||||||
this.onReceiveMessage(new Message(this, {
|
|
||||||
...data,
|
|
||||||
// fromUserは省略されてくるため
|
|
||||||
fromUser: fromUser,
|
|
||||||
}, true));
|
|
||||||
setTimer();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// TODO: room
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// Install modules
|
// Install modules
|
||||||
|
@ -251,14 +218,10 @@ export default class 藍 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isNoContext = !msg.isChat && msg.replyId == null;
|
const isNoContext = msg.replyId == null;
|
||||||
|
|
||||||
// Look up the context
|
// Look up the context
|
||||||
const context = isNoContext ? null : this.contexts.findOne(msg.isChat ? {
|
const context = isNoContext ? null : this.contexts.findOne({
|
||||||
isChat: true,
|
|
||||||
userId: msg.userId
|
|
||||||
} : {
|
|
||||||
isChat: false,
|
|
||||||
noteId: msg.replyId
|
noteId: msg.replyId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -303,16 +266,12 @@ export default class 藍 {
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.isChat) {
|
// リアクションする
|
||||||
// TODO: リアクション?
|
if (reaction) {
|
||||||
} else {
|
this.api('notes/reactions/create', {
|
||||||
// リアクションする
|
noteId: msg.id,
|
||||||
if (reaction) {
|
reaction: reaction
|
||||||
this.api('notes/reactions/create', {
|
});
|
||||||
noteId: msg.id,
|
|
||||||
reaction: reaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,12 +366,13 @@ export default class 藍 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定ユーザーにチャットメッセージを送信します
|
* 指定ユーザーにトークメッセージを送信します
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public sendMessage(userId: any, param: any) {
|
public sendMessage(userId: any, param: any) {
|
||||||
return this.api('chat/messages/create-to-user', Object.assign({
|
return this.post(Object.assign({
|
||||||
toUserId: userId,
|
visibility: 'specified',
|
||||||
|
visibleUserIds: [userId],
|
||||||
}, param));
|
}, param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,20 +393,12 @@ export default class 藍 {
|
||||||
* コンテキストを生成し、ユーザーからの返信を待ち受けます
|
* コンテキストを生成し、ユーザーからの返信を待ち受けます
|
||||||
* @param module 待ち受けるモジュール名
|
* @param module 待ち受けるモジュール名
|
||||||
* @param key コンテキストを識別するためのキー
|
* @param key コンテキストを識別するためのキー
|
||||||
* @param isChat チャット上のコンテキストかどうか
|
* @param id トークメッセージ上のコンテキストならばトーク相手のID、そうでないなら待ち受ける投稿のID
|
||||||
* @param id チャット上のコンテキストならばチャット相手のID、そうでないなら待ち受ける投稿のID
|
|
||||||
* @param data コンテキストに保存するオプションのデータ
|
* @param data コンテキストに保存するオプションのデータ
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public subscribeReply(module: Module, key: string | null, isChat: boolean, id: string, data?: any) {
|
public subscribeReply(module: Module, key: string | null, id: string, data?: any) {
|
||||||
this.contexts.insertOne(isChat ? {
|
this.contexts.insertOne({
|
||||||
isChat: true,
|
|
||||||
userId: id,
|
|
||||||
module: module.name,
|
|
||||||
key: key,
|
|
||||||
data: data
|
|
||||||
} : {
|
|
||||||
isChat: false,
|
|
||||||
noteId: id,
|
noteId: id,
|
||||||
module: module.name,
|
module: module.name,
|
||||||
key: key,
|
key: key,
|
||||||
|
|
|
@ -11,36 +11,30 @@ import { sleep } from '@/utils/sleep.js';
|
||||||
|
|
||||||
export default class Message {
|
export default class Message {
|
||||||
private ai: 藍;
|
private ai: 藍;
|
||||||
private chatMessage: { id: string; fromUser: any; fromUserId: string; text: string; } | null;
|
private note: any;
|
||||||
private note: { id: string; user: any; userId: string; text: string; renoteId: string; replyId: string; } | null;
|
|
||||||
public isChat: boolean;
|
|
||||||
|
|
||||||
public get id(): string {
|
public get id(): string {
|
||||||
return this.chatMessage ? this.chatMessage.id : this.note.id;
|
return this.note.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get user(): User {
|
public get user(): User {
|
||||||
return this.chatMessage ? this.chatMessage.fromUser : this.note.user;
|
return this.note.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get userId(): string {
|
public get userId(): string {
|
||||||
return this.chatMessage ? this.chatMessage.fromUserId : this.note.userId;
|
return this.note.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get text(): string {
|
public get text(): string {
|
||||||
return this.chatMessage ? this.chatMessage.text : this.note.text;
|
return this.note.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get quoteId(): string | null {
|
public get quoteId(): string | null {
|
||||||
return this.chatMessage ? null : this.note.renoteId;
|
return this.note.renoteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get replyId(): string | null {
|
public get visibility(): string {
|
||||||
return this.chatMessage ? null : this.note.replyId;
|
return this.note.visibility;
|
||||||
}
|
|
||||||
|
|
||||||
public get visibility(): string | null {
|
|
||||||
return this.chatMessage ? null : this.note.visibility;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,13 +48,15 @@ export default class Message {
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get replyId(): string {
|
||||||
|
return this.note.replyId;
|
||||||
|
}
|
||||||
|
|
||||||
public friend: Friend;
|
public friend: Friend;
|
||||||
|
|
||||||
constructor(ai: 藍, chatMessageOrNote: any, isChat: boolean) {
|
constructor(ai: 藍, note: any) {
|
||||||
this.ai = ai;
|
this.ai = ai;
|
||||||
this.chatMessage = isChat ? chatMessageOrNote : null;
|
this.note = note;
|
||||||
this.note = isChat ? null : chatMessageOrNote;
|
|
||||||
this.isChat = isChat;
|
|
||||||
|
|
||||||
this.friend = new Friend(ai, { user: this.user });
|
this.friend = new Friend(ai, { user: this.user });
|
||||||
|
|
||||||
|
@ -87,19 +83,19 @@ export default class Message {
|
||||||
await sleep(2000);
|
await sleep(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.chatMessage) {
|
const postData = {
|
||||||
return await this.ai.sendMessage(this.chatMessage.fromUserId, {
|
replyId: this.note.id,
|
||||||
text: text,
|
text: text,
|
||||||
fileId: opts?.file?.id
|
fileIds: opts?.file ? [opts?.file.id] : undefined,
|
||||||
});
|
cw: opts?.cw,
|
||||||
|
renoteId: opts?.renote
|
||||||
|
};
|
||||||
|
|
||||||
|
// DM以外は普通に返信し、DMの場合はDMで返信する
|
||||||
|
if (this.note.visibility != 'specified') {
|
||||||
|
return await this.ai.post(postData);
|
||||||
} else {
|
} else {
|
||||||
return await this.ai.post({
|
return await this.ai.sendMessage(this.userId, postData);
|
||||||
replyId: this.note.id,
|
|
||||||
text: text,
|
|
||||||
fileIds: opts?.file ? [opts?.file.id] : undefined,
|
|
||||||
cw: opts?.cw,
|
|
||||||
renoteId: opts?.renote
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,12 @@ export default abstract class Module {
|
||||||
/**
|
/**
|
||||||
* コンテキストを生成し、ユーザーからの返信を待ち受けます
|
* コンテキストを生成し、ユーザーからの返信を待ち受けます
|
||||||
* @param key コンテキストを識別するためのキー
|
* @param key コンテキストを識別するためのキー
|
||||||
* @param isChat チャット上のコンテキストかどうか
|
* @param id トークメッセージ上のコンテキストならばトーク相手のID、そうでないなら待ち受ける投稿のID
|
||||||
* @param id チャット上のコンテキストならばチャット相手のID、そうでないなら待ち受ける投稿のID
|
|
||||||
* @param data コンテキストに保存するオプションのデータ
|
* @param data コンテキストに保存するオプションのデータ
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
protected subscribeReply(key: string | null, isChat: boolean, id: string, data?: any) {
|
protected subscribeReply(key: string | null, id: string, data?: any) {
|
||||||
this.ai.subscribeReply(this, key, isChat, id, data);
|
this.ai.subscribeReply(this, key, id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@ export default class extends Module {
|
||||||
msg.reply(serifs.core.setNameOk(name));
|
msg.reply(serifs.core.setNameOk(name));
|
||||||
} else {
|
} else {
|
||||||
msg.reply(serifs.core.san).then(reply => {
|
msg.reply(serifs.core.san).then(reply => {
|
||||||
this.subscribeReply(msg.userId, msg.isChat, msg.isChat ? msg.userId : reply.id, {
|
this.subscribeReply(msg.userId, reply.id, {
|
||||||
name: name
|
name: name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -143,7 +143,7 @@ export default class extends Module {
|
||||||
done();
|
done();
|
||||||
} else {
|
} else {
|
||||||
msg.reply(serifs.core.yesOrNo).then(reply => {
|
msg.reply(serifs.core.yesOrNo).then(reply => {
|
||||||
this.subscribeReply(msg.userId, msg.isChat, reply.id, data);
|
this.subscribeReply(msg.userId, reply.id, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default class extends Module {
|
||||||
});
|
});
|
||||||
|
|
||||||
msg.reply(serifs.guessingGame.started).then(reply => {
|
msg.reply(serifs.guessingGame.started).then(reply => {
|
||||||
this.subscribeReply(msg.userId, msg.isChat, msg.isChat ? msg.userId : reply.id);
|
this.subscribeReply(msg.userId, reply.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,7 +83,7 @@ export default class extends Module {
|
||||||
|
|
||||||
if (guess == null) {
|
if (guess == null) {
|
||||||
msg.reply(serifs.guessingGame.nan).then(reply => {
|
msg.reply(serifs.guessingGame.nan).then(reply => {
|
||||||
this.subscribeReply(msg.userId, msg.isChat, reply.id);
|
this.subscribeReply(msg.userId, reply.id);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ export default class extends Module {
|
||||||
|
|
||||||
msg.reply(text).then(reply => {
|
msg.reply(text).then(reply => {
|
||||||
if (!end) {
|
if (!end) {
|
||||||
this.subscribeReply(msg.userId, msg.isChat, reply.id);
|
this.subscribeReply(msg.userId, reply.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default class extends Module {
|
||||||
postId: post.id
|
postId: post.id
|
||||||
});
|
});
|
||||||
|
|
||||||
this.subscribeReply(null, false, post.id);
|
this.subscribeReply(null, post.id);
|
||||||
|
|
||||||
this.log('New kazutori game started');
|
this.log('New kazutori game started');
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ export default class extends Module {
|
||||||
private reminds: loki.Collection<{
|
private reminds: loki.Collection<{
|
||||||
userId: string;
|
userId: string;
|
||||||
id: string;
|
id: string;
|
||||||
isChat: boolean;
|
|
||||||
thing: string | null;
|
thing: string | null;
|
||||||
quoteId: string | null;
|
quoteId: string | null;
|
||||||
times: number; // 催促した回数(使うのか?)
|
times: number; // 催促した回数(使うのか?)
|
||||||
|
@ -70,7 +69,6 @@ export default class extends Module {
|
||||||
const remind = this.reminds.insertOne({
|
const remind = this.reminds.insertOne({
|
||||||
id: msg.id,
|
id: msg.id,
|
||||||
userId: msg.userId,
|
userId: msg.userId,
|
||||||
isChat: msg.isChat,
|
|
||||||
thing: thing === '' ? null : thing,
|
thing: thing === '' ? null : thing,
|
||||||
quoteId: msg.quoteId,
|
quoteId: msg.quoteId,
|
||||||
times: 0,
|
times: 0,
|
||||||
|
@ -78,13 +76,13 @@ export default class extends Module {
|
||||||
});
|
});
|
||||||
|
|
||||||
// メンションをsubscribe
|
// メンションをsubscribe
|
||||||
this.subscribeReply(remind!.id, msg.isChat, msg.isChat ? msg.userId : msg.id, {
|
this.subscribeReply(remind!.id, msg.id, {
|
||||||
id: remind!.id
|
id: remind!.id
|
||||||
});
|
});
|
||||||
|
|
||||||
if (msg.quoteId) {
|
if (msg.quoteId) {
|
||||||
// 引用元をsubscribe
|
// 引用元をsubscribe
|
||||||
this.subscribeReply(remind!.id, false, msg.quoteId, {
|
this.subscribeReply(remind!.id, msg.quoteId, {
|
||||||
id: remind!.id
|
id: remind!.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -126,7 +124,6 @@ export default class extends Module {
|
||||||
msg.reply(serifs.reminder.doneFromInvalidUser);
|
msg.reply(serifs.reminder.doneFromInvalidUser);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (msg.isChat) this.unsubscribeReply(key);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,28 +142,22 @@ export default class extends Module {
|
||||||
if (friend == null) return; // 処理の流れ上、実際にnullになることは無さそうだけど一応
|
if (friend == null) return; // 処理の流れ上、実際にnullになることは無さそうだけど一応
|
||||||
|
|
||||||
let reply;
|
let reply;
|
||||||
if (remind.isChat) {
|
try {
|
||||||
this.ai.sendMessage(friend.userId, {
|
reply = await this.ai.post({
|
||||||
text: serifs.reminder.notifyWithThing(remind.thing, friend.name)
|
renoteId: remind.thing == null && remind.quoteId ? remind.quoteId : remind.id,
|
||||||
|
text: acct(friend.doc.user) + ' ' + serifs.reminder.notify(friend.name)
|
||||||
});
|
});
|
||||||
} else {
|
} catch (err) {
|
||||||
try {
|
// renote対象が消されていたらリマインダー解除
|
||||||
reply = await this.ai.post({
|
if (err.statusCode === 400) {
|
||||||
renoteId: remind.thing == null && remind.quoteId ? remind.quoteId : remind.id,
|
this.unsubscribeReply(remind.thing == null && remind.quoteId ? remind.quoteId : remind.id);
|
||||||
text: acct(friend.doc.user) + ' ' + serifs.reminder.notify(friend.name)
|
this.reminds.remove(remind);
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
// renote対象が消されていたらリマインダー解除
|
|
||||||
if (err.statusCode === 400) {
|
|
||||||
this.unsubscribeReply(remind.thing == null && remind.quoteId ? remind.quoteId : remind.id);
|
|
||||||
this.reminds.remove(remind);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.subscribeReply(remind.id, remind.isChat, remind.isChat ? remind.userId : reply.id, {
|
this.subscribeReply(remind.id, reply.id, {
|
||||||
id: remind.id
|
id: remind.id
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ export default class extends Module {
|
||||||
|
|
||||||
// タイマーセット
|
// タイマーセット
|
||||||
this.setTimeoutWithPersistence(time, {
|
this.setTimeoutWithPersistence(time, {
|
||||||
isChat: msg.isChat,
|
|
||||||
msgId: msg.id,
|
msgId: msg.id,
|
||||||
userId: msg.friend.userId,
|
userId: msg.friend.userId,
|
||||||
time: str
|
time: str
|
||||||
|
@ -61,15 +60,9 @@ export default class extends Module {
|
||||||
const friend = this.ai.lookupFriend(data.userId);
|
const friend = this.ai.lookupFriend(data.userId);
|
||||||
if (friend == null) return; // 処理の流れ上、実際にnullになることは無さそうだけど一応
|
if (friend == null) return; // 処理の流れ上、実際にnullになることは無さそうだけど一応
|
||||||
const text = serifs.timer.notify(data.time, friend.name);
|
const text = serifs.timer.notify(data.time, friend.name);
|
||||||
if (data.isChat) {
|
this.ai.post({
|
||||||
this.ai.sendMessage(friend.userId, {
|
replyId: data.msgId,
|
||||||
text: text
|
text: text
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.ai.post({
|
|
||||||
replyId: data.msgId,
|
|
||||||
text: text
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue