Move daily command to app_command
This commit is contained in:
parent
bddc7144d9
commit
710d759d57
@ -509,15 +509,15 @@ class Economy(commands.Cog):
|
||||
|
||||
await display_cards(c_query['cards'], team, ctx.channel, ctx.author, self.bot, pack_cover=pack_cover)
|
||||
|
||||
@commands.hybrid_command(name='comeonmanineedthis', help='Daily check-in for cards, currency, and packs')
|
||||
@app_commands.command(name='comeonmanineedthis', description='Daily check-in for cards, currency, and packs')
|
||||
@commands.has_any_role(PD_PLAYERS)
|
||||
@commands.check(legal_channel)
|
||||
async def daily_checkin(self, ctx: commands.Context):
|
||||
team = await get_team_by_owner(ctx.author.id)
|
||||
async def daily_checkin(self, interaction: discord.Interaction):
|
||||
await interaction.response.defer()
|
||||
team = await get_team_by_owner(interaction.user.id)
|
||||
if not team:
|
||||
await ctx.send(
|
||||
f'I don\'t see a team for you, yet. You can sign up with the `/newteam` command!',
|
||||
ephemeral=True
|
||||
await interaction.edit_original_response(
|
||||
content=f'I don\'t see a team for you, yet. You can sign up with the `/newteam` command!'
|
||||
)
|
||||
return
|
||||
|
||||
@ -531,9 +531,8 @@ class Economy(commands.Cog):
|
||||
logging.debug(f'daily_return: {daily}')
|
||||
|
||||
if daily:
|
||||
await ctx.send(
|
||||
f'Looks like you already checked in today - come back at midnight Central!',
|
||||
ephemeral=True
|
||||
await interaction.edit_original_response(
|
||||
content=f'Looks like you already checked in today - come back at midnight Central!'
|
||||
)
|
||||
return
|
||||
|
||||
@ -548,26 +547,37 @@ class Economy(commands.Cog):
|
||||
|
||||
check_count = check_ins['count'] % 5
|
||||
|
||||
# TODO: complete the migration to an interaction
|
||||
# 2nd, 4th, and 5th check-ins
|
||||
if check_count == 0 or check_count % 2 == 0:
|
||||
# Every fifth check-in
|
||||
if check_count == 0:
|
||||
greeting = await ctx.send(f'Hey, you just earned a Standard pack of cards!')
|
||||
pack_channel = get_channel(ctx, 'pack-openings')
|
||||
greeting = await interaction.edit_original_response(
|
||||
content=f'Hey, you just earned a Standard pack of cards!'
|
||||
)
|
||||
pack_channel = get_channel(interaction, 'pack-openings')
|
||||
|
||||
p_query = await db_get('packtypes', params=[('name', 'Standard')])
|
||||
if not p_query:
|
||||
await ctx.send(f'I was not able to pull this pack for you. Maybe ping {get_cal_user(ctx).mention}?')
|
||||
await interaction.edit_original_response(
|
||||
content=f'I was not able to pull this pack for you. '
|
||||
f'Maybe ping {get_cal_user(interaction).mention}?'
|
||||
)
|
||||
return
|
||||
|
||||
# Every second and fourth check-in
|
||||
else:
|
||||
greeting = await ctx.send(f'Hey, you just earned a player card!')
|
||||
pack_channel = ctx.channel
|
||||
greeting = await interaction.edit_original_response(
|
||||
content=f'Hey, you just earned a player card!'
|
||||
)
|
||||
pack_channel = interaction.channel
|
||||
|
||||
p_query = await db_get('packtypes', params=[('name', 'Check-In Player')])
|
||||
if not p_query:
|
||||
await ctx.send(f'I was not able to pull this card for you. Maybe ping {get_cal_user(ctx).mention}?')
|
||||
await interaction.edit_original_response(
|
||||
content=f'I was not able to pull this card for you. '
|
||||
f'Maybe ping {get_cal_user(interaction).mention}?'
|
||||
)
|
||||
return
|
||||
|
||||
await give_packs(team, 1, p_query['packtypes'][0])
|
||||
@ -576,13 +586,14 @@ class Economy(commands.Cog):
|
||||
params=[('opened', False), ('team_id', team['id']), ('new_to_old', True), ('limit', 1)]
|
||||
)
|
||||
if not p_query['count']:
|
||||
await ctx.send(f'I do not see any packs in here. {await get_emoji(ctx, "ConfusedPsyduck")}')
|
||||
await interaction.edit_original_response(
|
||||
content=f'I do not see any packs in here. {await get_emoji(interaction, "ConfusedPsyduck")}')
|
||||
return
|
||||
|
||||
pack_ids = await roll_for_cards(p_query['packs'], extra_val=check_ins['count'])
|
||||
if not pack_ids:
|
||||
await greeting.edit(
|
||||
content=f'I was not able to create these cards {await get_emoji(ctx, "slight_frown")}'
|
||||
content=f'I was not able to create these cards {await get_emoji(interaction, "slight_frown")}'
|
||||
)
|
||||
return
|
||||
|
||||
@ -592,12 +603,12 @@ class Economy(commands.Cog):
|
||||
all_cards.extend(new_cards['cards'])
|
||||
|
||||
if not all_cards:
|
||||
await greeting.edit(
|
||||
content=f'I was not able to pull these cards {await get_emoji(ctx, "slight_frown")}'
|
||||
await interaction.edit_original_response(
|
||||
content=f'I was not able to pull these cards {await get_emoji(interaction, "slight_frown")}'
|
||||
)
|
||||
return
|
||||
|
||||
await display_cards(all_cards, team, pack_channel, ctx.author, self.bot)
|
||||
await display_cards(all_cards, team, pack_channel, interaction.user, self.bot)
|
||||
await refresh_sheet(team, self.bot)
|
||||
return
|
||||
|
||||
@ -616,7 +627,8 @@ class Economy(commands.Cog):
|
||||
m_reward = 25
|
||||
|
||||
team = await db_post(f'teams/{team["id"]}/money/{m_reward}')
|
||||
await ctx.send(f'You just earned {m_reward}₼! That brings your wallet to {team["wallet"]}₼!')
|
||||
await interaction.edit_original_response(
|
||||
content=f'You just earned {m_reward}₼! That brings your wallet to {team["wallet"]}₼!')
|
||||
|
||||
@app_commands.command(name='open-packs', description='Open packs from your inventory')
|
||||
@app_commands.checks.has_any_role(PD_PLAYERS)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user