feat(premium): Ad-whitelist premium guilds.

This commit is contained in:
2023-10-26 13:49:03 +03:00
parent d3bd233b3e
commit 73aad8a721
4 changed files with 16 additions and 7 deletions

View File

@@ -36,8 +36,12 @@ class SponsorCog(LionCog):
"""
if not interaction.is_expired():
# TODO: caching
if interaction.guild:
whitelist = (await self.settings.Whitelist.get(self.bot.appname)).value
if interaction.guild and interaction.guild.id in whitelist:
if interaction.guild.id in whitelist:
return
premiumcog = self.bot.get_cog('PremiumCog')
if premiumcog and await premiumcog.is_premium_guild(interaction.guild.id):
return
setting = await self.settings.SponsorPrompt.get(self.bot.appname)
value = setting.value

View File

@@ -537,9 +537,10 @@ class LeaderboardUI(StatsUI):
period_row,
page_row
]
voting = self.bot.get_cog('TopggCog')
if voting and not await voting.check_voted_recently(self.userid):
premiumcog = self.bot.get_cog('PremiumCog')
if not (premiumcog and await premiumcog.is_premium_guild(self.guild.id)):
self._layout.append((voting.vote_button(),))
async def reload(self):

View File

@@ -299,6 +299,8 @@ class ProfileUI(StatsUI):
voting = self.bot.get_cog('TopggCog')
if voting and not await voting.check_voted_recently(self.userid):
premiumcog = self.bot.get_cog('PremiumCog')
if not (premiumcog and await premiumcog.is_premium_guild(self.guild.id)):
self._layout.append((voting.vote_button(),))
async def _render_stats(self):

View File

@@ -753,6 +753,8 @@ class WeeklyMonthlyUI(StatsUI):
voting = self.bot.get_cog('TopggCog')
if voting and not await voting.check_voted_recently(self.userid):
premiumcog = self.bot.get_cog('PremiumCog')
if not (premiumcog and await premiumcog.is_premium_guild(self.guild.id)):
self._layout.append((voting.vote_button(),))
if self._showing_selector: