import os
import discord
import json
from discord.ext import commands, check
def check_if_user_has_premium(ctx):
with open("premium_users.json") as f:
premium_users_list = json.load(f)
if ctx.author.id not in premium_users_list:
return False
return True
@bot.command()
@check(check_if_user_has_premium)
async def apremiumcommand(ctx):
await ctx.send("Hello premium user!")
@apremiumcommand.error
async def apremiumcommand_error(ctx, error):
if isinstance(error, commands.CheckFailure):
await ctx.send("Sorry, but you are not a premium user!")
else:
raise error
bot.run(os.getenv("TOKEN"))
I am getting this error:
Traceback (most recent call last): File "main.py", line 269, in @check(check_if_user_has_premium) TypeError: 'module' object is not callable