done except draft
This commit is contained in:
parent
99fd5b00a3
commit
7fbd793cf5
|
@ -1549,7 +1549,9 @@ class OBLLeaderboardCommand(Command):
|
||||||
template = "m;oblstandings"
|
template = "m;oblstandings"
|
||||||
description = "Displays the 15 teams with the most OBL points in this meta-season."
|
description = "Displays the 15 teams with the most OBL points in this meta-season."
|
||||||
|
|
||||||
async def execute(self, msg, command, flags):
|
|
||||||
|
@client.tree.command()
|
||||||
|
async def oblstandings(interaction):
|
||||||
leaders_list = db.obl_leaderboards()[:15]
|
leaders_list = db.obl_leaderboards()[:15]
|
||||||
leaders = []
|
leaders = []
|
||||||
rank = 1
|
rank = 1
|
||||||
|
@ -1560,15 +1562,18 @@ class OBLLeaderboardCommand(Command):
|
||||||
embed = discord.Embed(color=discord.Color.red(), title="The One Big League")
|
embed = discord.Embed(color=discord.Color.red(), title="The One Big League")
|
||||||
for index in range(0, len(leaders)):
|
for index in range(0, len(leaders)):
|
||||||
embed.add_field(name=f"{index+1}. {leaders[index]['name']}", value=f"{leaders[index]['points']} points" , inline = False)
|
embed.add_field(name=f"{index+1}. {leaders[index]['name']}", value=f"{leaders[index]['points']} points" , inline = False)
|
||||||
await msg.channel.send(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
class OBLTeamCommand(Command):
|
class OBLTeamCommand(Command):
|
||||||
name = "oblteam"
|
name = "oblteam"
|
||||||
template = "m;oblteam [team name]"
|
template = "m;oblteam [team name]"
|
||||||
description = "Displays a team's rank, current OBL points, and current opponent selection."
|
description = "Displays a team's rank, current OBL points, and current opponent selection."
|
||||||
|
|
||||||
async def execute(self, msg, command, flags):
|
@client.tree.command()
|
||||||
team = get_team_fuzzy_search(command.strip())
|
@app_commands.rename(team_name="team")
|
||||||
|
async def oblteam(interaction, team_name):
|
||||||
|
"""Displays a team's rank, current OBL points, and current opponent selection."""
|
||||||
|
team = get_team_fuzzy_search(team_name)
|
||||||
if team is None:
|
if team is None:
|
||||||
raise CommandError("Sorry boss, we can't find that team.")
|
raise CommandError("Sorry boss, we can't find that team.")
|
||||||
|
|
||||||
|
@ -1597,37 +1602,41 @@ class OBLTeamCommand(Command):
|
||||||
embed.set_footer(text="🔥")
|
embed.set_footer(text="🔥")
|
||||||
else:
|
else:
|
||||||
embed.set_footer(text="Set a rival with m;oblrival!")
|
embed.set_footer(text="Set a rival with m;oblrival!")
|
||||||
await msg.channel.send(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
class OBLSetRivalCommand(Command):
|
class OBLSetRivalCommand(Command):
|
||||||
name = "oblrival"
|
name = "oblrival"
|
||||||
template = "m;oblrival\n[your team name]\n[rival team name]"
|
template = "m;oblrival\n[your team name]\n[rival team name]"
|
||||||
description = "Sets your team's OBL rival. Can be changed at any time. Requires ownership."
|
description = "Sets your team's OBL rival. Can be changed at any time. Requires ownership."
|
||||||
|
|
||||||
async def execute(self, msg, command, flags):
|
@client.tree.command()
|
||||||
try:
|
@app_commands.rename(owned_team_name="yourteam", rival_team_name="newrivalteam")
|
||||||
team_i = get_team_fuzzy_search(command.split("\n")[1].strip())
|
async def oblsetrival(interaction, owned_team_name: str, rival_team_name: str):
|
||||||
team_r = get_team_fuzzy_search(command.split("\n")[2].strip())
|
"""Sets your team's OBL rival. Can be changed at any time."""
|
||||||
except IndexError:
|
team_i = get_team_fuzzy_search(owned_team_name)
|
||||||
raise CommandError("You didn't give us enough lines. Command on the top, your team in the middle, and your rival at the bottom.")
|
team_r = get_team_fuzzy_search(rival_team_name)
|
||||||
team, owner_id = games.get_team_and_owner(team_i.name)
|
team, owner_id = games.get_team_and_owner(team_i.name)
|
||||||
if team is None or team_r is None:
|
if team is None or team_r is None:
|
||||||
raise CommandError("Can't find one of those teams, boss. Typo?")
|
raise CommandError("Can't find one of those teams, boss. Typo?")
|
||||||
elif owner_id != msg.author.id and msg.author.id not in config()["owners"]:
|
elif owner_id != interaction.user.id and interaction.user.id not in config()["owners"]:
|
||||||
raise CommandError("You're not authorized to mess with this team. Sorry, boss.")
|
raise CommandError("You're not authorized to mess with this team. Sorry, boss.")
|
||||||
try:
|
try:
|
||||||
db.set_obl_rival(team, team_r)
|
db.set_obl_rival(team, team_r)
|
||||||
await msg.channel.send("One pair of mortal enemies, coming right up. Unless you're more of the 'enemies to lovers' type. We can manage that too, don't worry.")
|
await interaction.response.send_message("One pair of mortal enemies, coming right up. Unless you're more of the 'enemies to lovers' type. We can manage that too, don't worry.")
|
||||||
except:
|
except:
|
||||||
raise CommandError("Hm. We don't think that team has tried to do anything in the One Big League yet, so you'll have to wait for consent. Get them to check their bounty board.")
|
raise CommandError("Hm. We don't think that team has tried to do anything in the One Big League yet, so you'll have to wait for consent. Get them to check their bounty board.")
|
||||||
|
|
||||||
|
|
||||||
class OBLConqueredCommand(Command):
|
class OBLConqueredCommand(Command):
|
||||||
name = "oblwins"
|
name = "oblwins"
|
||||||
template = "m;oblwins [team name]"
|
template = "m;oblwins [team name]"
|
||||||
description = "Displays all teams that a given team has won points off of."
|
description = "Displays all teams that a given team has won points off of."
|
||||||
|
|
||||||
async def execute(self, msg, command, flags):
|
@client.tree.command()
|
||||||
team = get_team_fuzzy_search(command.strip())
|
@app_commands.rename(team_name="team")
|
||||||
|
async def oblconquestlist(interaction, team_name:str):
|
||||||
|
team = get_team_fuzzy_search(team_name)
|
||||||
if team is None:
|
if team is None:
|
||||||
raise CommandError("Sorry boss, we can't find that team.")
|
raise CommandError("Sorry boss, we can't find that team.")
|
||||||
|
|
||||||
|
@ -1651,32 +1660,30 @@ class OBLConqueredCommand(Command):
|
||||||
break
|
break
|
||||||
pages.append(embed)
|
pages.append(embed)
|
||||||
|
|
||||||
teams_list = await msg.channel.send(embed=pages[0])
|
teams_list = await interaction.channel.send(embed=pages[0])
|
||||||
current_page = 0
|
current_page = 0
|
||||||
|
|
||||||
if page_max > 1:
|
if page_max > 1:
|
||||||
await teams_list.add_reaction("◀")
|
await teams_list.add_reaction("◀")
|
||||||
await teams_list.add_reaction("▶")
|
await teams_list.add_reaction("▶")
|
||||||
|
|
||||||
def react_check(react, user):
|
def react_check(payload):
|
||||||
return user == msg.author and react.message == teams_list
|
return payload.user_id == interaction.user.id and payload.message_id == teams_list.id
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
react, user = await client.wait_for('reaction_add', timeout=60.0, check=react_check)
|
payload = await client.wait_for('raw_reaction_add', timeout=60.0, check=react_check)
|
||||||
if react.emoji == "◀" and current_page > 0:
|
if payload.emoji.name == "◀" and current_page > 0:
|
||||||
current_page -= 1
|
current_page -= 1
|
||||||
await react.remove(user)
|
elif payload.emoji.name == "▶" and current_page < (page_max-1):
|
||||||
elif react.emoji == "▶" and current_page < (page_max-1):
|
|
||||||
current_page += 1
|
current_page += 1
|
||||||
await react.remove(user)
|
|
||||||
await teams_list.edit(embed=pages[current_page])
|
await teams_list.edit(embed=pages[current_page])
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
return
|
return
|
||||||
|
|
||||||
class OBLResetCommand(Command):
|
class OBLResetCommand(Command):
|
||||||
name = "oblreset"
|
name = "oblreset"
|
||||||
template = "m;oblreset"
|
template = "m;oblreset [bot mention]"
|
||||||
description = "NUKES THE OBL BOARD. BE CAREFUL."
|
description = "NUKES THE OBL BOARD. BE CAREFUL."
|
||||||
|
|
||||||
def isauthorized(self, user):
|
def isauthorized(self, user):
|
||||||
|
@ -1689,7 +1696,7 @@ class OBLResetCommand(Command):
|
||||||
|
|
||||||
class TeamsInfoCommand(Command):
|
class TeamsInfoCommand(Command):
|
||||||
name = "teamcount"
|
name = "teamcount"
|
||||||
template = "m;teamcount"
|
template = "m;teamcount [bot mention]"
|
||||||
description = "Prints a readout of how many teams exist in the sim."
|
description = "Prints a readout of how many teams exist in the sim."
|
||||||
|
|
||||||
async def execute(self, msg, command, flags):
|
async def execute(self, msg, command, flags):
|
||||||
|
@ -1699,7 +1706,7 @@ class TeamsInfoCommand(Command):
|
||||||
commands = [
|
commands = [
|
||||||
IntroduceCommand(), #not needed
|
IntroduceCommand(), #not needed
|
||||||
CountActiveGamesCommand(), #owner only
|
CountActiveGamesCommand(), #owner only
|
||||||
TeamsInfoCommand(),
|
TeamsInfoCommand(), #workaround
|
||||||
AssignOwnerCommand(), #owner only
|
AssignOwnerCommand(), #owner only
|
||||||
ShowPlayerCommand(), #done
|
ShowPlayerCommand(), #done
|
||||||
SaveTeamCommand(), #done
|
SaveTeamCommand(), #done
|
||||||
|
@ -1718,12 +1725,12 @@ commands = [
|
||||||
StartGameCommand(), #done
|
StartGameCommand(), #done
|
||||||
StartRandomGameCommand(), #done
|
StartRandomGameCommand(), #done
|
||||||
StartTournamentCommand(), #workaround
|
StartTournamentCommand(), #workaround
|
||||||
OBLExplainCommand(),
|
OBLExplainCommand(), #done
|
||||||
OBLTeamCommand(),
|
OBLTeamCommand(), #done
|
||||||
OBLSetRivalCommand(),
|
OBLSetRivalCommand(), #done
|
||||||
OBLConqueredCommand(),
|
OBLConqueredCommand(), #done
|
||||||
OBLLeaderboardCommand(),
|
OBLLeaderboardCommand(), #done
|
||||||
OBLResetCommand(),
|
OBLResetCommand(), #not needed
|
||||||
LeagueClaimCommand(), #done
|
LeagueClaimCommand(), #done
|
||||||
LeagueAddOwnersCommand(), #done
|
LeagueAddOwnersCommand(), #done
|
||||||
LeagueSetPlayerModifiersCommand(), #was a test command, never fully tested
|
LeagueSetPlayerModifiersCommand(), #was a test command, never fully tested
|
||||||
|
|
Loading…
Reference in a new issue