This commit is contained in:
Elijah Steres 2021-01-10 01:23:31 -05:00
commit a9cd89d5ce
3 changed files with 22 additions and 8 deletions

View File

@ -70,12 +70,12 @@ accepting pull requests, check the issues for to-dos.
- use this command at the top of a list with entries separated by new lines: - use this command at the top of a list with entries separated by new lines:
- the away team's name. - the away team's name.
- the home team's name. - the home team's name.
- optionally, the number of innings, which must be greater than 2 and less than 31. if not included it will default to 9. - optionally, the number of innings, which must be greater than 2 and less than 201. if not included it will default to 9.
- this command has fuzzy search so you don't need to type the full name of the team as long as you give enough to identify the team you're looking for. - this command has fuzzy search so you don't need to type the full name of the team as long as you give enough to identify the team you're looking for.
- m;randomgame - m;randomgame
- starts a 9-inning game between 2 entirely random teams. embrace chaos! - starts a 9-inning game between 2 entirely random teams. embrace chaos!
- m;starttournament --rounddelay # - m;starttournament --rounddelay #
- starts a randomly seeded tournament with up to 64 provided teams, automatically adding byes as necessary. all series have a 5 minute break between games. the current format is: best of 5 until the finals which are best of 7. - starts a randomly seeded tournament with the provided teams, automatically adding byes as necessary. all series have a 5 minute break between games. the current format is: best of 5 until the finals which are best of 7.
- the --rounddelay is optional, if used, # must be between 1 and 120 and it'll set the delay between rounds to be # minutes. if not included it will default to 10. - the --rounddelay is optional, if used, # must be between 1 and 120 and it'll set the delay between rounds to be # minutes. if not included it will default to 10.
- use this command at the top of a list with entries separated by new lines: - use this command at the top of a list with entries separated by new lines:
- the name of the tournament. - the name of the tournament.
@ -98,6 +98,7 @@ these folks are helping me a *ton* via patreon, and i cannot possibly thank them
- Kameleon - Kameleon
- Ryan Littleton - Ryan Littleton
- Evie Diver - Evie Diver
- iliana etaoin
## Attribution ## Attribution

View File

@ -186,9 +186,13 @@ def get_user_player_conn(conn, user):
except TypeError: except TypeError:
return False return False
else: else:
print(conn) conn.close()
return False
except: except:
print(conn) conn.close()
return False
conn.close()
return False
def get_user_player(user): def get_user_player(user):
conn = create_connection() conn = create_connection()
@ -211,6 +215,8 @@ def save_team(name, team_json_string, user_id):
return False return False
except: except:
return False return False
conn.close()
return False
def update_team(name, team_json_string): def update_team(name, team_json_string):
conn = create_connection() conn = create_connection()
@ -225,7 +231,10 @@ def update_team(name, team_json_string):
conn.close() conn.close()
return False return False
except: except:
conn.close()
return False return False
conn.close()
return False
def get_team(name, owner=False): def get_team(name, owner=False):
conn = create_connection() conn = create_connection()
@ -258,6 +267,8 @@ def delete_team(team):
except: except:
conn.close() conn.close()
return False return False
conn.close()
return False
def assign_owner(team_name, owner_id): def assign_owner(team_name, owner_id):
conn = create_connection() conn = create_connection()
@ -271,6 +282,8 @@ def assign_owner(team_name, owner_id):
except: except:
conn.close() conn.close()
return False return False
conn.close()
return False
def get_all_teams(): def get_all_teams():
conn = create_connection() conn = create_connection()

View File

@ -119,10 +119,11 @@ class ShowPlayerCommand(Command):
class StartGameCommand(Command): class StartGameCommand(Command):
name = "startgame" name = "startgame"
template = "m;startgame [away] [home] [innings]" template = "m;startgame [away] [home] [innings]"
description ="""Starts a game with premade teams made using saveteam, use this command at the top of a list followed by each of these in a new line (shift+enter in discord, or copy+paste from notepad) (this command has fuzzy search so you don't need to type the full name of the team as long as you give enough to identify the team you're looking for.): description ="""Starts a game with premade teams made using saveteam, use this command at the top of a list followed by each of these in a new line (shift+enter in discord, or copy+paste from notepad):
- the away team's name. - the away team's name.
- the home team's name. - the home team's name.
- and finally, optionally, the number of innings, which must be greater than 2 and less than 31. if not included it will default to 9.""" - and finally, optionally, the number of innings, which must be greater than 2 and less than 201. if not included it will default to 9.
- this command has fuzzy search so you don't need to type the full name of the team as long as you give enough to identify the team you're looking for."""
async def execute(self, msg, command): async def execute(self, msg, command):
league = None league = None
@ -489,7 +490,6 @@ class AssignOwnerCommand(Command):
async def execute(self, msg, command): async def execute(self, msg, command):
new_owner = msg.mentions[0] new_owner = msg.mentions[0]
team_name = command.strip().split(new_owner.mention+" ")[1] team_name = command.strip().split(new_owner.mention+" ")[1]
print(team_name)
if db.assign_owner(team_name, new_owner.id): if db.assign_owner(team_name, new_owner.id):
await msg.channel.send(f"{team_name} is now owned by {new_owner.display_name}. Don't break it.") await msg.channel.send(f"{team_name} is now owned by {new_owner.display_name}. Don't break it.")
else: else:
@ -500,7 +500,7 @@ class StartTournamentCommand(Command):
template = """m;starttournament template = """m;starttournament
[tournament name] [tournament name]
[list of teams, each on a new line]""" [list of teams, each on a new line]"""
description = "Starts a randomly seeded tournament with up to 64 provided teams, automatically adding byes as necessary. All series have a 5 minute break between games and by default there is a 10 minute break between rounds. The current tournament format is:\nBest of 5 until the finals, which are Best of 7." description = "Starts a randomly seeded tournament with the provided teams, automatically adding byes as necessary. All series have a 5 minute break between games and by default there is a 10 minute break between rounds. The current tournament format is:\nBest of 5 until the finals, which are Best of 7."
async def execute(self, msg, command): async def execute(self, msg, command):
if config()["game_freeze"]: if config()["game_freeze"]: