Update players.py
Replace paperdex functions with new SelectMenu versions
This commit is contained in:
parent
90d89178f3
commit
cdb34e881f
@ -18,7 +18,7 @@ from db_calls import db_get, db_post, db_patch
|
|||||||
from helpers import PD_PLAYERS_ROLE_NAME, IMAGES, PD_SEASON, random_conf_gif, fuzzy_player_search, ALL_MLB_TEAMS, \
|
from helpers import PD_PLAYERS_ROLE_NAME, IMAGES, PD_SEASON, random_conf_gif, fuzzy_player_search, ALL_MLB_TEAMS, \
|
||||||
fuzzy_search, get_channel, display_cards, get_card_embeds, get_team_embed, cardset_search, get_blank_team_card, \
|
fuzzy_search, get_channel, display_cards, get_card_embeds, get_team_embed, cardset_search, get_blank_team_card, \
|
||||||
get_team_by_owner, get_rosters, get_roster_sheet, legal_channel, random_conf_word, embed_pagination, get_cal_user, \
|
get_team_by_owner, get_rosters, get_roster_sheet, legal_channel, random_conf_word, embed_pagination, get_cal_user, \
|
||||||
team_summary_embed, SelectView, SelectPaperdexCardset
|
team_summary_embed, SelectView, SelectPaperdexCardset, SelectPaperdexTeam
|
||||||
from typing import Optional, Literal
|
from typing import Optional, Literal
|
||||||
|
|
||||||
# date = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}'
|
# date = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}'
|
||||||
@ -551,61 +551,34 @@ class Players(commands.Cog):
|
|||||||
await interaction.response.send_message(f'Do you even have a team? I don\'t know you.', ephemeral=True)
|
await interaction.response.send_message(f'Do you even have a team? I don\'t know you.', ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
view = SelectView([SelectPaperdexCardset()], timeout=15)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=None,
|
content='You have 15 seconds to select a cardset.',
|
||||||
view=SelectView(SelectPaperdexCardset(), timeout=15),
|
view=view,
|
||||||
ephemeral=True
|
ephemeral=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# @commands.hybrid_group(name='paperdex', help='Check your collection counts')
|
await view.wait()
|
||||||
# @commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
await interaction.delete_original_response()
|
||||||
# @commands.check(legal_channel)
|
|
||||||
# async def paperdex_command(self, ctx: commands.Context):
|
@group_paperdex.command(name='team', description='Check your collection of a specific MLB franchise')
|
||||||
# if ctx.invoked_subcommand is None:
|
@commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
||||||
# await ctx.send(f'The available dex commands are: `cardset`')
|
@commands.check(legal_channel)
|
||||||
#
|
async def paperdex_cardset_slash(self, interaction: discord.Interaction):
|
||||||
# @paperdex_command.command(name='cardset', help='Check your collection of a specific cardset')
|
team = get_team_by_owner(interaction.user.id)
|
||||||
# @commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
if not team:
|
||||||
# @commands.check(legal_channel)
|
await interaction.response.send_message(f'Do you even have a team? I don\'t know you.', ephemeral=True)
|
||||||
# async def paperdex_cardset(
|
return
|
||||||
# self, ctx: commands.Context,
|
|
||||||
# cardset_name: Literal['2013 Season', '2019 Season', '2021 Season', '2022 Season', '2022 Promos',
|
view = SelectView([SelectPaperdexTeam('AL'), SelectPaperdexTeam('NL')], timeout=30)
|
||||||
# 'Sams Choice']):
|
await interaction.response.send_message(
|
||||||
# team = get_team_by_owner(ctx.author.id)
|
content='You have 30 seconds to select a team.',
|
||||||
#
|
view=view,
|
||||||
# c_query = db_get('cardsets', params=[('name', cardset_name)])
|
ephemeral=True
|
||||||
# if c_query['count'] == 0:
|
)
|
||||||
# await ctx.send(f'Ope, I couldn\'t find that cardset. {get_cal_user(ctx).mention} halp.')
|
|
||||||
# return
|
await view.wait()
|
||||||
# this_cardset = c_query['cardsets'][0]
|
await interaction.delete_original_response()
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# await embed_pagination(display_embeds, ctx.channel, ctx.author, timeout=30)
|
|
||||||
#
|
|
||||||
# @paperdex_command.command(name='team', help='Check your collection of a specific MLB team')
|
|
||||||
# @commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
|
||||||
# @commands.check(legal_channel)
|
|
||||||
# async def paperdex_team(self, ctx: commands.Context, team_name: str):
|
|
||||||
# await interaction.response.defer()
|
|
||||||
# team = get_team_by_owner(ctx.author.id)
|
|
||||||
#
|
|
||||||
# team_choice = None
|
|
||||||
# if team_name.title() in ALL_MLB_TEAMS.keys():
|
|
||||||
# team_choice = team_name.title()
|
|
||||||
# else:
|
|
||||||
# for x in ALL_MLB_TEAMS:
|
|
||||||
# if team_name.upper() in ALL_MLB_TEAMS[x] or team_name.title() in ALL_MLB_TEAMS[x]:
|
|
||||||
# team_choice = x
|
|
||||||
# break
|
|
||||||
#
|
|
||||||
# if not team_choice:
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# p_query = db_get('players', params=[('franchise', team_choice)])
|
|
||||||
# if p_query['count'] == 0:
|
|
||||||
# await ctx.send(f'Hmm...I don\'t see any players from the {team_choice}. What\'s up with that '
|
|
||||||
# f'{get_cal_user(ctx).mention}?')
|
|
||||||
|
|
||||||
@commands.hybrid_command(name='ai-teams', help='Get list of AI teams and abbreviations')
|
@commands.hybrid_command(name='ai-teams', help='Get list of AI teams and abbreviations')
|
||||||
@commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
@commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
||||||
@ -722,11 +695,6 @@ class Players(commands.Cog):
|
|||||||
|
|
||||||
await ctx.send(content=None, embed=embed)
|
await ctx.send(content=None, embed=embed)
|
||||||
|
|
||||||
# @paperdex_command.command(name='teams', help='Check your collection based on team')
|
|
||||||
# @commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
|
||||||
# @commands.check(legal_channel)
|
|
||||||
# async def paperdex_team(self, ctx: commands.Context, team_abbrev: Optional[str]):
|
|
||||||
|
|
||||||
@commands.hybrid_command(name='pullroster', help='Pull saved rosters from your team Sheet',
|
@commands.hybrid_command(name='pullroster', help='Pull saved rosters from your team Sheet',
|
||||||
aliases=['roster', 'rosters', 'pullrosters'])
|
aliases=['roster', 'rosters', 'pullrosters'])
|
||||||
@app_commands.describe(
|
@app_commands.describe(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user