# Copyright (C) 2020-2021 by DevsExpo@Github, < https://github.com/DevsExpo >.
#
# This file is part of < https://github.com/DevsExpo/FridayUB > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/DevsExpo/blob/master/LICENSE >
#
# All rights reserved.

from geezlibs.database import db_x

gbun = db_x["GBAN"]


async def gban_user(user, reason="#GBanned"):
    await gbun.insert_one({"user": user, "reason": reason})


async def ungban_user(user):
    await gbun.delete_one({"user": user})


async def gban_list():
    return [lo async for lo in gbun.find({})]


async def gban_info(user):
    kk = await gbun.find_one({"user": user})
    if not kk:
        return False
    else:
        return kk["reason"]
