koishi-plugin-monetary-admin 1.3.0 → 1.4.0
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/lib/index.js +2 -12
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -56,12 +56,7 @@ function apply(ctx) {
|
|
|
56
56
|
return '请输入金额。';
|
|
57
57
|
if (amount <= 0)
|
|
58
58
|
return '金额必须为正数。';
|
|
59
|
-
|
|
60
|
-
await ctx.database.upsert('monetary', (row) => [{
|
|
61
|
-
uid,
|
|
62
|
-
currency,
|
|
63
|
-
value: koishi_1.$.add(row.value, amount),
|
|
64
|
-
}], ['uid', 'currency']);
|
|
59
|
+
await ctx.monetary.gain(uid, amount, currency);
|
|
65
60
|
return `成功给用户 ${name} (UID: ${uid}) 添加了 ${amount} ${currency}。`;
|
|
66
61
|
}
|
|
67
62
|
catch (e) {
|
|
@@ -91,12 +86,7 @@ function apply(ctx) {
|
|
|
91
86
|
return '请输入金额。';
|
|
92
87
|
if (amount <= 0)
|
|
93
88
|
return '金额必须为正数。';
|
|
94
|
-
|
|
95
|
-
await ctx.database.upsert('monetary', (row) => [{
|
|
96
|
-
uid,
|
|
97
|
-
currency,
|
|
98
|
-
value: koishi_1.$.sub(row.value, amount),
|
|
99
|
-
}], ['uid', 'currency']);
|
|
89
|
+
await ctx.monetary.gain(uid, -amount, currency);
|
|
100
90
|
return `成功从用户 ${name} (UID: ${uid}) 扣除了 ${amount} ${currency}。`;
|
|
101
91
|
}
|
|
102
92
|
catch (e) {
|