Beispiel #1
0
    def __init__(self, game_id):
        # Caches the newest run's ID on init
        log.debug(f"Creating new Game instance for game {game_id}!")
        self.newest_cached = None
        self.seen_runs = []
        self.api = srcomapi.SpeedrunCom()
        self.api.debug = 1

        self.set_game(game_id)
Beispiel #2
0
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import srcomapi, srcomapi.datatypes as dt
api = srcomapi.SpeedrunCom()
api.debug = 1
from datetime import datetime as dtime
from datetime import timedelta as tdel
from datetime import time
import math

global perm
perm = True
Client = discord.Client()
bot_prefix = "."
client = commands.Bot(command_prefix=bot_prefix)


def check():
    return perm


def change():
    global perm
    perm = False


def convert(t):
    a = int(t / 60 / 60)
    b = int(t / 60 % 60)
Beispiel #3
0
import json
import collections

import srcomapi, srcomapi.datatypes as dt
api = srcomapi.SpeedrunCom(); api.debug = 0

def buildSlug(name):
    return name.lower().replace("%", "_").replace(" ", "-")

def buildSubcategory(subcategory):
    return {
        "abbr": buildSlug(subcategory["label"]),
        "name": subcategory["label"],
        "rules": subcategory["rules"]
    }

def buildCategory(category):
    subcat = next((var for var in category.variables if var.is_subcategory), None)

    return {
        "abbr": buildSlug(category.name),
        "name": category.name,
        "rules": category.rules,
        "subcategories": not subcat or [buildSubcategory(values) for values in subcat.values["values"].values()]
    }

def buildMiscSubcategory(category):
    return {
        "abbr": buildSlug(category.name),
        "name": category.name,
        "rules": category.rules,
Beispiel #4
0
def setup_api(api_key=None):
    return srcomapi.SpeedrunCom(api_key)
Beispiel #5
0
def setup_api():
    return srcomapi.SpeedrunCom(mock=True)