Untitled

mail@pastecode.io avatar
unknown
python
a month ago
1.2 kB
3
Indexable
Never
@staticmethod
    def check_gpt_roles() -> Callable:
        async def inner(ctx: discord.ApplicationContext):
            await ctx.defer(ephemeral=True) 

            is_subscribed = Subscription.subscription_check(str(ctx.user.id)) // This task takes more than 3 sec
            print(is_subscribed)

            if "new_user" in is_subscribed:
                return False

            if is_subscribed["subscription"]:
                if not is_subscribed["credit"]:
                    embed = discord.Embed(
                        title="Not Enough Credit",
                        description="Buy Credit",
                        color=discord.Colour.red(),
                    )
                    await ctx.respond(embed=embed, view=SubscribeButton(ctx), ephemeral=True)
                    return False

                return True
            elif not is_subscribed["subscription"]:
                embed = discord.Embed(
                    title="Subscription Required",
                    description="Subscribe Now",
                    color=discord.Colour.red(),
                )
                await ctx.respond(embed=embed, view=SubscribeButton(ctx), ephemeral=True)
                return False

        return inner
Leave a Comment