88import aiohttp
99import async_timeout
1010import discord
11+ from discord import app_commands
1112from discord .ext import commands
12- from discord .utils import escape_markdown
1313
1414from dozer .context import DozerContext
1515from ._utils import *
@@ -58,28 +58,17 @@ async def req(self, endpoint):
5858 raise
5959
6060
61- class TOA (Cog ):
61+ class TOA (commands . Cog ):
6262 """TOA commands"""
6363
6464 def __init__ (self , bot : commands .Bot ):
65- super ().__init__ (bot )
65+ super ().__init__ ()
6666 self .http_session = bot .add_aiohttp_ses (aiohttp .ClientSession ())
6767 self .parser = TOAParser (bot .config ['toa' ]['key' ], self .http_session , app_name = bot .config ['toa' ]['app_name' ])
6868
69- @group (invoke_without_command = True )
70- async def toa (self , ctx : DozerContext , team_num : int ):
71- """
72- Get FTC-related information from The Orange Alliance.
73- If no subcommand is specified, the `team` subcommand is inferred, and the argument is taken as a team number.
74- """
75- await self .team .callback (self , ctx , team_num ) # This works but Pylint throws an error
76-
77- toa .example_usage = """
78- `{prefix}toa 5667` - show information on team 5667, Robominers
79- """
80-
81- @toa .command ()
69+ @commands .hybrid_command (name = "toateam" , aliases = ["toa" , "ftcteam" , "ftcteaminfo" ])
8270 @bot_has_permissions (embed_links = True )
71+ @app_commands .describe (team_num = "The team you want to see toa info about" )
8372 async def team (self , ctx : DozerContext , team_num : int ):
8473 """Get information on an FTC team by number."""
8574 res = json .loads (await self .parser .req ("team/" + str (team_num )))
@@ -98,7 +87,6 @@ async def team(self, ctx: DozerContext, team_num: int):
9887 value = ', ' .join ((team_data ['city' ], team_data ['state_prov' ], team_data ['country' ])))
9988 e .add_field (name = 'Website' , value = team_data ['website' ] or 'n/a' )
10089 e .add_field (name = 'Team Info Page' , value = f'https://theorangealliance.org/teams/{ team_data ["team_key" ]} ' )
101- e .set_footer (text = 'Triggered by ' + escape_markdown (ctx .author .display_name ))
10290 await ctx .send ('' , embed = e )
10391
10492 team .example_usage = """
0 commit comments