Hey I'm making command that register the user by their discord ID(mongodb). So now I want to add if User already registered the bot return that you are already in.
I tried this:
@commands.command()
async def register(self, ctx):
mongo_url = ""
cluster = MongoClient(
mongo_url
)
db = cluster["DNFT-registered-users(DISCORDBOT)"]
collection = db["registered"]
register = {
"User": ctx.author.id,
}
if ctx.author.id in collection:
return await ctx.send("You are in already")
else:
collection.insert_one(register)
return await ctx.send("worked")