From 9d903f09eac08a9f624d6a7b84922bd467606481 Mon Sep 17 00:00:00 2001 From: hanshino Date: Mon, 25 Sep 2023 14:36:27 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"feat:=20replyText=20=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20quoteReply"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e361c4b685aa4e2d87bfc5af2e4be82fbcfc58c7. --- app/src/app.js | 6 +-- .../application/AdvancementController.js | 24 +++++------ .../application/AdvertisementController.js | 4 +- .../controller/application/AliasController.js | 4 +- .../application/BullshitController.js | 6 +-- .../application/ChatLevelController.js | 14 +++---- .../application/CouponController.js | 22 +++++----- .../application/CreaturesController.js | 34 +++++++-------- .../controller/application/CustomerOrder.js | 8 ++-- .../application/DonateListController.js | 16 +++---- .../application/GambleController.js | 36 ++++++++-------- app/src/controller/application/GroupConfig.js | 6 +-- .../application/GuildServiceController.js | 10 ++--- .../controller/application/ImageController.js | 8 ++-- .../application/LotteryController.js | 30 ++++++------- .../application/MarketController.js | 26 ++++++------ .../application/OpenaiController.js | 4 +- .../application/ScratchCardController.js | 16 +++---- .../application/StatusController.js | 4 +- .../application/SubscribeController.js | 10 ++--- .../controller/application/VoteController.js | 14 +++---- .../application/WorldBossController.js | 42 +++++++++---------- app/src/controller/lineEvent.js | 10 ++--- .../controller/princess/ArenaController.js | 14 +++---- .../princess/BattleReportController.js | 12 +++--- .../princess/GodStoneShop/router.js | 2 +- app/src/controller/princess/battle.js | 30 ++++++------- app/src/controller/princess/character.js | 2 +- app/src/controller/princess/gacha.js | 6 +-- app/src/templates/application/ChatLevel.js | 4 +- .../application/CustomerOrder/line.js | 4 +- .../application/CustomerOrder/telegram.js | 6 +-- app/src/templates/application/Group/line.js | 2 +- app/src/templates/application/Order.js | 4 +- app/src/templates/princess/ArenaTeamplate.js | 4 +- .../templates/princess/character/console.js | 14 +++---- .../templates/princess/character/telegram.js | 14 +++---- app/src/templates/princess/guild/battle.js | 2 +- app/src/util/error.js | 2 +- 39 files changed, 236 insertions(+), 240 deletions(-) diff --git a/app/src/app.js b/app/src/app.js index bfb0b81d..cdb9027d 100644 --- a/app/src/app.js +++ b/app/src/app.js @@ -370,11 +370,7 @@ function Nothing(context) { async function App(context) { traffic.recordPeople(context); - context.quoteReply = function (...args) { - if (!context.event.isText) { - return context.reply(...args); - } - + context.replyText = function (...args) { const { quoteToken } = context.event.message; const [text] = args; let replyObject = {}; diff --git a/app/src/controller/application/AdvancementController.js b/app/src/controller/application/AdvancementController.js index 9842e90f..724ef8ae 100644 --- a/app/src/controller/application/AdvancementController.js +++ b/app/src/controller/application/AdvancementController.js @@ -29,7 +29,7 @@ async function list(context) { const data = await advModel.findUserAdvancementsByPlatformId(userId); if (data.length === 0) { - return context.quoteReply(i18n.__("message.advancement.no_data")); + return context.replyText(i18n.__("message.advancement.no_data")); } const rows = data.map(item => { @@ -62,7 +62,7 @@ async function adminList(context) { let page = 1; if (args.help || args.h) { - return context.quoteReply(i18n.__("message.advancement.list_usage")); + return context.replyText(i18n.__("message.advancement.list_usage")); } if (args.page) { @@ -109,7 +109,7 @@ async function adminList(context) { config ); - return context.quoteReply(messages); + return context.replyText(messages); } /** @@ -120,7 +120,7 @@ async function adminAdd(context) { const args = minimist(context.event.message.text.split(" ")); if (args.help || args.h) { - return context.quoteReply(i18n.__("message.advancement.add_usage")); + return context.replyText(i18n.__("message.advancement.add_usage")); } const ajv = new Ajv(); @@ -165,15 +165,15 @@ async function adminAdd(context) { const valid = validate(attributes); if (!valid) { DefaultLogger.warn("管理員新增成就錯誤", validate.errors); - return context.quoteReply(i18n.__("message.advancement.add_invalid_bad_request")); + return context.replyText(i18n.__("message.advancement.add_invalid_bad_request")); } const result = await advModel.create(attributes); if (result) { - return context.quoteReply(i18n.__("message.advancement.add_success", { name: attributes.name })); + return context.replyText(i18n.__("message.advancement.add_success", { name: attributes.name })); } else { - return context.quoteReply(i18n.__("message.advancement.add_fail")); + return context.replyText(i18n.__("message.advancement.add_fail")); } } @@ -183,16 +183,16 @@ async function adminAttach(context) { const mentionees = get(mention, "mentionees", []); if (args.help || args.h) { - return context.quoteReply(i18n.__("message.advancement.attach_usage")); + return context.replyText(i18n.__("message.advancement.attach_usage")); } const advId = get(args, "_.2", null); if (!isNumber(advId)) { - return context.quoteReply(i18n.__("message.advancement.attach_usage")); + return context.replyText(i18n.__("message.advancement.attach_usage")); } if (mentionees.length === 0) { - return context.quoteReply(i18n.__("message.advancement.attach_no_mention")); + return context.replyText(i18n.__("message.advancement.attach_no_mention")); } const userIds = mentionees.map(item => item.userId); @@ -200,13 +200,13 @@ async function adminAttach(context) { if (result) { const { name } = await advModel.find(advId); - return context.quoteReply( + return context.replyText( i18n.__("message.advancement.attach_success", { players: userIds.length, name, }) ); } else { - return context.quoteReply(i18n.__("message.advancement.attach_fail")); + return context.replyText(i18n.__("message.advancement.attach_fail")); } } diff --git a/app/src/controller/application/AdvertisementController.js b/app/src/controller/application/AdvertisementController.js index e7249839..494b7aff 100644 --- a/app/src/controller/application/AdvertisementController.js +++ b/app/src/controller/application/AdvertisementController.js @@ -24,7 +24,7 @@ async function addAdvertisement(context) { const strMessage = match ? match[0] : ""; if (!strMessage) { - await context.quoteReply(i18n.__("message.advertisement.add_usage")); + await context.replyText(i18n.__("message.advertisement.add_usage")); return; } @@ -40,7 +40,7 @@ async function addAdvertisement(context) { const ad = await adModel.findLatestByTitle(title); - await context.quoteReply( + await context.replyText( i18n.__("message.advertisement.add_success", { title: ad.title, id: ad.id, diff --git a/app/src/controller/application/AliasController.js b/app/src/controller/application/AliasController.js index 9a45669f..ae6779bc 100644 --- a/app/src/controller/application/AliasController.js +++ b/app/src/controller/application/AliasController.js @@ -20,7 +20,7 @@ async function alias(context) { const restStr = message.replace(get(args, "_.0"), "").trim(); if (get(args, "_").length === 1) { - await context.quoteReply(i18n.__("message.alias.add_usage")); + await context.replyText(i18n.__("message.alias.add_usage")); return; } @@ -28,7 +28,7 @@ async function alias(context) { await setAlias(newAlias, command); - return context.quoteReply(`${newAlias} 已經設定成 ${command}`); + return context.replyText(`${newAlias} 已經設定成 ${command}`); } async function setAlias(newAlias, command) { diff --git a/app/src/controller/application/BullshitController.js b/app/src/controller/application/BullshitController.js index 66b9f0b5..107fc180 100644 --- a/app/src/controller/application/BullshitController.js +++ b/app/src/controller/application/BullshitController.js @@ -13,7 +13,7 @@ exports.router = [ ]; async function bullshitManual(context) { - await context.quoteReply(i18n.__("message.bullshit.manual")); + await context.replyText(i18n.__("message.bullshit.manual")); } /** @@ -44,7 +44,7 @@ async function bullshitGenerator(context, props) { const data = get(result, "data"); if (!data) { - await context.quoteReply( + await context.replyText( i18n.__("message.bullshit.failed", { userId: get(context, "event.source.userId"), }) @@ -59,5 +59,5 @@ async function bullshitGenerator(context, props) { .trim() .replace(/
/g, "\n"); - await context.quoteReply(bullshit); + await context.replyText(bullshit); } diff --git a/app/src/controller/application/ChatLevelController.js b/app/src/controller/application/ChatLevelController.js index adc2b56b..b3f74274 100644 --- a/app/src/controller/application/ChatLevelController.js +++ b/app/src/controller/application/ChatLevelController.js @@ -40,7 +40,7 @@ exports.showStatus = async (context, props) => { pictureUrl = pictureUrl || "https://i.imgur.com/NMl4z2u.png"; if (!userId || !displayName) { - context.quoteReply("獲取失敗,無法辨識用戶"); + context.replyText("獲取失敗,無法辨識用戶"); throw "userId or displayName is empty"; } @@ -209,7 +209,7 @@ exports.showStatus = async (context, props) => { const isSelf = context.event.source.userId === userId; if (!level && isSelf) { - context.quoteReply("尚未有任何數據,經驗開始累積後即可投胎!"); + context.replyText("尚未有任何數據,經驗開始累積後即可投胎!"); } } catch (e) { DefaultLogger.error(e); @@ -313,7 +313,7 @@ async function getQuestInfo(userId) { exports.showFriendStatus = async context => { const { mention, text } = context.event.message; if (!mention) { - return context.quoteReply("請tag想要查詢的夥伴們!"); + return context.replyText("請tag想要查詢的夥伴們!"); } let users = mention.mentionees.map(d => ({ ...d, @@ -330,10 +330,10 @@ exports.showFriendStatus = async context => { ); if (messages.length === 0) { - context.quoteReply("查詢失敗!"); + context.replyText("查詢失敗!"); } else { messages = [">>>查詢結果<<<", ...messages]; - context.quoteReply(messages.join("\n")); + context.replyText(messages.join("\n")); } }; @@ -348,7 +348,7 @@ exports.setEXP = (context, { match }) => { console.log(userId, exp, "修改經驗"); ChatLevelModel.setExperience(userId, exp).then(result => { let msg = result ? "修改成功" : "修改失敗"; - context.quoteReply(msg, { sender: { name: "管理員指令" } }); + context.replyText(msg, { sender: { name: "管理員指令" } }); }); }; @@ -363,7 +363,7 @@ exports.setEXPRate = (context, { match }) => { console.log(expRate, "修改經驗倍率"); ChatLevelModel.setExperienceRate(expRate).then(result => { let msg = result ? "修改成功" : "修改失敗"; - context.quoteReply(msg, { sender: { name: "管理員指令" } }); + context.replyText(msg, { sender: { name: "管理員指令" } }); }); }; diff --git a/app/src/controller/application/CouponController.js b/app/src/controller/application/CouponController.js index f2f1e71d..0d38807e 100644 --- a/app/src/controller/application/CouponController.js +++ b/app/src/controller/application/CouponController.js @@ -21,7 +21,7 @@ async function adminAdd(context) { const args = minimist(context.event.text.split(" ")); if (args.h || args.help) { - return context.quoteReply(i18n.__("message.coupon.admin_add_usage")); + return context.replyText(i18n.__("message.coupon.admin_add_usage")); } const [code, startAt, endAt, reward] = [ @@ -39,7 +39,7 @@ async function adminAdd(context) { DefaultLogger.warn( `[CouponController.addCoupon] Validation failed: ${JSON.stringify(validate.errors)}` ); - return context.quoteReply(i18n.__("message.coupon.admin_add_invalid_param")); + return context.replyText(i18n.__("message.coupon.admin_add_invalid_param")); } try { @@ -53,10 +53,10 @@ async function adminAdd(context) { end_at: moment(endAt).toDate(), }); - return context.quoteReply(i18n.__("message.coupon.admin_add_success", { id, code })); + return context.replyText(i18n.__("message.coupon.admin_add_success", { id, code })); } catch (e) { DefaultLogger.error(e); - return context.quoteReply(i18n.__("message.coupon.admin_add_failed")); + return context.replyText(i18n.__("message.coupon.admin_add_failed")); } } @@ -69,24 +69,24 @@ async function userUse(context, props) { const { userId } = context.event.source; if (!userId) { - return context.quoteReply(i18n.__("message.user_unreconized")); + return context.replyText(i18n.__("message.user_unreconized")); } const coupon = await couponCode.findByCode(code); if (!coupon) { - return context.quoteReply(i18n.__("message.coupon.not_found", { code })); + return context.replyText(i18n.__("message.coupon.not_found", { code })); } const [startAt, endAt] = [moment(coupon.start_at), moment(coupon.end_at)]; const now = moment(); if (now.isBefore(startAt)) { - return context.quoteReply(i18n.__("message.coupon.not_yet_available", { code })); + return context.replyText(i18n.__("message.coupon.not_yet_available", { code })); } if (now.isAfter(endAt)) { - return context.quoteReply(i18n.__("message.coupon.expired", { code })); + return context.replyText(i18n.__("message.coupon.expired", { code })); } const records = await couponUsedHistory.all({ @@ -103,7 +103,7 @@ async function userUse(context, props) { }); if (records.length > 0) { - return context.quoteReply(i18n.__("message.coupon.already_used", { code })); + return context.replyText(i18n.__("message.coupon.already_used", { code })); } try { @@ -114,7 +114,7 @@ async function userUse(context, props) { coupon_code_id: coupon.id, }); - return context.quoteReply( + return context.replyText( i18n.__("message.coupon.success", { code, reward: getRewardMessage(coupon.reward), @@ -122,7 +122,7 @@ async function userUse(context, props) { ); } catch (e) { DefaultLogger.error(e); - return context.quoteReply( + return context.replyText( i18n.__("message.coupon.failed", { userId, code, diff --git a/app/src/controller/application/CreaturesController.js b/app/src/controller/application/CreaturesController.js index b0ae96d0..2d4cd912 100644 --- a/app/src/controller/application/CreaturesController.js +++ b/app/src/controller/application/CreaturesController.js @@ -45,7 +45,7 @@ async function main(context) { const userHasCreatures = await creatureModel.findUserCreature(userNo); if (!userHasCreatures) { - context.quoteReply(i18n.__("message.creatures.not_found_to_create")); + context.replyText(i18n.__("message.creatures.not_found_to_create")); return await preCreate(context, { isNeedCheck: false }); } @@ -75,7 +75,7 @@ async function preCreate(context, { isNeedCheck = true }) { const userHasCreatures = await creatureModel.findUserCreature(userNo); if (userHasCreatures) { - await context.quoteReply(i18n.__("message.creatures.already_exists")); + await context.replyText(i18n.__("message.creatures.already_exists")); return; } } @@ -87,7 +87,7 @@ async function preCreate(context, { isNeedCheck = true }) { }); if (creatures.length === 0) { - await context.quoteReply( + await context.replyText( i18n.__("message.creatures.admin_error", { userId: context.event.source.userId, }) @@ -109,7 +109,7 @@ exports.initCreate = async (context, { payload }) => { const userHasCreatures = await creatureModel.findUserCreature(userNo); if (userHasCreatures) { - await context.quoteReply(i18n.__("message.creatures.already_exists")); + await context.replyText(i18n.__("message.creatures.already_exists")); return; } @@ -117,7 +117,7 @@ exports.initCreate = async (context, { payload }) => { const creature = await creatureModel.findById(creature_id); if (!creature) { - await context.quoteReply( + await context.replyText( i18n.__("message.creatures.admin_error", { userId: context.event.source.userId, }) @@ -125,7 +125,7 @@ exports.initCreate = async (context, { payload }) => { return; } - context.quoteReply(i18n.__("message.creatures.ask_for_nickname", { name: creature.name })); + context.replyText(i18n.__("message.creatures.ask_for_nickname", { name: creature.name })); context.setState({ creature: { isCreating: true, @@ -143,7 +143,7 @@ async function confirmCreate(context) { const { text: nickname } = context.event.message; if (hasSpace(nickname)) { - await context.quoteReply(i18n.__("message.creatures.nickname_has_space")); + await context.replyText(i18n.__("message.creatures.nickname_has_space")); return; } @@ -151,21 +151,21 @@ async function confirmCreate(context) { const userHasCreatures = await creatureModel.findUserCreature(userNo); if (userHasCreatures) { - await context.quoteReply(i18n.__("message.creatures.already_exists")); + await context.replyText(i18n.__("message.creatures.already_exists")); clearState(context); return; } const creatureId = get(context.state, "creature.creatureId"); if (!creatureId) { - await context.quoteReply(i18n.__("message.creatures.admin_error")); + await context.replyText(i18n.__("message.creatures.admin_error")); clearState(context); return; } const creature = await creatureModel.findById(creatureId); if (!creature) { - await context.quoteReply( + await context.replyText( i18n.__("message.creatures.admin_error", { userId: context.event.source.userId, }) @@ -187,7 +187,7 @@ async function confirmCreate(context) { items: [quickReplies.yes, quickReplies.no], }; - await context.quoteReply( + await context.replyText( i18n.__("message.creatures.ask_for_nickname_confirm", { name: creature.name, nickname, @@ -211,13 +211,13 @@ async function create(context) { if (denyText.includes(text)) { clearState(context); - context.quoteReply(i18n.__("message.creatures.create_user_cancel")); + context.replyText(i18n.__("message.creatures.create_user_cancel")); return; } const creature = await creatureModel.findById(creatureId); if (!allowText.includes(text)) { - context.quoteReply( + context.replyText( i18n.__("message.creatures.ask_for_nickname_confirm", { name: get(creature, "name", ""), nickname, @@ -233,12 +233,12 @@ async function create(context) { }); if (!id) { - context.quoteReply(i18n.__("message.creatures.admin_error")); + context.replyText(i18n.__("message.creatures.admin_error")); clearState(context); return; } - await context.quoteReply( + await context.replyText( i18n.__("message.creatures.create_success", { name: get(creature, "name", ""), nickname, @@ -272,7 +272,7 @@ exports.useFood = async (context, { payload }) => { const creature = await creatureModel.findUserCreature(userNo); if (!creature) { - await context.quoteReply(i18n.__("message.creatures.not_found")); + await context.replyText(i18n.__("message.creatures.not_found")); return; } @@ -297,7 +297,7 @@ exports.useFood = async (context, { payload }) => { trx.commit(); } catch (e) { console.error(e); - await context.quoteReply(i18n.__("message.creatures.admin_error")); + await context.replyText(i18n.__("message.creatures.admin_error")); trx.rollback(); return; } diff --git a/app/src/controller/application/CustomerOrder.js b/app/src/controller/application/CustomerOrder.js index 24c9542c..91578603 100644 --- a/app/src/controller/application/CustomerOrder.js +++ b/app/src/controller/application/CustomerOrder.js @@ -119,10 +119,10 @@ exports.insertCustomerOrder = async (context, props, touchType = 1) => { CustomerOrderModel.insertOrder(params); - context.quoteReply(`${order} 新增成功`); + context.replyText(`${order} 新增成功`); } catch (e) { if (e.name === "CusOrderException") { - context.quoteReply(e.message); + context.replyText(e.message); } else { // keep throw throw e; @@ -262,7 +262,7 @@ exports.deleteCustomerOrder = async (context, { match }) => { 0 ); - context.quoteReply(`"${order}"刪除成功!`); + context.replyText(`"${order}"刪除成功!`); return; } @@ -270,7 +270,7 @@ exports.deleteCustomerOrder = async (context, { match }) => { CustomerOrderTemplate[context.platform].showDeleteOption(context, deleteOrders); } catch (e) { if (e.name === "CusOrderException") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; } }; diff --git a/app/src/controller/application/DonateListController.js b/app/src/controller/application/DonateListController.js index 072f13a5..c19a6b58 100644 --- a/app/src/controller/application/DonateListController.js +++ b/app/src/controller/application/DonateListController.js @@ -19,7 +19,7 @@ async function adminList(context) { let page = 1; if (args.help || args.h) { - return context.quoteReply(i18n.__("message.advancement.list_usage")); + return context.replyText(i18n.__("message.advancement.list_usage")); } if (args.page) { @@ -38,7 +38,7 @@ async function adminList(context) { const data = await DonateModel.all(options); if (data.length === 0) { - return context.quoteReply(i18n.__("message.donate.no_data")); + return context.replyText(i18n.__("message.donate.no_data")); } const rows = data.map(item => [item.user_id, item.amount]); @@ -54,7 +54,7 @@ async function adminList(context) { const message = table(rows, config); - return context.quoteReply(message); + return context.replyText(message); } async function adminAdd(context) { @@ -63,26 +63,26 @@ async function adminAdd(context) { const mentionees = get(mention, "mentionees", []); if (args.help || args.h) { - return context.quoteReply(i18n.__("message.donate.add_usage")); + return context.replyText(i18n.__("message.donate.add_usage")); } if (mentionees.length === 0) { - return context.quoteReply(i18n.__("message.donate.add_no_mention")); + return context.replyText(i18n.__("message.donate.add_no_mention")); } const userId = get(mentionees, "0.userId", null); const amount = get(args, "_.2", null); if (!userId || !amount) { - return context.quoteReply(i18n.__("message.donate.add_usage")); + return context.replyText(i18n.__("message.donate.add_usage")); } try { await DonateModel.create({ user_id: userId, amount }); } catch (e) { DefaultLogger.error(e); - return context.quoteReply(i18n.__("message.donate.add_fail")); + return context.replyText(i18n.__("message.donate.add_fail")); } - return context.quoteReply(i18n.__("message.donate.add_success", { amount })); + return context.replyText(i18n.__("message.donate.add_success", { amount })); } diff --git a/app/src/controller/application/GambleController.js b/app/src/controller/application/GambleController.js index 3de86181..09abf7a2 100644 --- a/app/src/controller/application/GambleController.js +++ b/app/src/controller/application/GambleController.js @@ -34,7 +34,7 @@ exports.adminRouter = [ */ async function adminNow(context) { const game = await getHoldingGame(); - context.quoteReply(i18n.__("message.gamble.admin_now", game)); + context.replyText(i18n.__("message.gamble.admin_now", game)); } /** @@ -47,7 +47,7 @@ async function adminAdd(context) { const messageLines = []; if (args.help || args.h) { - await context.quoteReply(i18n.__("message.gamble.add_help")); + await context.replyText(i18n.__("message.gamble.add_help")); return; } @@ -91,13 +91,13 @@ async function adminAdd(context) { const valid = validate(data); if (!valid) { - await context.quoteReply(i18n.__("message.gamble.add_help")); + await context.replyText(i18n.__("message.gamble.add_help")); DefaultLogger.error(validate.errors); return; } if (!data.prize && !args.random && !args.r) { - return await context.quoteReply(i18n.__("message.gamble.add_prize_required")); + return await context.replyText(i18n.__("message.gamble.add_prize_required")); } messageLines.push(i18n.__("message.gamble.add_name_analyze_success", { name: data.name })); @@ -135,7 +135,7 @@ async function adminAdd(context) { end_at: data.end, }); - await context.quoteReply(messageLines.join("\n")); + await context.replyText(messageLines.join("\n")); } /** @@ -147,7 +147,7 @@ async function result(context) { const args = minimist(context.event.message.text.split(" ")); if (args.help || args.h) { - await context.quoteReply(i18n.__("message.gamble.result_usage")); + await context.replyText(i18n.__("message.gamble.result_usage")); return; } @@ -184,7 +184,7 @@ async function result(context) { const valid = validate(data); if (!valid) { - await context.quoteReply(i18n.__("message.gamble.result_usage")); + await context.replyText(i18n.__("message.gamble.result_usage")); DefaultLogger.error(validate.errors); return; } @@ -192,7 +192,7 @@ async function result(context) { const game = await GambleGameModel.find(data.id); if (!game) { - await context.quoteReply(i18n.__("message.gamble.no_game")); + await context.replyText(i18n.__("message.gamble.no_game")); return; } @@ -225,10 +225,10 @@ async function result(context) { }); purgeGame(); } else { - context.quoteReply(i18n.__("message.gamble.simulate_result")); + context.replyText(i18n.__("message.gamble.simulate_result")); } - context.quoteReply( + context.replyText( i18n.__("message.gamble.result", { time: moment().format("YYYY-MM-DD HH:mm:ss"), start: get(data, "start"), @@ -237,7 +237,7 @@ async function result(context) { }) ); - context.quoteReply(JSON.stringify(indexResult)); + context.replyText(JSON.stringify(indexResult)); } /** @@ -248,7 +248,7 @@ async function show(context) { const game = await getHoldingGame(); if (!game) { - await context.quoteReply(i18n.__("message.gamble.no_game")); + await context.replyText(i18n.__("message.gamble.no_game")); return; } @@ -289,7 +289,7 @@ async function bet(context, props) { const { userId } = context.event.source; if (!game) { - await context.quoteReply(i18n.__("message.gamble.no_game")); + await context.replyText(i18n.__("message.gamble.no_game")); return; } @@ -298,7 +298,7 @@ async function bet(context, props) { const availableOptions = get(game, "options", []); if (parseInt(option) > availableOptions.length || parseInt(option) === 0) { - await context.quoteReply(i18n.__("message.gamble.invalid_option")); + await context.replyText(i18n.__("message.gamble.invalid_option")); return; } @@ -307,12 +307,12 @@ async function bet(context, props) { const ownStones = parseInt(get(sumResult, "amount", 0)); if (usedCoins <= 0) { - await context.quoteReply(i18n.__("message.gamble.invalid_coins")); + await context.replyText(i18n.__("message.gamble.invalid_coins")); return; } if (isNull(ownStones) || usedCoins > ownStones) { - await context.quoteReply(i18n.__("message.gamble.not_enough_coins")); + await context.replyText(i18n.__("message.gamble.not_enough_coins")); return; } @@ -335,13 +335,13 @@ async function bet(context, props) { } catch (e) { trx.rollback(); DefaultLogger.error(e); - await context.quoteReply(i18n.__("message.gamble.bet_failed")); + await context.replyText(i18n.__("message.gamble.bet_failed")); return; } trx.commit(); - await context.quoteReply( + await context.replyText( i18n.__("message.gamble.bet_success", { displayName: context.event.source.displayName, amount: usedCoins, diff --git a/app/src/controller/application/GroupConfig.js b/app/src/controller/application/GroupConfig.js index ba8a8bba..48790c94 100644 --- a/app/src/controller/application/GroupConfig.js +++ b/app/src/controller/application/GroupConfig.js @@ -49,7 +49,7 @@ exports.setSender = async ( if (iconUrl !== undefined) sender.iconUrl = iconUrl; if (context.event.source.type !== "group") { - context.quoteReply("設定成功!\n注意:非群組用戶,自訂頭像非永久性!", { sender }); + context.replyText("設定成功!\n注意:非群組用戶,自訂頭像非永久性!", { sender }); return; } @@ -61,10 +61,10 @@ exports.setSender = async ( await GroupConfigModel.setSender(context.event.source.groupId, { name, icon: iconUrl }); } - context.quoteReply("設定成功!", { sender }); + context.replyText("設定成功!", { sender }); } catch (e) { if (e.name !== "GroupConfig") throw e; - context.quoteReply(e.message); + context.replyText(e.message); } }; diff --git a/app/src/controller/application/GuildServiceController.js b/app/src/controller/application/GuildServiceController.js index 87ee99cc..6b06bd78 100644 --- a/app/src/controller/application/GuildServiceController.js +++ b/app/src/controller/application/GuildServiceController.js @@ -16,7 +16,7 @@ async function guildService(context) { const { groupId } = context.event.source; const guildService = await GuildServiceModel.findByGroupId(groupId); - context.quoteReply(JSON.stringify(guildService)); + context.replyText(JSON.stringify(guildService)); } /** @@ -34,23 +34,23 @@ async function addService(context) { const serviceName = _[1]; if (!serviceName) { - context.quoteReply(i18n.__("message.service.add_usage")); + context.replyText(i18n.__("message.service.add_usage")); return; } if (!groupId) { - context.quoteReply(i18n.__("message.service.add_usage")); + context.replyText(i18n.__("message.service.add_usage")); return; } const guildServices = await GuildServiceModel.findByGroupId(groupId); if (guildServices.includes(serviceName)) { - context.quoteReply(i18n.__("message.service.already_exists", { serviceName, groupId })); + context.replyText(i18n.__("message.service.already_exists", { serviceName, groupId })); return; } const guild = await GuildModel.findByGroupId(groupId); await GuildServiceModel.create({ guild_id: guild.ID, service: serviceName }); - context.quoteReply(i18n.__("message.service.add_success", { serviceName, groupId })); + context.replyText(i18n.__("message.service.add_success", { serviceName, groupId })); } diff --git a/app/src/controller/application/ImageController.js b/app/src/controller/application/ImageController.js index 9a1a4e6d..d6d3dcc2 100644 --- a/app/src/controller/application/ImageController.js +++ b/app/src/controller/application/ImageController.js @@ -16,7 +16,7 @@ async function handleUpload(context) { const { quotedMessageId: id } = context.event.message; if (!id) { - return context.quoteReply(i18n.__("message.image.upload_without_quote")); + return context.replyText(i18n.__("message.image.upload_without_quote")); } try { @@ -30,13 +30,13 @@ async function handleUpload(context) { const url = get(result, "data.link"); if (!isImageUrl(url)) { - return context.quoteReply(i18n.__("message.image.upload_failed")); + return context.replyText(i18n.__("message.image.upload_failed")); } const imageUpload = get(context.state, "imageUpload", []); imageUpload.splice(imageUpload.indexOf(context.event.source.userId), 1); - return context.quoteReply( + return context.replyText( i18n.__("message.image.upload_success", { id: get(result, "data.id"), url, @@ -44,6 +44,6 @@ async function handleUpload(context) { ); } catch (e) { console.log(e); - return context.quoteReply(i18n.__("message.image.upload_failed")); + return context.replyText(i18n.__("message.image.upload_failed")); } } diff --git a/app/src/controller/application/LotteryController.js b/app/src/controller/application/LotteryController.js index 681ff8ab..f17df9a0 100644 --- a/app/src/controller/application/LotteryController.js +++ b/app/src/controller/application/LotteryController.js @@ -28,7 +28,7 @@ async function boughtList(context) { const lottery = await findLatestLottery(); if (!lottery) { - await context.quoteReply(i18n.__("message.lottery.no_holding_event")); + await context.replyText(i18n.__("message.lottery.no_holding_event")); return; } @@ -43,7 +43,7 @@ async function boughtList(context) { }); if (orders.length === 0) { - await context.quoteReply( + await context.replyText( i18n.__("message.lottery.no_bought_lottery", { displayName, }) @@ -78,7 +78,7 @@ async function boughtList(context) { lotteryId, }); console.log("超過15張"); - return await context.quoteReply( + return await context.replyText( i18n.__("message.lottery.bought_probably_over_limit", { boughtCount }) ); } @@ -99,7 +99,7 @@ async function lottery(context) { console.log("isPublic", isPublic); if (!lottery) { - await context.quoteReply(i18n.__("message.lottery.no_holding_event")); + await context.replyText(i18n.__("message.lottery.no_holding_event")); return; } @@ -148,13 +148,13 @@ async function autoBuy(context, props) { const costMoney = count * config.get("lottery.price"); if (amount < costMoney) { - await context.quoteReply(i18n.__("message.lottery.manual_buy.error_not_enough_money")); + await context.replyText(i18n.__("message.lottery.manual_buy.error_not_enough_money")); return; } const latestLottery = await findLatestLottery(); if (!latestLottery || latestLottery.status !== lotteryModel.status.selling) { - await context.quoteReply(i18n.__("message.lottery.manual_buy.error_no_lottery")); + await context.replyText(i18n.__("message.lottery.manual_buy.error_no_lottery")); return; } @@ -194,11 +194,11 @@ async function autoBuy(context, props) { message += i18n.__("message.lottery.auto_buy_notify"); } - await context.quoteReply(message); + await context.replyText(message); } catch (e) { await trx.rollback(); console.error(e); - await context.quoteReply( + await context.replyText( i18n.__("message.lottery.manual_buy.error", { userId, }) @@ -256,7 +256,7 @@ async function buy(context, props) { // 個數檢查 if (isValidLength(numbers) === false) { - await context.quoteReply( + await context.replyText( i18n.__("message.lottery.manual_buy.error_count", { max_count: limitCount, }) @@ -266,13 +266,13 @@ async function buy(context, props) { // 重複檢查 if (isRepeat(numbers) === true) { - await context.quoteReply(i18n.__("message.lottery.manual_buy.error_repeat_number")); + await context.replyText(i18n.__("message.lottery.manual_buy.error_repeat_number")); return; } // 數字檢查 if (isAllValidNumber(numbers) === false) { - await context.quoteReply(i18n.__("message.lottery.manual_buy.error_number_range")); + await context.replyText(i18n.__("message.lottery.manual_buy.error_number_range")); return; } @@ -281,13 +281,13 @@ async function buy(context, props) { const ownMoney = parseInt(amount); if (ownMoney < price) { - await context.quoteReply(i18n.__("message.lottery.manual_buy.error_not_enough_money")); + await context.replyText(i18n.__("message.lottery.manual_buy.error_not_enough_money")); return; } const latestLottery = await findLatestLottery(); if (!latestLottery || latestLottery.status !== lotteryModel.status.selling) { - await context.quoteReply(i18n.__("message.lottery.manual_buy.error_no_lottery")); + await context.replyText(i18n.__("message.lottery.manual_buy.error_no_lottery")); return; } @@ -311,7 +311,7 @@ async function buy(context, props) { await trx.commit(); - await context.quoteReply( + await context.replyText( i18n.__("message.lottery.manual_buy.success", { displayName, numbers: numbers.join(","), @@ -320,7 +320,7 @@ async function buy(context, props) { } catch (e) { await trx.rollback(); console.error(e); - await context.quoteReply( + await context.replyText( i18n.__("message.lottery.manual_buy.error", { userId, }) diff --git a/app/src/controller/application/MarketController.js b/app/src/controller/application/MarketController.js index 71ddb656..c3386f20 100644 --- a/app/src/controller/application/MarketController.js +++ b/app/src/controller/application/MarketController.js @@ -36,7 +36,7 @@ async function trade(context) { const mentionees = get(mention, "mentionees", []); if (mentionees.length === 0) { - return context.quoteReply(i18n.__("message.trade.no_mention")); + return context.replyText(i18n.__("message.trade.no_mention")); } const targetUserId = get(mentionees, "[0].userId"); @@ -45,7 +45,7 @@ async function trade(context) { const { displayName } = await getProfile(context, targetUserId); - context.quoteReply(i18n.__("message.trade.apply", { displayName })); + context.replyText(i18n.__("message.trade.apply", { displayName })); await context.replyFlex("交易申請", bubble); } @@ -71,16 +71,16 @@ async function transferMoney(context) { const param = removeOrder(trimText); if (mentionees.length !== 1) { - return context.quoteReply(i18n.__("message.trade.mention_invalid")); + return context.replyText(i18n.__("message.trade.mention_invalid")); } const targetId = get(mentionees, "0.userId"); if (param.length === 0 || !isMoneyParam(param)) { - return context.quoteReply(i18n.__("message.trade.transfer_money_invalid")); + return context.replyText(i18n.__("message.trade.transfer_money_invalid")); } if (!isLineUserId(targetId)) { - return context.quoteReply(i18n.__("message.trade.mention_invalid")); + return context.replyText(i18n.__("message.trade.mention_invalid")); } const { amount } = await inventoryModel.getUserMoney(userId); @@ -88,7 +88,7 @@ async function transferMoney(context) { const transferMoney = parseInt(param); if (transferMoney > ownMoney) { - return context.quoteReply(i18n.__("message.trade.transfer_money_not_enough")); + return context.replyText(i18n.__("message.trade.transfer_money_not_enough")); } const targetUserName = getMentionName(rawText, get(mentionees, "0")); @@ -109,7 +109,7 @@ async function transferMoney(context) { transferId, targetName: targetUserName, }); - context.quoteReply( + context.replyText( i18n.__("message.trade.transfer_money_established", { time: config.get("trade.transfer_countdown") + "秒", displayName, @@ -138,7 +138,7 @@ function doFastTransfer(context) { const trimText = trimMentionees(rawText, mentionees); if (mentionees.length !== 1) { - return context.quoteReply(i18n.__("message.trade.mention_invalid")); + return context.replyText(i18n.__("message.trade.mention_invalid")); } const targetId = get(mentionees, "0.userId"); @@ -146,11 +146,11 @@ function doFastTransfer(context) { const param = removeOrder(trimText); if (param.length === 0 || !isMoneyParam(param)) { - return context.quoteReply(i18n.__("message.trade.transfer_money_invalid")); + return context.replyText(i18n.__("message.trade.transfer_money_invalid")); } if (!isLineUserId(targetId)) { - return context.quoteReply(i18n.__("message.trade.mention_invalid")); + return context.replyText(i18n.__("message.trade.mention_invalid")); } const transferMoney = parseInt(param); @@ -197,7 +197,7 @@ const doTransfer = async (context, { payload }) => { if (amount > parseInt(ownMoney)) { // 餘額不足,刪除此次轉帳交易 removeTransfer(transferId); - return context.quoteReply(i18n.__("message.trade.transfer_money_not_enough")); + return context.replyText(i18n.__("message.trade.transfer_money_not_enough")); } const result = await inventoryModel.transferGodStone({ @@ -207,11 +207,11 @@ const doTransfer = async (context, { payload }) => { }); if (!result) { - return context.quoteReply(i18n.__("message.trade.transfer_money_failed")); + return context.replyText(i18n.__("message.trade.transfer_money_failed")); } removeTransfer(transferId); - context.quoteReply( + context.replyText( i18n.__("message.trade.transfer_money_success", { displayName, targetDisplayName: targetName, diff --git a/app/src/controller/application/OpenaiController.js b/app/src/controller/application/OpenaiController.js index 4a4c7117..00951ac0 100644 --- a/app/src/controller/application/OpenaiController.js +++ b/app/src/controller/application/OpenaiController.js @@ -50,7 +50,7 @@ exports.naturalLanguageUnderstanding = async function (context, { next }) { // 檢查是否可以使用 AI 功能, 這是避免被濫用 const isAbleToUse = await isAbleToUseAIFeature(); if (!isAbleToUse) { - await context.quoteReply("窩太累了,等等再問我吧( ˘•ω•˘ )◞"); + await context.replyText("窩太累了,等等再問我吧( ˘•ω•˘ )◞"); return; } @@ -68,7 +68,7 @@ exports.naturalLanguageUnderstanding = async function (context, { next }) { const { finish_reason } = get(result, "0", {}); result = finish_reason === "stop" ? result[0].text.trim() : "窩不知道( ˘•ω•˘ )◞"; await recordSession(sourceId, `小助理:${result}`); - await context.quoteReply(result); + await context.replyText(result); }; /** diff --git a/app/src/controller/application/ScratchCardController.js b/app/src/controller/application/ScratchCardController.js index a95c0522..7c2b1549 100644 --- a/app/src/controller/application/ScratchCardController.js +++ b/app/src/controller/application/ScratchCardController.js @@ -47,7 +47,7 @@ async function showUnused(context) { const cards = await ScratchCard.fetchMyUnusedCards(userId); if (cards.length === 0) { - return await context.quoteReply("窩沒有刮刮卡了", { sender }); + return await context.replyText("窩沒有刮刮卡了", { sender }); } const group = groupBy(cards, ({ reward, name }) => `${reward},${name}`); @@ -75,21 +75,21 @@ async function buy(context, props) { const { name, count = 1 } = props.match.groups; const card = await ScratchCard.fetchByName(name); if (!card) { - return await context.quoteReply("沒有這張刮刮卡"); + return await context.replyText("沒有這張刮刮卡"); } const { amount: ownCostGodStone } = await Inventory.getUserMoney(userId); const exceptCostGodStone = card.price * count; if (exceptCostGodStone > ownCostGodStone) { - return await context.quoteReply("窩的錢錢不夠QQ", { sender }); + return await context.replyText("窩的錢錢不夠QQ", { sender }); } const unusedCard = await ScratchCard.fetchRandomCards(card.id, count); const cardIds = unusedCard.map(c => c.id); if (cardIds.length === 0) { - return await context.quoteReply("購買失敗,刮刮卡庫存不足"); + return await context.replyText("購買失敗,刮刮卡庫存不足"); } const trx = await ScratchCard.transaction(); @@ -124,10 +124,10 @@ async function buy(context, props) { } catch (error) { await trx.rollback(); console.log(error); - return await context.quoteReply("購買失敗", { sender }); + return await context.replyText("購買失敗", { sender }); } - await context.quoteReply("購買成功", { sender }); + await context.replyText("購買成功", { sender }); } exports.exchange = exchange; @@ -147,7 +147,7 @@ async function exchange(context, { payload }) { const cards = await ScratchCard.fetchMyUnusedCards(userId); if (cards.length === 0) { - return await context.quoteReply("窩沒有刮刮卡了", { sender }); + return await context.replyText("窩沒有刮刮卡了", { sender }); } // 計算總共可以兌換多少女神石 @@ -175,7 +175,7 @@ async function exchange(context, { payload }) { throw e; } - await context.quoteReply(`YA~我獲得了 ${totalGodStone} 個女神石`, { sender }); + await context.replyText(`YA~我獲得了 ${totalGodStone} 個女神石`, { sender }); } exports.api.list = async (req, res) => { diff --git a/app/src/controller/application/StatusController.js b/app/src/controller/application/StatusController.js index 049a867b..062727d4 100644 --- a/app/src/controller/application/StatusController.js +++ b/app/src/controller/application/StatusController.js @@ -15,7 +15,7 @@ async function godStone(context) { const { userId } = context.event.source; const { amount = 0 } = await inventoryModel.getUserMoney(userId); - context.quoteReply(i18n.__("message.user_own_god_stone", { god_stone: amount })); + context.replyText(i18n.__("message.user_own_god_stone", { god_stone: amount })); } /** @@ -26,7 +26,7 @@ async function ownCharacter(context) { const { userId } = context.event.source; const result = await inventoryModel.getAllUserOwn(userId); - context.quoteReply( + context.replyText( i18n.__("message.user_own_character_count", { character_count: result.length }) ); } diff --git a/app/src/controller/application/SubscribeController.js b/app/src/controller/application/SubscribeController.js index 0abe8dc4..1933c81e 100644 --- a/app/src/controller/application/SubscribeController.js +++ b/app/src/controller/application/SubscribeController.js @@ -13,7 +13,7 @@ const { generateCard, generateEffect } = require("../../templates/application/Su exports.router = [ text(/^[.#/](訂閱|sub)$/, showInformation), text(/^[.#/](訂閱兌換|sub-coupon)$/, context => - context.quoteReply(i18n.__("message.subscribe.coupon_exchange_manual")) + context.replyText(i18n.__("message.subscribe.coupon_exchange_manual")) ), text(/^[.#/](訂閱兌換|sub-coupon)\s(?[\w-]{36})$/, subscribeCouponExchange), ]; @@ -67,7 +67,7 @@ async function subscribeCouponExchange(context, props) { } if (get(coupon, "status") === SubscribeCardCoupon.status.used) { - await context.quoteReply(i18n.__("message.subscribe.serial_number_used")); + await context.replyText(i18n.__("message.subscribe.serial_number_used")); return; } @@ -78,7 +78,7 @@ async function subscribeCouponExchange(context, props) { }); if (!card) { - await context.quoteReply( + await context.replyText( i18n.__("message.error_contact_admin", { user_id: userId, error_key: "subscribe_card_not_found", @@ -133,7 +133,7 @@ async function subscribeCouponExchange(context, props) { trx.commit(); } catch (e) { trx.rollback(); - await context.quoteReply( + await context.replyText( i18n.__("message.error_contact_admin", { user_id: userId, error_key: "subscribe_coupon_exchange", @@ -171,7 +171,7 @@ async function subscribeCouponExchange(context, props) { ) ); - await context.quoteReply(messages.join("\n")); + await context.replyText(messages.join("\n")); !isContinue && (await DailyRation()); } diff --git a/app/src/controller/application/VoteController.js b/app/src/controller/application/VoteController.js index 1d7e1ed7..7c626cb3 100644 --- a/app/src/controller/application/VoteController.js +++ b/app/src/controller/application/VoteController.js @@ -25,17 +25,17 @@ async function commandShowVote(context) { const args = minimist(context.event.message.text.split(" ")); if (args.h || args.help) { - return context.quoteReply(i18n.__("message.vote.help")); + return context.replyText(i18n.__("message.vote.help")); } const ids = get(args, "ids", "").split(","); if (ids.length === 0) { - return context.quoteReply(i18n.__("message.vote.help")); + return context.replyText(i18n.__("message.vote.help")); } const votes = await VoteModel.getAllById(ids); if (votes.length === 0) { - return context.quoteReply(i18n.__("message.vote.notFound")); + return context.replyText(i18n.__("message.vote.notFound")); } const voteList = votes.map(vote => VoteTemplate.generateVote(vote)); @@ -57,13 +57,13 @@ async function show(context, props) { const vote = await VoteModel.find(voteId); if (!vote) { - return context.quoteReply(i18n.__("message.vote.notFound")); + return context.replyText(i18n.__("message.vote.notFound")); } // 檢查是否在舉辦時間內 const isHolding = await getIsHolding(voteId); if (!isHolding) { - return context.quoteReply(i18n.__("message.vote.notHolding")); + return context.replyText(i18n.__("message.vote.notHolding")); } context.replyFlex(vote.title, VoteTemplate.generateVote(vote)); @@ -92,7 +92,7 @@ exports.decide = async (context, { payload }) => { }, }); - return context.quoteReply(i18n.__("message.vote.notHolding")); + return context.replyText(i18n.__("message.vote.notHolding")); } try { @@ -116,7 +116,7 @@ exports.decide = async (context, { payload }) => { }); if (context.event.source.type === "user") { - context.quoteReply( + context.replyText( i18n.__("message.vote.decided", { title: vote.title, displayName, diff --git a/app/src/controller/application/WorldBossController.js b/app/src/controller/application/WorldBossController.js index 2ce6f897..6d68e342 100644 --- a/app/src/controller/application/WorldBossController.js +++ b/app/src/controller/application/WorldBossController.js @@ -53,12 +53,12 @@ async function attack(context, { attackType = "normal" }) { }); if (!isSet) { - context.quoteReply(i18n.__("message.world_boss.request_too_quickly")); + context.replyText(i18n.__("message.world_boss.request_too_quickly")); return; } if (!eventId) { - context.quoteReply(i18n.__("message.world_boss_event_no_ongoing")); + context.replyText(i18n.__("message.world_boss_event_no_ongoing")); } return await attackOnBoss(context, { @@ -149,10 +149,10 @@ async function worldRank(context) { // 多起世界事件正在舉行中 if (events.length > 1) { - context.quoteReply(i18n.__("message.world_boss_event_multiple_ongoing")); + context.replyText(i18n.__("message.world_boss_event_multiple_ongoing")); return; } else if (events.length === 0) { - context.quoteReply(i18n.__("message.world_boss_event_no_ongoing")); + context.replyText(i18n.__("message.world_boss_event_no_ongoing")); return; } @@ -167,7 +167,7 @@ async function worldRank(context) { }) ); - context.quoteReply(JSON.stringify(topTenData)); + context.replyText(JSON.stringify(topTenData)); } /** @@ -189,10 +189,10 @@ async function adminAttack(context, props) { // 多起世界事件正在舉行中 if (events.length > 1) { - context.quoteReply(i18n.__("message.world_boss_event_multiple_ongoing")); + context.replyText(i18n.__("message.world_boss_event_multiple_ongoing")); return; } else if (events.length === 0) { - context.quoteReply(i18n.__("message.world_boss_event_no_ongoing")); + context.replyText(i18n.__("message.world_boss_event_no_ongoing")); return; } @@ -205,7 +205,7 @@ async function adminAttack(context, props) { // 如果已經完成,則不能攻擊 if (hasCompleted) { - context.quoteReply(i18n.__("message.world_boss_event_completed")); + context.replyText(i18n.__("message.world_boss_event_completed")); return; } @@ -218,7 +218,7 @@ async function adminAttack(context, props) { }; await worldBossEventLogService.create(attributes); - context.quoteReply(i18n.__("message.admin_attack_on_world_boss", { damage })); + context.replyText(i18n.__("message.admin_attack_on_world_boss", { damage })); } /** @@ -231,7 +231,7 @@ async function all(context) { ["end_time", ">", new Date()], ], }); - context.quoteReply(JSON.stringify(data)); + context.replyText(JSON.stringify(data)); } /** @@ -239,7 +239,7 @@ async function all(context) { */ async function bosslist(context) { const data = await worldBossModel.all(); - context.quoteReply(JSON.stringify(data)); + context.replyText(JSON.stringify(data)); } /** @@ -251,10 +251,10 @@ async function bossEvent(context) { // 多起世界事件正在舉行中 if (events.length > 1) { - context.quoteReply(i18n.__("message.world_boss_event_multiple_ongoing")); + context.replyText(i18n.__("message.world_boss_event_multiple_ongoing")); return; } else if (events.length === 0) { - context.quoteReply(i18n.__("message.world_boss_event_no_ongoing")); + context.replyText(i18n.__("message.world_boss_event_no_ongoing")); return; } @@ -360,7 +360,7 @@ exports.adminSpecialAttack = async (context, { payload }) => { }; await worldBossEventLogService.create(attributes); - context.quoteReply(`造成了 ${causeDamage} 傷害`, { + context.replyText(`造成了 ${causeDamage} 傷害`, { sender: { name: "エリス", iconUrl: @@ -396,7 +396,7 @@ const attackOnBoss = async (context, props) => { ); if (context.event.isText) { - context.quoteReply( + context.replyText( i18n.__("message.world_boss.can_not_attack", { name: displayName, }) @@ -440,7 +440,7 @@ const attackOnBoss = async (context, props) => { DefaultLogger.info(`no level data ${userId}. Create One.`); await minigameService.createByUserId(userId, minigameService.defaultData); levelData = minigameService.defaultData; - !keepMessage && context.quoteReply(i18n.__("message.minigame_level_not_found")); + !keepMessage && context.replyText(i18n.__("message.minigame_level_not_found")); } if (["money", "moneyChaos"].includes(attackType)) { @@ -458,7 +458,7 @@ const attackOnBoss = async (context, props) => { if (hasFreeQuota === false && userOwnMoney < needMoney) { if (context.event.isText) { const message = sample(i18n.__("message.world_boss.money_attack_not_enough")); - context.quoteReply(message, { + context.replyText(message, { sender: { iconUrl: pictureUrl, name: displayName, @@ -470,7 +470,7 @@ const attackOnBoss = async (context, props) => { if (hasFreeQuota) { DefaultLogger.info(`today attack ${todayLogs.length} times, skip money cost`); - context.quoteReply(i18n.__("message.world_boss.money_attack_free")); + context.replyText(i18n.__("message.world_boss.money_attack_free")); } else { await Inventory.decreaseGodStone({ userId, @@ -512,7 +512,7 @@ const attackOnBoss = async (context, props) => { }); if (newLevelData.levelUp && !keepMessage) { - context.quoteReply( + context.replyText( i18n.__("message.minigame_level_up", { level: newLevelData.newLevel, displayName }) ); } @@ -547,7 +547,7 @@ const attackOnBoss = async (context, props) => { if (keepMessage) { await handleKeepingMessage(worldBossEventId, context, messages.join("\n")); } else { - context.quoteReply(messages.join("\n"), { sender }); + context.replyText(messages.join("\n"), { sender }); } }; @@ -597,7 +597,7 @@ async function handleKeepingMessage(worldBossEventId, context, keepMessage) { if (messages.length > 0) { const message = messages.join("\n"); - context.quoteReply(`這是目前累積至今的訊息,下一次會在 5 分鐘後發送:\n${message}`); + context.replyText(`這是目前累積至今的訊息,下一次會在 5 分鐘後發送:\n${message}`); context.setState({ worldBoss: { lastSendTs: new Date().getTime(), diff --git a/app/src/controller/lineEvent.js b/app/src/controller/lineEvent.js index 9d6b6b34..b0b76ee0 100644 --- a/app/src/controller/lineEvent.js +++ b/app/src/controller/lineEvent.js @@ -30,7 +30,7 @@ async function HandleMemberJoined(context) { const { displayName } = await LineClient.getGroupMemberProfile(groupId, userId); const { groupName } = await lineAPI.getGroupSummary(groupId); - context.quoteReply( + context.replyText( assemble( { username: displayName, @@ -46,7 +46,7 @@ function HandleMemberLeft() { } function HandleFollow(context) { - context.quoteReply(`感謝加我好友,先為您提供以下功能`); + context.replyText(`感謝加我好友,先為您提供以下功能`); welcome(context); } @@ -56,18 +56,18 @@ async function HandleJoin(context) { return; } - context.quoteReply("感謝邀請我至群組,群組初始化開始..."); + context.replyText("感謝邀請我至群組,群組初始化開始..."); const [summary, countData] = await Promise.all([ lineAPI.getGroupSummary(context.event.source.groupId), lineAPI.getGroupCount(context.event.source.groupId), ]); - context.quoteReply( + context.replyText( `已設置好群組資訊:\n群組名稱:${summary.groupName}\n群組人數:${countData.count}` ); - context.quoteReply("如需觀看使用說明,請輸入:#使用說明"); + context.replyText("如需觀看使用說明,請輸入:#使用說明"); } function HandleUnfollow(context) { diff --git a/app/src/controller/princess/ArenaController.js b/app/src/controller/princess/ArenaController.js index 10db06d6..de64d20e 100644 --- a/app/src/controller/princess/ArenaController.js +++ b/app/src/controller/princess/ArenaController.js @@ -57,14 +57,14 @@ function personalRouter() { function setPersonalAllowUpload(context) { context.setState({ arena: { arenaUpload: true } }); - context.quoteReply("請上傳競技場戰鬥紀錄,全部上傳完畢後請輸入\n#競技場上傳完畢", { + context.replyText("請上傳競技場戰鬥紀錄,全部上傳完畢後請輸入\n#競技場上傳完畢", { quickReply: quickReplyUpload, }); } function setArenaSearch(context) { context.setState({ arena: { arenaSearch: true } }); - context.quoteReply("請上傳要查詢的隊伍", { + context.replyText("請上傳要查詢的隊伍", { quickReply: quickReplyUpload, }); } @@ -73,7 +73,7 @@ function resetArenaState(context) { let arenaState = context.state.arena || {}; if (Object.keys(arenaState).length !== 0) { context.setState({ arena: {} }); - context.quoteReply("感謝使用競技場功能~~"); + context.replyText("感謝使用競技場功能~~"); } } @@ -116,7 +116,7 @@ function receivePersonalImage(context) { arena: { ...arenaState, storeId }, }); - context.quoteReply( + context.replyText( "請問此圖左邊隊伍為\n1:進攻方 or 2:防守方\n輸入數字回答,手機用戶可直接點選快速回覆鈕", { quickReply: quickReplyAskWhich } ); @@ -137,7 +137,7 @@ async function personalUpload(context) { context.setState({ arena: { ...arenaState }, }); - return context.quoteReply("超過60秒沒回應,請重新進行操作"); + return context.replyText("超過60秒沒回應,請重新進行操作"); } let imageBase = await getImageBase(imageId); @@ -151,7 +151,7 @@ async function personalUpload(context) { ArenaTemplate.showUploadInfo(context, resp); ArenaTemplate.askContinue(context); } else { - context.quoteReply("你已經上傳過此紀錄"); + context.replyText("你已經上傳過此紀錄"); } } @@ -160,7 +160,7 @@ async function arenaSearch(context) { let resp = await OpencvModel.getArenaSearchTeam(imageBase); if (resp === false) { - return context.quoteReply("分析失敗,已將圖片轉發給作者"); + return context.replyText("分析失敗,已將圖片轉發給作者"); } let searchTeam = RecordRepo.genTeamImages(resp.map(data => ({ unitId: data.unit_id, ...data }))); diff --git a/app/src/controller/princess/BattleReportController.js b/app/src/controller/princess/BattleReportController.js index 3117968c..ad929a1e 100644 --- a/app/src/controller/princess/BattleReportController.js +++ b/app/src/controller/princess/BattleReportController.js @@ -52,20 +52,20 @@ exports.reportDamage = async (context, params) => { } } - if (!formId) return context.quoteReply("取報名表異常,請通知作者"); + if (!formId) return context.replyText("取報名表異常,請通知作者"); let ianUserData = await BattleModel.getIanUserData("2", userId); let { ianUserId } = ianUserData[0]; let records = await BattleModel.Ian.getUserFormRecords(formId, ianUserId); if (records.length === 0) { - context.quoteReply("尚未在戰隊群組內部報名過!因此找無任何紀錄!"); + context.replyText("尚未在戰隊群組內部報名過!因此找無任何紀錄!"); return; } context.setState({ ianUserId }); - context.quoteReply("請選擇要回報的紀錄"); + context.replyText("請選擇要回報的紀錄"); BattleTemplate.showReportList( context, records.map(record => ({ @@ -79,7 +79,7 @@ exports.reportDamage = async (context, params) => { exports.setAllowReport = (context, params) => { let { recordId, week, boss } = params.match.groups; context.setState({ report: { recordId, week, boss } }); - context.quoteReply(`請上傳 ${week}周 ${boss}王\n戰隊傷害報告圖片`); + context.replyText(`請上傳 ${week}周 ${boss}王\n戰隊傷害報告圖片`); }; exports.personalReport = async context => { @@ -94,7 +94,7 @@ exports.personalReport = async context => { message: `圖片分析系統分析失敗,訊息ID:${imageId}`, token: process.env.LINE_NOTIFY_TOKEN, }); - return context.quoteReply( + return context.replyText( "圖片分析失敗,請確認!\n歡迎至Discord回報 https://discord.gg/Fy82rTb" ); } @@ -126,7 +126,7 @@ exports.personalReport = async context => { await BattleModel.Ian.setRecord(formId, week, boss, ianUserId, option); let flexMessage = BattleTemplate.genReportInformation({ totalDamage, team }); - context.quoteReply(`已將 ${week}周 ${boss}王\n傷害紀錄上傳`); + context.replyText(`已將 ${week}周 ${boss}王\n傷害紀錄上傳`); context.replyFlex("隊伍詳細資訊", flexMessage); // 清除state 避免重複收到圖片 diff --git a/app/src/controller/princess/GodStoneShop/router.js b/app/src/controller/princess/GodStoneShop/router.js index d420e91a..0f5eee8d 100644 --- a/app/src/controller/princess/GodStoneShop/router.js +++ b/app/src/controller/princess/GodStoneShop/router.js @@ -27,7 +27,7 @@ async function showStoneShop(context) { .filter(item => item); if (viewData.length === 0) { - return context.quoteReply(i18n.__("message.god_stone_shop_empty")); + return context.replyText(i18n.__("message.god_stone_shop_empty")); } const bubbles = viewData.map(item => GodStoneShopTemplate.genShopItem(item)); diff --git a/app/src/controller/princess/battle.js b/app/src/controller/princess/battle.js index b1cc64a0..f370c32d 100644 --- a/app/src/controller/princess/battle.js +++ b/app/src/controller/princess/battle.js @@ -60,7 +60,7 @@ exports.BattleList = async (context, props) => { } } catch (e) { if (e.name === "GuildBattle") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; // keep throw } }; @@ -204,7 +204,7 @@ exports.BattleSignUp = async (context, props) => { stage: getStageByWeek(parseInt(week)), }); } catch (e) { - return context.quoteReply("報名失敗,請稍後再試"); + return context.replyText("報名失敗,請稍後再試"); } }; @@ -279,11 +279,11 @@ exports.BattleCancel = async (context, props) => { name: context.state.userDatas[context.event.source.userId].displayName, iconUrl: context.state.userDatas[context.event.source.userId].pictureUrl, }; - context.quoteReply(`我取消了${week}周${boss}王`, { sender }); + context.replyText(`我取消了${week}周${boss}王`, { sender }); } else throw setResult.detail; } catch (e) { if (e.name === "GuildBattle") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; // keep throw } }; @@ -331,7 +331,7 @@ exports.CurrentBattle = async context => { this.BattleList(context, { match: { groups: { week: currWeek } } }); } catch (e) { if (e.name === "GuildBattle") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; // keep throw } }; @@ -350,7 +350,7 @@ exports.SetWeek = async (context, props) => { await WeekModel.setWeek(groupId, getNowMonth(), parseInt(week)); - context.quoteReply(`已將周次設定為${week}`, { + context.replyText(`已將周次設定為${week}`, { sender: { name: "戰隊秘書", iconUrl: "https://i.imgur.com/NuZZR7Q.jpg", @@ -358,7 +358,7 @@ exports.SetWeek = async (context, props) => { }); } catch (e) { if (e.name === "GuildBattle") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; // keep throw } }; @@ -379,7 +379,7 @@ exports.NextBattleList = context => { ); } catch (e) { if (e.name === "GuildBattle") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; // keep throw } }; @@ -403,7 +403,7 @@ exports.PreBattleList = context => { ); } catch (e) { if (e.name === "GuildBattle") { - context.quoteReply(e.message); + context.replyText(e.message); } else throw e; // keep throw } }; @@ -486,7 +486,7 @@ exports.reportFinish = context => { let userName = context.state.userDatas[userId].displayName || "路人甲"; BattleModel.setFinishBattle(groupId, userId).then(() => - context.quoteReply(`恭喜${userName}今日已成為成功人士(出完三刀)!`, { sender: BattleSender }) + context.replyText(`恭喜${userName}今日已成為成功人士(出完三刀)!`, { sender: BattleSender }) ); }; @@ -498,7 +498,7 @@ exports.reportReset = async context => { const { groupId, userId } = context.event.source; await BattleModel.resetFinishBattle(groupId, userId); - context.quoteReply("吶吶,那你剛剛回報是不是騙我,嘖!\n幫你清除了啦!", { sender: BattleSender }); + context.replyText("吶吶,那你剛剛回報是不是騙我,嘖!\n幫你清除了啦!", { sender: BattleSender }); }; /** @@ -516,24 +516,24 @@ exports.showSigninList = async (context, { match }) => { let FinishDatas = await BattleModel.getFinishList(groupId, objDate); if (FinishDatas.length > 50) { - context.quoteReply("此指令不適用於非戰隊群組(人數超過50人)", { sender: BattleSender }); + context.replyText("此指令不適用於非戰隊群組(人數超過50人)", { sender: BattleSender }); return; } if (FinishDatas.find(data => data.isSignin) === undefined) { - context.quoteReply(`${date}號查無任何出刀紀錄!`, { sender: BattleSender }); + context.replyText(`${date}號查無任何出刀紀錄!`, { sender: BattleSender }); return; } if (FinishDatas.filter(data => data.isSignin).length === FinishDatas.length) { - context.quoteReply(`${date}號全群皆已完成出刀!`, { sender: BattleSender }); + context.replyText(`${date}號全群皆已完成出刀!`, { sender: BattleSender }); return; } let sentKey = `FinishList_${groupId}`; if ((await redis.get(sentKey)) !== null) { - context.quoteReply("此指令限制30秒呼叫一次", { sender: BattleSender }); + context.replyText("此指令限制30秒呼叫一次", { sender: BattleSender }); return; } diff --git a/app/src/controller/princess/character.js b/app/src/controller/princess/character.js index b14732ef..05d4ad80 100644 --- a/app/src/controller/princess/character.js +++ b/app/src/controller/princess/character.js @@ -234,7 +234,7 @@ module.exports = { const desc = sample(comments.map(c => c.description)); - context.quoteReply(desc.replace(/\\n/g, "\n"), { + context.replyText(desc.replace(/\\n/g, "\n"), { sender: { name: data.Name, iconUrl: data.HeadImage, diff --git a/app/src/controller/princess/gacha.js b/app/src/controller/princess/gacha.js index 7462ba45..04bcf816 100644 --- a/app/src/controller/princess/gacha.js +++ b/app/src/controller/princess/gacha.js @@ -239,9 +239,9 @@ async function gacha(context, { match, pickup, ensure = false }) { // 檢查是否有足夠的女神石 if (pickup && userOwnStone < pickupCost) { - return context.quoteReply(i18n.__("message.gacha.not_enough_stone")); + return context.replyText(i18n.__("message.gacha.not_enough_stone")); } else if (ensure && userOwnStone < ensureCost) { - return context.quoteReply(i18n.__("message.gacha.not_enough_stone")); + return context.replyText(i18n.__("message.gacha.not_enough_stone")); } const queries = []; @@ -373,7 +373,7 @@ async function gacha(context, { match, pickup, ensure = false }) { } catch (err) { await trx.rollback(); console.log(err); - return context.quoteReply( + return context.replyText( i18n.__("message.error_contact_admin", { user_id: userId, error_key: "gacha_daily: transaction error when insert data", diff --git a/app/src/templates/application/ChatLevel.js b/app/src/templates/application/ChatLevel.js index 650d20d7..8b8db749 100644 --- a/app/src/templates/application/ChatLevel.js +++ b/app/src/templates/application/ChatLevel.js @@ -154,10 +154,10 @@ exports.showTopRank = (context, { rankData, sendType }) => { let message = sendType === "text" ? genTextTopRank(rankData) : genTextTopRank(rankData); if (sendType === "text") { - context.quoteReply(message); + context.replyText(message); } - context.quoteReply("為減少伺服器負擔,此訊息一分鐘只能查一次!"); + context.replyText("為減少伺服器負擔,此訊息一分鐘只能查一次!"); }; /** diff --git a/app/src/templates/application/CustomerOrder/line.js b/app/src/templates/application/CustomerOrder/line.js index e1fb6683..ed1b37cb 100644 --- a/app/src/templates/application/CustomerOrder/line.js +++ b/app/src/templates/application/CustomerOrder/line.js @@ -216,7 +216,7 @@ exports.showInsertManual = context => { }, }); } else if (context.event.source.type !== "user") { - context.quoteReply("剛剛才發送此訊息,我才不想洗版.."); + context.replyText("剛剛才發送此訊息,我才不想洗版.."); } }; @@ -246,7 +246,7 @@ exports.showDeleteManual = context => { }, }); } else if (context.event.source.type !== "user") { - context.quoteReply("剛剛才發送此訊息,我才不想洗版.."); + context.replyText("剛剛才發送此訊息,我才不想洗版.."); } }; diff --git a/app/src/templates/application/CustomerOrder/telegram.js b/app/src/templates/application/CustomerOrder/telegram.js index 6fe7566a..074aacb3 100644 --- a/app/src/templates/application/CustomerOrder/telegram.js +++ b/app/src/templates/application/CustomerOrder/telegram.js @@ -1,11 +1,11 @@ exports.showInsertManual = context => { - context.quoteReply( + context.replyText( "使用方式:.新增指令 指令 回覆\n特殊回覆關鍵字:{princess} {user} {1,100} [1,2,3]" ); }; exports.showDeleteManual = context => { - context.quoteReply("使用方式:.移除指令 指令 指令金鑰"); + context.replyText("使用方式:.移除指令 指令 指令金鑰"); }; exports.showDeleteOption = (context, deleteOrders) => { @@ -13,5 +13,5 @@ exports.showDeleteOption = (context, deleteOrders) => { .map(data => data.orderKey) .filter((key, index, selfAry) => selfAry.indexOf(key) === index); - context.quoteReply(`請問要刪除哪一筆?\n${uniqKeys.join("\n")}`); + context.replyText(`請問要刪除哪一筆?\n${uniqKeys.join("\n")}`); }; diff --git a/app/src/templates/application/Group/line.js b/app/src/templates/application/Group/line.js index cf2ca55f..c8190a5e 100644 --- a/app/src/templates/application/Group/line.js +++ b/app/src/templates/application/Group/line.js @@ -264,7 +264,7 @@ exports.showGroupConfig = context => { `公主查詢:${getIcon(guildConfig.PrincessCharacter)}`, `公主資訊:${getIcon(guildConfig.PrincessInformation)}`, ]; - context.quoteReply(messages.join("\n")); + context.replyText(messages.join("\n")); function getIcon(isOpen) { return isOpen === "Y" ? "✔" : "❌"; diff --git a/app/src/templates/application/Order.js b/app/src/templates/application/Order.js index 899fbbe4..2aadfb3d 100644 --- a/app/src/templates/application/Order.js +++ b/app/src/templates/application/Order.js @@ -27,7 +27,7 @@ exports.send = (context, replyDatas, sender = { name: null, iconUrl: null }) => _sendImage(context, content, sender); return; case "text": - context.quoteReply(content, { sender }); + context.replyText(content, { sender }); return; } }); @@ -143,7 +143,7 @@ function _sendImage(context, url, sender) { context.sendPhoto(url); break; default: - context.quoteReply(url); + context.replyText(url); break; } } diff --git a/app/src/templates/princess/ArenaTeamplate.js b/app/src/templates/princess/ArenaTeamplate.js index 656f4537..ec312fb9 100644 --- a/app/src/templates/princess/ArenaTeamplate.js +++ b/app/src/templates/princess/ArenaTeamplate.js @@ -8,7 +8,7 @@ exports.showUploadInfo = (context, info) => { `右方:${info.right.team.map(char => char.name).join(" ")} *${isSuccess[info.right.result]}*` ); - context.quoteReply(messages.join("\n")); + context.replyText(messages.join("\n")); }; /** * 詢問是否繼續操作 @@ -135,7 +135,7 @@ exports.askContinue = context => { exports.showSearchNoneData = (context, searchTeam) => { context.replyFlex("查無結果", genSearchCover(searchTeam)); - context.quoteReply("很抱歉,查無此陣容的解法!"); + context.replyText("很抱歉,查無此陣容的解法!"); }; /** diff --git a/app/src/templates/princess/character/console.js b/app/src/templates/princess/character/console.js index 03748741..e5048faf 100644 --- a/app/src/templates/princess/character/console.js +++ b/app/src/templates/princess/character/console.js @@ -1,29 +1,29 @@ module.exports = { showInfo: function (context, name) { - context.quoteReply(`${name}的資訊`); + context.replyText(`${name}的資訊`); }, showSkill: function (context, name) { - context.quoteReply(`${name}的技能一覽`); + context.replyText(`${name}的技能一覽`); }, showAction: function (context, name) { - context.quoteReply(`${name}的行動模式`); + context.replyText(`${name}的行動模式`); }, showUniqEquip: function (context, name) { - context.quoteReply(`${name}的專武清單`); + context.replyText(`${name}的專武清單`); }, showEquipRequire: function (context, name) { - context.quoteReply(`${name}的裝備需求清單`); + context.replyText(`${name}的裝備需求清單`); }, showCharacter: function (context, name) { - context.quoteReply(`${name}的角色資訊`); + context.replyText(`${name}的角色資訊`); }, showRecommend: function (context, name) { - context.quoteReply(`${name}的角色Rank推薦`); + context.replyText(`${name}的角色Rank推薦`); }, }; diff --git a/app/src/templates/princess/character/telegram.js b/app/src/templates/princess/character/telegram.js index 03748741..e5048faf 100644 --- a/app/src/templates/princess/character/telegram.js +++ b/app/src/templates/princess/character/telegram.js @@ -1,29 +1,29 @@ module.exports = { showInfo: function (context, name) { - context.quoteReply(`${name}的資訊`); + context.replyText(`${name}的資訊`); }, showSkill: function (context, name) { - context.quoteReply(`${name}的技能一覽`); + context.replyText(`${name}的技能一覽`); }, showAction: function (context, name) { - context.quoteReply(`${name}的行動模式`); + context.replyText(`${name}的行動模式`); }, showUniqEquip: function (context, name) { - context.quoteReply(`${name}的專武清單`); + context.replyText(`${name}的專武清單`); }, showEquipRequire: function (context, name) { - context.quoteReply(`${name}的裝備需求清單`); + context.replyText(`${name}的裝備需求清單`); }, showCharacter: function (context, name) { - context.quoteReply(`${name}的角色資訊`); + context.replyText(`${name}的角色資訊`); }, showRecommend: function (context, name) { - context.quoteReply(`${name}的角色Rank推薦`); + context.replyText(`${name}的角色Rank推薦`); }, }; diff --git a/app/src/templates/princess/guild/battle.js b/app/src/templates/princess/guild/battle.js index 1cca97b1..020c6bde 100644 --- a/app/src/templates/princess/guild/battle.js +++ b/app/src/templates/princess/guild/battle.js @@ -3,7 +3,7 @@ const i18n = require("../../../util/i18n"); const format = require("date-format"); exports.sendSignFeedback = (context, template, data, sender) => { - return context.quoteReply(assemble(data, template), { sender }); + return context.replyText(assemble(data, template), { sender }); }; exports.showBattleList = (context, data) => { diff --git a/app/src/util/error.js b/app/src/util/error.js index c31d9dd1..a41a2d62 100644 --- a/app/src/util/error.js +++ b/app/src/util/error.js @@ -2,7 +2,7 @@ module.exports = { sendError: function (context, errMsg) { switch (context.platform) { case "line": - context.quoteReply(errMsg); + context.replyText(errMsg); break; case "telegram": context.sendMessage(errMsg); From 9edfb27416eac9fb4b9511011f6cd33bbc44176d Mon Sep 17 00:00:00 2001 From: hanshino Date: Mon, 25 Sep 2023 15:33:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Revert=20"feat:=20=E6=94=AF=E6=8F=B4?= =?UTF-8?q?=E5=9B=9E=E8=A6=86=E8=A8=8A=E6=81=AF=E5=8A=9F=E8=83=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 80a62b552d8b8613174509cae47ea4754a353e7d. --- app/src/app.js | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/app/src/app.js b/app/src/app.js index cdb9027d..c651c1c9 100644 --- a/app/src/app.js +++ b/app/src/app.js @@ -369,52 +369,6 @@ function Nothing(context) { async function App(context) { traffic.recordPeople(context); - - context.replyText = function (...args) { - const { quoteToken } = context.event.message; - const [text] = args; - let replyObject = {}; - - const textType = typeof text; - - if (textType === "string") { - replyObject = [ - { - type: "text", - text, - quoteToken, - }, - ]; - } else if (Array.isArray(text)) { - replyObject = text.map((t, index) => { - let reply; - if (typeof t === "string") { - reply = { - type: "text", - text: t, - }; - } else if (typeof t === "object") { - reply = { - ...t, - }; - } - - if (index === 0) { - reply.quoteToken = quoteToken; - } - - return reply; - }); - } else if (textType === "object") { - replyObject = { - ...text, - quoteToken, - }; - } - - return context.reply(replyObject); - }; - return chain([ setProfile, // 設置各式用戶資料 statistics, // 數據蒐集