Exemplo n.º 1
0
import discord
import time
import asyncio
import math

from humanfriendly import format_timespan as timeez

from constants import ADMIN_PRIVILEGE_ROLES
from utils.updation import match_score, round_score
from utils import updation, cf_api
from data import dbconn


db = dbconn.DbConn()
cf = cf_api.CodeforcesAPI()


def has_admin_privilege(ctx):
    if ctx.channel.permissions_for(ctx.author).manage_guild:
        return True
    for role in ADMIN_PRIVILEGE_ROLES:
        if role.lower() in [x.name.lower() for x in ctx.author.roles]:
            return True
    return False


async def send_message(ctx, message):
    await ctx.send(embed=discord.Embed(description=message, color=discord.Color.gold()))


async def get_time_response(client, ctx, message, time, author, range_):
Exemplo n.º 2
0
 def __init__(self, client):
     self.client = client
     self.db = dbconn.DbConn()
     self.users = self.db.get_all_users()
     self.cf = cf_api.CodeforcesAPI()
     self.trading = 1
Exemplo n.º 3
0
 def __init__(self, client):
     self.client = client
     self.db = dbconn.DbConn()
     self.cf = cf_api.CodeforcesAPI()
Exemplo n.º 4
0
 def __init__(self, client):
     self.client = client
     self.db = dbconn.DbConn()
     self.cf = cf_api.CodeforcesAPI()
     self.api = challonge_api.ChallongeAPI(self.client)