Hi, recently i decided to redo my bot due to the immense amount of spaghetti i had to deal with.
I declare the check on a slash command. But when i run my command is_web_linked, It returns false. Same way to check in my custom checks.py file in my extensions folder.
Command:
@nextcord.slash_command(name="points", description="Returns your current rapid rewards points.")
@checks.is_verified()
async def points(
self,
interaction: nextcord.Interaction,
):
print(await api.is_web_linked(interaction.user))
print(interaction.user.id)
print(interaction.user)
return await interaction.response.send_message("This command is not yet implemented.")
Check:
import nextcord
import json
from nextcord.ext import commands
from extensions import api
from extensions import emojis
from extensions import colors
def load_json(file_path):
return json.load(open(file_path, "r"))
conf: dict = load_json("config.json")
def is_verified():
"""
Decorator to check if the user is verified on the website.
"""
async def predicate(interaction: nextcord.Interaction):
check_statement = await api.is_web_linked(interaction.user)
if not check_statement:
pleaseLinkEmbed = nextcord.Embed(
title=f"{emojis.warn} Link your account!",
description="You must link your account to use this command. Run the /link command to begin the process.",
color=colors.DEFAULT
)
pleaseLinkEmbed.set_author(
name=interaction.user.name,
icon_url=interaction.user.display_avatar.url
)
pleaseLinkEmbed.set_image(
url=conf.get("SEPERATOR")
)
await interaction.send(embed=pleaseLinkEmbed)
return check_statement
return commands.check(predicate)
Am i handling the check wrong? When i run the main command, it returns false (as it should). But my check wont handle the interaction properly.
Can anybody provide any feedback?
