Пример #1
0
def get_role_permissions(role: Role):
    guild = database.get_guild(role.guild.id)
    try:
        return guild["role_permission_" + str(role.id)]
    except KeyError:
        database.update_guild(role.guild.id, {"role_permission_" + str(role.id): 0})
        return get_role_permissions(role)
Пример #2
0
def get_user_permissions(member: Member):
    guild = database.get_guild(member.guild.id)
    try:
        return guild["user_permission_" + str(member.id)]
    except KeyError:
        database.update_guild(member.guild.id, {"user_permission_" + str(member.id): 0})
        return get_user_permissions(member)
Пример #3
0
def get_prefix(bot, message: Message):
    guild = database.get_guild(message.guild.id)

    try:
        p = guild["prefix"]
    except KeyError:
        database.update_guild(message.guild.id, {"prefix": guild_defaults["prefix"]})
        return get_prefix(bot, message)

    return p, f"<@!{bot.user.id}> ", f"<@{bot.user.id}> "
Пример #4
0
def update_prefix(guild_id, prefix):
    database.update_guild(guild_id, {"prefix": prefix})
    return database.get_guild(guild_id)["prefix"]
Пример #5
0
def get_log_channel(ctx: Context):
    try:
        return int(database.get_guild(ctx.guild.id)["log_channel"])
    except KeyError:
        database.update_guild(ctx.guild.id, {"log_channel": "0"})
        return get_log_channel(ctx)