generated from HoloTech/holotech-plugin-template
tweak: Add inactive redeem event listener
This commit is contained in:
+6
-3
@@ -62,6 +62,7 @@ class RewardCampaign:
|
||||
twitch_user_id: Optional[str] = None,
|
||||
twitch_user_name: Optional[str] = None,
|
||||
earned_at: Optional[datetime] = None,
|
||||
**kwargs,
|
||||
) -> EarnedReward:
|
||||
row = await EarnedReward.create(
|
||||
campaign_id=self.row.campaign_id,
|
||||
@@ -71,6 +72,7 @@ class RewardCampaign:
|
||||
twitch_user_id=twitch_user_id,
|
||||
twitch_user_name=twitch_user_name,
|
||||
earned_at=earned_at or utc_now(),
|
||||
**kwargs,
|
||||
)
|
||||
await self.try_to_log_reward(row)
|
||||
|
||||
@@ -99,7 +101,8 @@ class RewardCampaign:
|
||||
return rows
|
||||
|
||||
async def try_to_unlog_reward(self, reward: EarnedReward):
|
||||
import discord
|
||||
import discord
|
||||
|
||||
try:
|
||||
if self.webhook and reward.log_messageid:
|
||||
await self.webhook.delete_message(reward.log_messageid)
|
||||
@@ -218,8 +221,8 @@ class CampaignRegistry:
|
||||
condition = Campaign.communityid == cid
|
||||
|
||||
if active is not None:
|
||||
active_condition = (
|
||||
(Campaign.started_at != NULL) & (Campaign.completed_at == NULL)
|
||||
active_condition = (Campaign.started_at != NULL) & (
|
||||
Campaign.completed_at == NULL
|
||||
)
|
||||
if active:
|
||||
condition = condition & active_condition
|
||||
|
||||
Reference in New Issue
Block a user