From 5cd9e171da931b086605f47d8c4ee00677a5032c Mon Sep 17 00:00:00 2001 From: na2na <49822810+na2na-p@users.noreply.github.com> Date: Sun, 1 May 2022 23:36:00 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=83=AA=E3=83=9E=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=89=E6=A9=9F=E8=83=BD=E3=81=AE=E6=94=B9=E5=96=84=20(#93)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [reminder]renote対象が消されていた場合にリマインダー解除を行う機能の追加 * [reminder]visibilityがfollowersのときにtodoを受け付けないようにした * #70(他人のリマインダーを操作できる)対応 * セリフのベタ書きではなく、serifsに追加するような形にした。 * Fix[Reminder]RN対象の削除がなされていた場合へ入る条件分岐の修正 --- src/message.ts | 4 ++++ src/modules/reminder/index.ts | 20 ++++++++++++++++---- src/serifs.ts | 2 ++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/message.ts b/src/message.ts index 05c7f86..1c81439 100644 --- a/src/message.ts +++ b/src/message.ts @@ -34,6 +34,10 @@ export default class Message { return this.messageOrNote.renoteId; } + public get visibility(): string { + return this.messageOrNote.visibility; + } + /** * メンション部分を除いたテキスト本文 */ diff --git a/src/modules/reminder/index.ts b/src/modules/reminder/index.ts index 434e943..efdf674 100644 --- a/src/modules/reminder/index.ts +++ b/src/modules/reminder/index.ts @@ -59,9 +59,12 @@ export default class extends Module { const separatorIndex = text.indexOf(' ') > -1 ? text.indexOf(' ') : text.indexOf('\n'); const thing = text.substr(separatorIndex + 1).trim(); - if (thing === '' && msg.quoteId == null) { + if (thing === '' && msg.quoteId == null || msg.visibility === 'followers') { msg.reply(serifs.reminder.invalid); - return true; + return { + reaction: '🆖', + immediate: true, + }; } const remind = this.reminds.insertOne({ @@ -112,12 +115,16 @@ export default class extends Module { const done = msg.includes(['done', 'やった', 'やりました', 'はい']); const cancel = msg.includes(['やめる', 'やめた', 'キャンセル']); + const isOneself = msg.userId === remind.userId; - if (done || cancel) { + if ((done || cancel) && isOneself) { this.unsubscribeReply(key); this.reminds.remove(remind); msg.reply(done ? getSerif(serifs.reminder.done(msg.friend.name)) : serifs.reminder.cancel); return; + } else if (isOneself === false) { + msg.reply(serifs.reminder.doneFromInvalidUser); + return; } else { if (msg.isDm) this.unsubscribeReply(key); return false; @@ -149,7 +156,12 @@ export default class extends Module { text: acct(friend.doc.user) + ' ' + serifs.reminder.notify(friend.name) }); } catch (err) { - // TODO: renote対象が消されていたらリマインダー解除 + // renote対象が消されていたらリマインダー解除 + if (err.statusCode === 400) { + this.unsubscribeReply(remind.thing == null && remind.quoteId ? remind.quoteId : remind.id); + this.reminds.remove(remind); + return; + } return; } } diff --git a/src/serifs.ts b/src/serifs.ts index 7d61ba3..15ae16e 100644 --- a/src/serifs.ts +++ b/src/serifs.ts @@ -339,6 +339,8 @@ export default { reminder: { invalid: 'うーん...?', + doneFromInvalidUser: 'イタズラはめっですよ!', + reminds: 'やること一覧です!', notify: (name) => name ? `${name}、これやりましたか?` : `これやりましたか?`, From 21e594409d13ed8b379da721a3a4b59004ba1b4f Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 9 Jun 2022 03:55:00 +0900 Subject: [PATCH 2/3] Update vocabulary.ts --- src/vocabulary.ts | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/src/vocabulary.ts b/src/vocabulary.ts index 1f936c3..8b54232 100644 --- a/src/vocabulary.ts +++ b/src/vocabulary.ts @@ -32,7 +32,7 @@ export const itemPrefixes = [ '折り畳み式', '携帯型', '遺伝子組み換え', - '突然変異して飛行能力を獲得した', + '飛行能力を獲得した', '純金製', '透明な', '光る', @@ -119,36 +119,26 @@ export const itemPrefixes = [ '巨大', 'ナノサイズ', 'やわらかい', - '人の手に負えない', 'バグった', - 'どこからともなく現れる', '人工', '天然', '祀られた', 'チョコレートコーティング', - '地域で親しまれている', '抗菌仕様', '耐火', - '血行を良くする作用がある', - 'なんらかのオーラを感じる', - '周囲の気温を上昇させる効果がある', '激', '猛', '超', '群生する', '軽量', '国宝級', - '称賛に値する', - '世界に通用する', - '一世を風靡した', '流行りの', '8カラットの', '中古の', '新品の', '愛妻', 'ブランドものの', - '忘らるる', - '指数関数的勢いで増殖する', + '増殖する', 'ぷるぷる', 'ぐにゃぐにゃ', '多目的', @@ -167,36 +157,20 @@ export const itemPrefixes = [ '品質保証付き', 'AppleCare+加入済み', 'えっちな', - '純粋な', - '構造上の欠陥がある', 'デザイナーズ', '蠱惑的な', - '概念としての', '霊験灼かな', - '御利益がありそうな', 'つやつや', 'べとべと', - 'ムキムキの', + 'ムキムキ', 'オーバークロックされた', - 'リミッター解除された', '無機質な', '前衛的な', - '会社から支給された', - '担保としての', - '経費で落ちる', - '真贋が定かでない', - '肥えた', '怪しい', '妖しい', - '攻撃的な', - '現存する最古の', - '考古学的価値がある', - '官能的な', - '備え付けの', 'カビの生えた', - '丹念に熟成された', + '熟成', 'アルミダイキャスト', - '畏怖の念を抱く', '養殖', 'やばい', 'すごい', @@ -204,8 +178,6 @@ export const itemPrefixes = [ 'デジタル', 'アナログ', '彁な', - 'キミの', - 'あなただけの', 'カラフルな', '電動', '当たり判定のない', @@ -221,7 +193,6 @@ export const itemPrefixes = [ '滅びの', '反発係数がe>1の', '摩擦係数0の', - '誉れ高き', '解き放たれし', '大きな', '小さな', From e2f257b4b1ad5b1d1145f4cd561261d133fdbff9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 18 Jun 2022 02:27:21 +0900 Subject: [PATCH 3/3] Update vocabulary.ts --- src/vocabulary.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vocabulary.ts b/src/vocabulary.ts index 8b54232..06f90d1 100644 --- a/src/vocabulary.ts +++ b/src/vocabulary.ts @@ -442,6 +442,7 @@ export const items = [ 'メビウスの輪', 'オリハルコン', 'ヘドロ', + 'グレーチング', ]; export const and = [