Fix notifications and SUC gauntlet

This commit is contained in:
Cal Corum 2024-03-08 11:14:05 -06:00
parent f65ec66724
commit 04201be18c
4 changed files with 42 additions and 5 deletions

View File

@ -1,3 +1,5 @@
import copy
import helpers
from helpers import *
import logging
@ -210,16 +212,24 @@ class Economy(commands.Cog):
if x['field_name'] not in p_list:
p_list[x['field_name']] = {
'field_name': x['field_name'],
'message': f'{x["message"]}'
'message': f'{x["message"]}',
'count': 1
}
else:
p_list[x['field_name']]['message'] += f'\n{x["message"]}'
p_list[x['field_name']]['message'] = f'{x["message"]}'
p_list[x['field_name']]['count'] += 1
await db_patch('notifs', object_id=x['id'], params=[('ack', True)])
logging.debug(f'p_list: {p_list}')
this_embed = copy.deepcopy(embed)
counter = 1
for player in p_list:
embed.add_field(name=p_list[player]['field_name'], value=p_list[player]['message'], inline=False)
await send_to_channel(self.bot, topics[topic]['channel_name'], embed=embed)
if counter % 25 == 0:
counter = 1
await send_to_channel(self.bot, topics[topic]['channel_name'], embed=this_embed)
this_embed = copy.deepcopy(embed)
this_embed.add_field(
name=p_list[player]['field_name'], value=p_list[player]['message'], inline=False)
@notif_check.before_loop
async def before_notif_check(self):

View File

@ -872,7 +872,7 @@ class Players(commands.Cog):
)
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
async def gauntlet_run_command(
self, interaction: discord.Interaction, event_name: Literal['Taste of 2018'],
self, interaction: discord.Interaction, event_name: Literal['Taste of 2018', 'Super Ultra Championship'],
team_abbrev: str = None):
await interaction.response.defer()

View File

@ -135,6 +135,32 @@ async def get_opponent(this_team, this_event, this_run):
else:
raise KeyError(f'Huh...I have no idea who you should be playing right now.')
return await db_get('teams', object_id=t_id, none_okay=False)
elif this_event['id'] == 4:
if gp == 0:
t_id = 3
elif gp == 1:
t_id = 1
elif gp == 2:
t_id = 24
elif gp == 3:
t_id = 25
elif gp == 4:
t_id = 21
elif gp == 5:
t_id = 16
elif gp == 6:
t_id = 30
elif gp == 7:
t_id = 29
elif gp == 8:
t_id = 10
elif gp == 9:
t_id = 8
elif gp == 10:
t_id = 79
else:
raise KeyError(f'Hmm...I do not know who you should be playing right now.')
return await db_get('teams', object_id=t_id, none_okay=False)
else:
return None

View File

@ -98,6 +98,7 @@ IMAGES = {
'Texas Rangers': f'{PD_CARD_URL}/mvp/texas-rangers.gif',
'Toronto Blue Jays': f'{PD_CARD_URL}/mvp/toronto-blue-jays.gif',
'Washington Nationals': f'{PD_CARD_URL}/mvp/washington-nationals.gif',
'Junior All Stars': f'{PD_CARD_URL}/mvp.png'
},
'gauntlets': f'{PD_CARD_URL}/gauntlets.png'
}