diff --git a/client/public/assets/chewie.jpg b/client/public/assets/chewie.jpg index c87e1197..4914861b 100644 Binary files a/client/public/assets/chewie.jpg and b/client/public/assets/chewie.jpg differ diff --git a/server/src/controllers/settingsController.ts b/server/src/controllers/settingsController.ts index 5dc5cfae..125f7697 100644 --- a/server/src/controllers/settingsController.ts +++ b/server/src/controllers/settingsController.ts @@ -11,7 +11,7 @@ import BotSettingsService, { BotSettings } from "../services/botSettingsService" class SettingsController { private readonly SettingDescriptions = { [BotSettings.DonationPointsPerDollar]: { title: "Donations: Points added per USD", readonly: false }, - [BotSettings.GoldStatusDonationAmount]: { title: "VIP Gold: USD required per month", readonly: false }, + [BotSettings.GoldStatusDonationAmount]: { title: "VIP Gold: USD required for 4 weeks / requests", readonly: false }, [BotSettings.PointsPerBit]: { title: "Bits: Points added per Bit", readonly: false }, [BotSettings.PruneLogsAfterDays]: { title: "Amount of days to retain logs", readonly: false }, [BotSettings.RedeemCost]: { title: "Cost for !redeem command", readonly: false }, @@ -30,7 +30,7 @@ class SettingsController { [BotSettings.SongDonationLink]: { title: "URL for donations on song queue page", readonly: false }, [BotSettings.CardsRequiredForUpgrade]: { title: "Number of cards required for redeeming an upgrade", readonly: false }, [BotSettings.CommandCooldownInSeconds]: { title: "Cooldown for regular text commands (in seconds)", readonly: false }, - [BotSettings.GoldWeeksPerT3Sub]: { title: "Amount of VIP gold weeks per T3 sub", readonly: false }, + [BotSettings.GoldWeeksPerT3Sub]: { title: "VIP Gold: Amount of weeks / requests per T3 sub", readonly: false }, [BotSettings.ReadonlyMode]: { title: "Read-only mode for points", readonly: false }, [BotSettings.MaxSongRequestRedemptionsInQueue]: { title: "Maximum number of song requests through channel rewards in queue", readonly: false }, [BotSettings.SubNotificationProvider]: { title: "Provider for subscription notifications (Twitch|Streamlabs)", readonly: false }, @@ -48,8 +48,8 @@ class SettingsController { [BotSettings.TaxInspectorExemptUsers]: { title: "Users exempt from tax inspector", readonly: false }, [BotSettings.TaxEvasionPenaltyLeaderboardCount]: { title: "Number of top users from tax evasion leaderboard for penalty", readonly: false }, [BotSettings.TaxEvasionCooldown]: { title: "Number of minutes that tax evaders are safe after penalty", readonly: false }, - [BotSettings.GoldStatusRequestLimit]: { title: "Limit VIP gold requests by 1 per week or stream (Week|Stream)", readonly: false }, - [BotSettings.GoldStatusPermanentRequests]: { title: "Grant permanent VIP gold requests for donations", readonly: false }, + [BotSettings.GoldStatusRequestLimit]: { title: "VIP Gold: Limit requests to 1 per week or stream (Week|Stream)", readonly: false }, + [BotSettings.GoldStatusPermanentRequests]: { title: "VIP Gold: Use permanent requests instead of time periods", readonly: false }, }; constructor( diff --git a/server/src/services/rewardService.ts b/server/src/services/rewardService.ts index 41d36cda..930d047c 100644 --- a/server/src/services/rewardService.ts +++ b/server/src/services/rewardService.ts @@ -91,7 +91,12 @@ export default class RewardService { if (sub.sub_plan === SubscriptionPlan.Tier3) { const goldWeeksT3 = parseInt(await this.settings.getValue(BotSettings.GoldWeeksPerT3Sub), 10); - await this.userService.addVipGoldWeeks(user, goldWeeksT3, "T3 Resub"); + const usePermanentRequests = await this.settings.getBoolValue(BotSettings.GoldStatusPermanentRequests); + if (usePermanentRequests) { + await this.userService.addPermanentVip(user, goldWeeksT3, "T3 Resub"); + } else { + await this.userService.addVipGoldWeeks(user, goldWeeksT3, "T3 Resub"); + } } } @@ -104,7 +109,12 @@ export default class RewardService { // Both gifter and receiver gets half the amount of VIP gold. // We assume that the user on the receiving end will be covered by a streamlabs event. if (giftingUser) { - await this.userService.addVipGoldWeeks(giftingUser, giftedMonths, "Gifted T3 sub"); + const usePermanentRequests = await this.settings.getBoolValue(BotSettings.GoldStatusPermanentRequests); + if (usePermanentRequests) { + await this.userService.addPermanentVip(giftingUser, giftedMonths, "Gifted T3 sub"); + } else { + await this.userService.addVipGoldWeeks(giftingUser, giftedMonths, "Gifted T3 sub"); + } } } } diff --git a/server/src/services/userService.ts b/server/src/services/userService.ts index 394ba6a0..996a7ad5 100644 --- a/server/src/services/userService.ts +++ b/server/src/services/userService.ts @@ -9,6 +9,7 @@ import { Logger, LogType } from "../logger"; import PointLogsRepository from "../database/pointLogsRepository"; import EventAggregator from "./eventAggregator"; import WebsocketService from "../services/websocketService"; +import BotSettingsService, { BotSettings } from "../services/botSettingsService"; @injectable() export class UserService { @@ -17,7 +18,8 @@ export class UserService { @inject(EventLogService) private eventLog: EventLogService, @inject(EventAggregator) private eventAggregator: EventAggregator, @inject(WebsocketService) private websocketService: WebsocketService, - @inject(PointLogsRepository) private pointsLog: PointLogsRepository) { + @inject(PointLogsRepository) private pointsLog: PointLogsRepository, + @inject(BotSettingsService) private settings: BotSettingsService) { // Empty } @@ -179,7 +181,15 @@ export class UserService { */ public async addPermanentVip(user: IUser, amount: number, reason: string) { user.vipPermanentRequests = user.vipPermanentRequests ? (user.vipPermanentRequests + amount) : amount; - await this.addVipGoldWeeks(user, amount, reason); + + const usePermanentRequests = await this.settings.getBoolValue(BotSettings.GoldStatusPermanentRequests); + if (usePermanentRequests) { + // Not changing VIP expiry date here to limit available requests to the permanent ones + await this.users.updateVipExpiry(user); + await this.eventLog.addVipGoldAdded(user, { weeksAdded: 0, newExpiry: user.vipExpiry, permanentRequests: user.vipPermanentRequests, reason }); + } else { + await this.addVipGoldWeeks(user, amount, reason); + } } /**