Example #1
0
async def get_marriagebot_perks(bot: utils.Bot,
                                user_id: int) -> MarriageBotPerks:
    """
    Get the specific perks that any given user has.

    Args:
        bot (utils.Bot): The bot instance that will be used to fetch data from Upgrade.Chat.
        user_id (int): The ID of the user we want to get the perks of.

    Returns:
        MarriageBotPerks: All of the perks that the calling user has.
    """

    return TIER_BRUH  # bruh

    # Override stuff for owners
    if user_id in bot.owner_ids:
        return TIER_THREE

    # Check if they have a purchase
    async with bot.database() as db:
        rows = await db(
            "SELECT * FROM guild_specific_families WHERE purchased_by=$1",
            user_id)
    if rows:
        return TIER_THREE

    # Check UpgradeChat purchases
    try:
        purchases = await asyncio.wait_for(
            bot.upgrade_chat.get_orders(discord_id=user_id), timeout=3)
    except asyncio.TimeoutError:
        purchases = []
    purchased_item_names = []
    [purchased_item_names.extend(i.order_item_names) for i in purchases]
    if "MarriageBot Subscription Tier 3" in purchased_item_names:
        return TIER_THREE
    elif "MarriageBot Subscription Tier 2" in purchased_item_names:
        return TIER_TWO
    elif "MarriageBot Subscription Tier 1" in purchased_item_names:
        return TIER_ONE

    # Check Top.gg votes
    try:
        data = await asyncio.wait_for(bot.get_user_topgg_vote(user_id),
                                      timeout=3)
        if data:
            return TIER_VOTER
    except asyncio.TimeoutError:
        pass

    # Return default
    return MarriageBotPerks()
Example #2
0
    async def fetch_name(self, bot: utils.Bot) -> str:
        """
        Fetch the name of the current user - first trying from Redis, then trying from the
        API (if we couldn't get from Redis the first time then we add it after fetching from
        the API).
        """

        async with bot.redis() as re:
            v = await re.get(f"UserName-{self.user_id}")
        if v:
            self.name = v
            return v
        try:
            user = await bot.fetch_user(self.user_id)
            name = str(user)
        except Exception:
            name = "Deleted User"
        async with bot.redis() as re:
            await re.set(f"UserName-{self.user_id}", name)
        self.name = name
        return name
Example #3
0
def setup(bot: utils.Bot):
    x = Parentage(bot)
    bot.add_cog(x)
Example #4
0
def setup(bot: utils.Bot):
    x = DiceCommands(bot)
    bot.add_cog(x)
Example #5
0
def setup(bot: utils.Bot):
    x = EmojiCommands(bot)
    bot.add_cog(x)
Example #6
0
def setup(bot: utils.Bot):
    x = WikihowGame(bot)
    bot.add_cog(x)
Example #7
0
def setup(bot: utils.Bot):
    x = InformationCommands(bot)
    bot.add_cog(x)
Example #8
0
def setup(bot: utils.Bot):
    x = AnimalCommands(bot)
    bot.add_cog(x)
def setup(bot: utils.Bot):
    x = ModerationCommands(bot)
    bot.add_cog(x)
Example #10
0
def setup(bot: utils.Bot):
    x = CurrencyCommands(bot)
    bot.add_cog(x)
Example #11
0
def setup(bot: utils.Bot):
    x = SlotsCommands(bot)
    bot.add_cog(x)
Example #12
0
def setup(bot: utils.Bot):
    x = MeowChat(bot)
    bot.add_cog(x)
Example #13
0
def setup(bot: vbu.Bot):
    x = DNDCommands(bot)
    bot.add_cog(x)
Example #14
0
def setup(bot: utils.Bot):
    x = RunescapeCommands(bot)
    bot.add_cog(x)
def setup(bot: utils.Bot):
    x = VerificationSystem(bot)
    bot.add_cog(x)
Example #16
0
def setup(bot: vbu.Bot):
    x = LibraryDocs(bot)
    bot.add_cog(x)
Example #17
0
def setup(bot: utils.Bot):
    x = PlantCareCommands(bot)
    bot.add_cog(x)
Example #18
0
def setup(bot: utils.Bot):
    x = SteamCommand(bot)
    bot.add_cog(x)
def setup(bot:utils.Bot):
    x = PlantDisplayCommands(bot)
    bot.add_cog(x)
Example #20
0
def setup(bot: vbu.Bot):
    x = StaffPinger(bot)
    bot.add_cog(x)
Example #21
0
def setup(bot: utils.Bot):
    x = UserCommands(bot)
    bot.add_cog(x)
Example #22
0
def setup(bot:utils.Bot):
    x = BotSettings(bot)
    bot.add_cog(x)
Example #23
0
def setup(bot: vbu.Bot):
    x = MeowChat(bot)
    bot.add_cog(x)
Example #24
0
def setup(bot: vbu.Bot):
    x = QuoteCommands(bot)
    bot.add_cog(x)
Example #25
0
def setup(bot: utils.Bot):
    x = DonatorMessage(bot)
    bot.add_cog(x)
Example #26
0
def setup(bot: utils.Bot):
    x = UserInfo(bot)
    bot.add_cog(x)
Example #27
0
def setup(bot: utils.Bot):
    x = ReminderCommands(bot)
    bot.add_cog(x)
Example #28
0
def setup(bot:utils.Bot):
    x = SupportFAQHandler(bot)
    bot.add_cog(x)
Example #29
0
def setup(bot: utils.Bot):
    x = MessageHandler(bot)
    bot.add_cog(x)
Example #30
0
def setup(bot: vbu.Bot):
    x = GoogleCommands(bot)
    bot.add_cog(x)