koishi-plugin-prism 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/index.js +7 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ pricingConfigIds: [pricing-mahjong-a]
|
|
|
58
58
|
玩家在未产生任何费用时退场,机器人会简洁显示“本次未产生费用”和当前余额;存在收费或优惠明细时仍显示完整结算账单。
|
|
59
59
|
结账成功后,机器人会向 `staffUserIds` 与 `logoutNotifyUserIds` 中的用户私聊同一份账单,账单会明确显示结账玩家身份。
|
|
60
60
|
账单和管理员代操作回执均使用“平台昵称(QQ:号码)”称呼玩家;平台暂时无法提供昵称时显示“未知昵称(QQ:号码)”,不会显示内部玩家 ID。
|
|
61
|
+
管理员 `/add` 增加免费余额;`/del` 按结账相同的顺序从可用免费余额、再从付费余额扣除,余额不足时会返回余额不足提示。
|
|
61
62
|
* `billing` - 预览当前玩家本场计费的消费费用。
|
|
62
63
|
* `wallet` - 查看当前玩家的钱包余额。
|
|
63
64
|
* `items` - 查看当前玩家持有的道具或资产。
|
package/lib/index.js
CHANGED
|
@@ -280,6 +280,12 @@ class PrismApiClient {
|
|
|
280
280
|
body: { ...this.identityBody(identity), adjustments },
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
|
+
async adjustWalletByIdentity(identity, amount, reason) {
|
|
284
|
+
return this.request("POST", "/rpc/integration/players/by-identity/wallet/adjustment", {
|
|
285
|
+
token: this.config.integrationToken,
|
|
286
|
+
body: { ...this.identityBody(identity), amount, reason },
|
|
287
|
+
});
|
|
288
|
+
}
|
|
283
289
|
async checkoutWithOverrideByIdentity(identity, total, reason) {
|
|
284
290
|
return this.request("POST", "/rpc/integration/players/by-identity/checkout/override", {
|
|
285
291
|
token: this.config.integrationToken,
|
|
@@ -370,12 +376,7 @@ class PrismKoishiService {
|
|
|
370
376
|
if (!Number.isFinite(amount) || amount <= 0)
|
|
371
377
|
return "金额必须大于 0";
|
|
372
378
|
const isAddition = direction === 1;
|
|
373
|
-
await this.client.
|
|
374
|
-
assetType: "currency",
|
|
375
|
-
assetCode: "paid",
|
|
376
|
-
quantityDelta: amount * direction,
|
|
377
|
-
reason: isAddition ? "Koishi 管理员增加余额" : "Koishi 管理员扣除余额",
|
|
378
|
-
}]);
|
|
379
|
+
await this.client.adjustWalletByIdentity(this.identity(sender), amount * direction, isAddition ? "Koishi 管理员增加余额" : "Koishi 管理员扣除余额");
|
|
379
380
|
return `✅ 已为用户 ${formatPlayerReference(sender, this.config.provider)}${isAddition ? "增加" : "扣除"} ${formatNumber(amount)} ${this.config.currencyName}`;
|
|
380
381
|
}, bot);
|
|
381
382
|
}
|