done except draft
This commit is contained in:
parent
99fd5b00a3
commit
7fbd793cf5
|
@ -1549,7 +1549,9 @@ class OBLLeaderboardCommand(Command):
|
|||
template = "m;oblstandings"
|
||||
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 = []
|
||||
rank = 1
|
||||
|
@ -1560,15 +1562,18 @@ class OBLLeaderboardCommand(Command):
|
|||
embed = discord.Embed(color=discord.Color.red(), title="The One Big League")
|
||||
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)
|
||||
await msg.channel.send(embed=embed)
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
||||
class OBLTeamCommand(Command):
|
||||
name = "oblteam"
|
||||
template = "m;oblteam [team name]"
|
||||
description = "Displays a team's rank, current OBL points, and current opponent selection."
|
||||
|
||||
async def execute(self, msg, command, flags):
|
||||
team = get_team_fuzzy_search(command.strip())
|
||||
@client.tree.command()
|
||||
@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:
|
||||
raise CommandError("Sorry boss, we can't find that team.")
|
||||
|
||||
|
@ -1597,37 +1602,41 @@ class OBLTeamCommand(Command):
|
|||
embed.set_footer(text="🔥")
|
||||
else:
|
||||
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):
|
||||
name = "oblrival"
|
||||
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."
|
||||
|
||||
async def execute(self, msg, command, flags):
|
||||
try:
|
||||
team_i = get_team_fuzzy_search(command.split("\n")[1].strip())
|
||||
team_r = get_team_fuzzy_search(command.split("\n")[2].strip())
|
||||
except IndexError:
|
||||
raise CommandError("You didn't give us enough lines. Command on the top, your team in the middle, and your rival at the bottom.")
|
||||
@client.tree.command()
|
||||
@app_commands.rename(owned_team_name="yourteam", rival_team_name="newrivalteam")
|
||||
async def oblsetrival(interaction, owned_team_name: str, rival_team_name: str):
|
||||
"""Sets your team's OBL rival. Can be changed at any time."""
|
||||
team_i = get_team_fuzzy_search(owned_team_name)
|
||||
team_r = get_team_fuzzy_search(rival_team_name)
|
||||
team, owner_id = games.get_team_and_owner(team_i.name)
|
||||
if team is None or team_r is None:
|
||||
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.")
|
||||
try:
|
||||
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:
|
||||
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):
|
||||
name = "oblwins"
|
||||
template = "m;oblwins [team name]"
|
||||
description = "Displays all teams that a given team has won points off of."
|
||||
|
||||
async def execute(self, msg, command, flags):
|
||||
team = get_team_fuzzy_search(command.strip())
|
||||
@client.tree.command()
|
||||
@app_commands.rename(team_name="team")
|
||||
async def oblconquestlist(interaction, team_name:str):
|
||||
team = get_team_fuzzy_search(team_name)
|
||||
if team is None:
|
||||
raise CommandError("Sorry boss, we can't find that team.")
|
||||
|
||||
|
@ -1651,32 +1660,30 @@ class OBLConqueredCommand(Command):
|
|||
break
|
||||
pages.append(embed)
|
||||
|
||||
teams_list = await msg.channel.send(embed=pages[0])
|
||||
teams_list = await interaction.channel.send(embed=pages[0])
|
||||
current_page = 0
|
||||
|
||||
if page_max > 1:
|
||||
await teams_list.add_reaction("◀")
|
||||
await teams_list.add_reaction("▶")
|
||||
|
||||
def react_check(react, user):
|
||||
return user == msg.author and react.message == teams_list
|
||||
def react_check(payload):
|
||||
return payload.user_id == interaction.user.id and payload.message_id == teams_list.id
|
||||
|
||||
while True:
|
||||
try:
|
||||
react, user = await client.wait_for('reaction_add', timeout=60.0, check=react_check)
|
||||
if react.emoji == "◀" and current_page > 0:
|
||||
payload = await client.wait_for('raw_reaction_add', timeout=60.0, check=react_check)
|
||||
if payload.emoji.name == "◀" and current_page > 0:
|
||||
current_page -= 1
|
||||
await react.remove(user)
|
||||
elif react.emoji == "▶" and current_page < (page_max-1):
|
||||
elif payload.emoji.name == "▶" and current_page < (page_max-1):
|
||||
current_page += 1
|
||||
await react.remove(user)
|
||||
await teams_list.edit(embed=pages[current_page])
|
||||
except asyncio.TimeoutError:
|
||||
return
|
||||
|
||||
class OBLResetCommand(Command):
|
||||
name = "oblreset"
|
||||
template = "m;oblreset"
|
||||
template = "m;oblreset [bot mention]"
|
||||
description = "NUKES THE OBL BOARD. BE CAREFUL."
|
||||
|
||||
def isauthorized(self, user):
|
||||
|
@ -1689,7 +1696,7 @@ class OBLResetCommand(Command):
|
|||
|
||||
class TeamsInfoCommand(Command):
|
||||
name = "teamcount"
|
||||
template = "m;teamcount"
|
||||
template = "m;teamcount [bot mention]"
|
||||
description = "Prints a readout of how many teams exist in the sim."
|
||||
|
||||
async def execute(self, msg, command, flags):
|
||||
|
@ -1699,7 +1706,7 @@ class TeamsInfoCommand(Command):
|
|||
commands = [
|
||||
IntroduceCommand(), #not needed
|
||||
CountActiveGamesCommand(), #owner only
|
||||
TeamsInfoCommand(),
|
||||
TeamsInfoCommand(), #workaround
|
||||
AssignOwnerCommand(), #owner only
|
||||
ShowPlayerCommand(), #done
|
||||
SaveTeamCommand(), #done
|
||||
|
@ -1718,12 +1725,12 @@ commands = [
|
|||
StartGameCommand(), #done
|
||||
StartRandomGameCommand(), #done
|
||||
StartTournamentCommand(), #workaround
|
||||
OBLExplainCommand(),
|
||||
OBLTeamCommand(),
|
||||
OBLSetRivalCommand(),
|
||||
OBLConqueredCommand(),
|
||||
OBLLeaderboardCommand(),
|
||||
OBLResetCommand(),
|
||||
OBLExplainCommand(), #done
|
||||
OBLTeamCommand(), #done
|
||||
OBLSetRivalCommand(), #done
|
||||
OBLConqueredCommand(), #done
|
||||
OBLLeaderboardCommand(), #done
|
||||
OBLResetCommand(), #not needed
|
||||
LeagueClaimCommand(), #done
|
||||
LeagueAddOwnersCommand(), #done
|
||||
LeagueSetPlayerModifiersCommand(), #was a test command, never fully tested
|
||||
|
|
Loading…
Reference in a new issue