moving to config slowly
This commit is contained in:
parent
959db883e5
commit
91173c1c30
@ -1,23 +1,23 @@
|
|||||||
from .fight import Fight
|
from .fight import Fight
|
||||||
|
|
||||||
def check_folders():
|
# def check_folders():
|
||||||
if not os.path.exists("data/Fox-Cogs"):
|
# if not os.path.exists("data/Fox-Cogs"):
|
||||||
print("Creating data/Fox-Cogs folder...")
|
# print("Creating data/Fox-Cogs folder...")
|
||||||
os.makedirs("data/Fox-Cogs")
|
# os.makedirs("data/Fox-Cogs")
|
||||||
|
|
||||||
if not os.path.exists("data/Fox-Cogs/fight"):
|
# if not os.path.exists("data/Fox-Cogs/fight"):
|
||||||
print("Creating data/Fox-Cogs/fight folder...")
|
# print("Creating data/Fox-Cogs/fight folder...")
|
||||||
os.makedirs("data/Fox-Cogs/fight")
|
# os.makedirs("data/Fox-Cogs/fight")
|
||||||
|
|
||||||
|
|
||||||
def check_files():
|
# def check_files():
|
||||||
if not dataIO.is_valid_json("data/Fox-Cogs/fight/fight.json"):
|
# if not dataIO.is_valid_json("data/Fox-Cogs/fight/fight.json"):
|
||||||
dataIO.save_json("data/Fox-Cogs/fight/fight.json", {})
|
# dataIO.save_json("data/Fox-Cogs/fight/fight.json", {})
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
check_folders()
|
# check_folders()
|
||||||
check_files()
|
# check_files()
|
||||||
n = Fight(bot)
|
n = Fight(bot)
|
||||||
bot.add_cog(n)
|
bot.add_cog(n)
|
||||||
bot.add_listener(n._on_react, "on_reaction_add")
|
bot.add_listener(n._on_react, "on_reaction_add")
|
@ -1,12 +1,15 @@
|
|||||||
import os
|
import os
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from redbot.core.utils.chat_formatting import pagify
|
from redbot.core.utils.chat_formatting import pagify
|
||||||
from recbot.core.utils.chat_formatting import box
|
from redbot.core.utils.chat_formatting import box
|
||||||
from .utils.dataIO import dataIO #TODO
|
from redbot.core import Config
|
||||||
|
# from .utils.dataIO import dataIO #TODO
|
||||||
from redbot.core import checks
|
from redbot.core import checks
|
||||||
|
|
||||||
from random import randint
|
from random import randint
|
||||||
@ -23,9 +26,56 @@ class Fight:
|
|||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.path = "data/Fox-Cogs/fight/"
|
# self.path = "data/Fox-Cogs/fight/"
|
||||||
self.file_path = "data/Fox-Cogs/fight/fight.json"
|
# self.file_path = "data/Fox-Cogs/fight/fight.json"
|
||||||
self.the_data = dataIO.load_json(self.file_path)
|
# self.the_data = dataIO.load_json(self.file_path)
|
||||||
|
self.config = Config.get_conf(self,identifier=49564952847684)
|
||||||
|
default_global = {}
|
||||||
|
default_guild = {
|
||||||
|
"CURRENT": None,
|
||||||
|
"TOURNEYS": {},
|
||||||
|
"SETTINGS": {
|
||||||
|
"SELFREPORT": True,
|
||||||
|
"REPORTCHNNL": None,
|
||||||
|
"ANNOUNCECHNNL": None,
|
||||||
|
"ADMIN": None
|
||||||
|
},
|
||||||
|
"SRTRACKER": {
|
||||||
|
"ROUND": None,
|
||||||
|
"CHNNLS": None,
|
||||||
|
},
|
||||||
|
"EMOJI": {
|
||||||
|
"NUMS": [],
|
||||||
|
"UNDO": None,
|
||||||
|
"APPR": None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default_tourney = {
|
||||||
|
"PLAYERS": [],
|
||||||
|
"NAME": "Tourney 0",
|
||||||
|
"RULES": {"BESTOF": 1, "BESTOFFINAL": 1, "TYPE": 0},
|
||||||
|
"TYPEDATA": {},
|
||||||
|
"OPEN": False,
|
||||||
|
"WINNER": None
|
||||||
|
}
|
||||||
|
default_match = {
|
||||||
|
"TEAM1": [rPlayers[TeamCnt][0]],
|
||||||
|
"TEAM2": [rPlayers[TeamCnt][1]],
|
||||||
|
"SCORE1": 0,
|
||||||
|
"SCORE2": 0,
|
||||||
|
"USERSCORE1": {
|
||||||
|
"SCORE1": 0,
|
||||||
|
"SCORE2": 0
|
||||||
|
},
|
||||||
|
"USERSCORE2": {
|
||||||
|
"SCORE1": 0,
|
||||||
|
"SCORE2": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.config.register_guild(**default_guild)
|
||||||
|
self.config.register
|
||||||
|
|
||||||
|
|
||||||
def save_data(self):
|
def save_data(self):
|
||||||
"""Saves the json"""
|
"""Saves the json"""
|
||||||
@ -404,7 +454,7 @@ class Fight:
|
|||||||
await ctx.send("Self-Reporting ability is now set to: " + str(settings["SELFREPORT"]))
|
await ctx.send("Self-Reporting ability is now set to: " + str(settings["SELFREPORT"]))
|
||||||
|
|
||||||
@fightset_guild.command(name="reportchnnl")
|
@fightset_guild.command(name="reportchnnl")
|
||||||
async def fightset_guild_reportchnnl(self, ctx, channel: discord.Channel=None):
|
async def fightset_guild_reportchnnl(self, ctx, channel: discord.TextChannel=None):
|
||||||
"""Set the channel for self-reporting"""
|
"""Set the channel for self-reporting"""
|
||||||
#guild = ctx.message.guild
|
#guild = ctx.message.guild
|
||||||
|
|
||||||
@ -417,7 +467,7 @@ class Fight:
|
|||||||
await ctx.send("Self-Reporting Channel is now set to: " + channel.mention)
|
await ctx.send("Self-Reporting Channel is now set to: " + channel.mention)
|
||||||
|
|
||||||
@fightset_guild.command(name="announcechnnl")
|
@fightset_guild.command(name="announcechnnl")
|
||||||
async def fightset_guild_announcechnnl(self, ctx, channel: discord.Channel=None):
|
async def fightset_guild_announcechnnl(self, ctx, channel: discord.TextChannel=None):
|
||||||
"""Set the channel for tournament announcements"""
|
"""Set the channel for tournament announcements"""
|
||||||
#guild = ctx.message.guild
|
#guild = ctx.message.guild
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user