Skip to content

Commit

Permalink
pointsmgr: Provide @mod/@vip/@sub in point redemptions too, using the…
Browse files Browse the repository at this point in the history
… most recently seen
  • Loading branch information
Rosuav committed Dec 2, 2024
1 parent d6bbbaf commit 45ba8b1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions modules/pointsmgr.pike
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ __async__ void points_redeemed(object channel, mapping data, int|void removal) {
(["method": "PATCH", "json": (["cost": newcost])]),
);
}
if (channel && !removal) foreach (channel->redemption_commands[data->reward->id] || ({ }), string cmd) {
channel->send(([
"displayname": data->user_name, "user": data->user_login,
"uid": data->user_id,
]), channel->commands[cmd], ([
"%s": data->user_input,
"{rewardid}": data->reward->id, "{redemptionid}": data->id,
]));
if (channel && !removal) {
mapping badges = channel->user_badges[data->user_id] || ([]);
foreach (channel->redemption_commands[data->reward->id] || ({ }), string cmd) {
channel->send(([
"displayname": data->user_name, "user": data->user_login,
"uid": data->user_id,
]), channel->commands[cmd], ([
"%s": data->user_input,
"{rewardid}": data->reward->id, "{redemptionid}": data->id,
"{@mod}": badges->?_mod ? "1" : "0", "{@sub}": badges->?_sub ? "1" : "0",
"{@vip}": badges->?vip ? "1" : "0",
]));
}
}
}

Expand Down

0 comments on commit 45ba8b1

Please sign in to comment.