repl.it
@CalebEvans1/

TestBot

Python

No description

fork
loading
Files
  • main.py
  • data.json
  • keep_alive.py
  • Packager files
  • poetry.lock
  • pyproject.toml
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import  os, random, base64, json
import discord
from pprint import pprint

from discord.ext.commands import Bot

import time

print("Retrieved Libraries")

#Get all of the .env variables
TOKEN = os.getenv('token')
print("Retrieved Variables")

yee = Bot(command_prefix='*')

@yee.event
async def on_ready():
  print('Ready to go!')
"""
@yee.command()
async def help(ctx):
"""

@yee.command()
async def newtourn(ctx, cap=16, tournid=0):
    if tournid == 0:
        tournid = random.randint(9999)
    new_tourn = open("torunaments/{0}.json".format(tournid),"w")
    torunament

participant_model = {"id":0,"wins":0,"losses":0,"ties":0,"PS":0,"PA":0}
match_model       = {"idA":0,"idB":0,"score":(0,0),"rounds":[]}
torunament_model  = {"participants":[],"matches":[],"premium":false,"player_cap":0}

def create_tournament(tourn_id, data):
    new_tourn = open("tournaments/{0}.json".format(tourn_id), w)
    tournament = {"participants":[],"matches":[],"premium":False}
    json.dump(tournament, new_tourn)
    new_tourn.close()

def add_match(tourn_id, match_data):
    tourn = open("tournaments/{0}.json".format(tourn_id), "r+")
    tournament = json.load(tourn)
    tournament["matches"].append(match_model)
    json.dump(tournament, tourn)
    tourn.close()

yee.run(TOKEN)
Fetching token
?