Update economy.py

Remove /refresh since API calls require human authorization
This commit is contained in:
Cal Corum 2023-04-25 01:42:54 -05:00
parent 37dbc87cc5
commit d3b775432c

View File

@ -1506,58 +1506,58 @@ class Economy(commands.Cog):
conf_message += f'\n\n{HELP_SHEET_SCRIPTS}'
await response.edit(content=f'{conf_message}')
@commands.hybrid_command(name='refresh', help='Refresh team data in Sheets')
@commands.has_any_role(PD_PLAYERS)
async def update_team(self, ctx):
if not await legal_channel(ctx):
await ctx.send(f'Slide on down to the {get_channel(ctx, "pd-bot-hole").mention} ;)')
return
team = get_team_by_owner(ctx.author.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!'
)
return
await refresh_sheet(team, self.bot)
await ctx.send(random_conf_gif())
# if abbrev and self.bot.is_owner(ctx.author):
# team = Team.get_season(abbrev[0])
# else:
# team = Team.get_by_owner(ctx.author.id)
# if not team:
# await ctx.send('Now you wait just a second. You don\'t have a team!')
# return
#
# # Get data from Sheets
# roster_data = await self.get_collection(ctx, team)
#
# # Cut any marked players
# comp_trade = True
# if len(roster_data['cut']) > 0:
# comp_trade = await self.cut_players(ctx, team, roster_data['cut'])
#
# if not comp_trade:
# return
#
# # Set new rostered list
# self.set_rostered_players(team, roster_data['rostered'])
#
# # Send current data to Sheets
# if not await self.write_collection(ctx, team, extra=len(roster_data['cut'])):
# logging.error(f'There was an issue trying to update the {team.sname} roster.')
# await helpers.pause_then_type(ctx, 'Yikes. I had an issue with Sheets. Send help.')
# else:
# await helpers.pause_then_type(ctx, 'Alrighty, your sheet is all up to date!')
# if team.logo:
# thumb = team.logo
# else:
# thumb = self.bot.get_user(team.gmid).avatar_url
# await ctx.send(content=None, embed=helpers.get_active_roster(team, thumb))
#
# db.close()
# @commands.hybrid_command(name='refresh', help='Refresh team data in Sheets')
# @commands.has_any_role(PD_PLAYERS)
# async def update_team(self, ctx):
# if not await legal_channel(ctx):
# await ctx.send(f'Slide on down to the {get_channel(ctx, "pd-bot-hole").mention} ;)')
# return
#
# team = get_team_by_owner(ctx.author.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!'
# )
# return
#
# await refresh_sheet(team, self.bot)
# await ctx.send(random_conf_gif())
#
# # if abbrev and self.bot.is_owner(ctx.author):
# # team = Team.get_season(abbrev[0])
# # else:
# # team = Team.get_by_owner(ctx.author.id)
# # if not team:
# # await ctx.send('Now you wait just a second. You don\'t have a team!')
# # return
# #
# # # Get data from Sheets
# # roster_data = await self.get_collection(ctx, team)
# #
# # # Cut any marked players
# # comp_trade = True
# # if len(roster_data['cut']) > 0:
# # comp_trade = await self.cut_players(ctx, team, roster_data['cut'])
# #
# # if not comp_trade:
# # return
# #
# # # Set new rostered list
# # self.set_rostered_players(team, roster_data['rostered'])
# #
# # # Send current data to Sheets
# # if not await self.write_collection(ctx, team, extra=len(roster_data['cut'])):
# # logging.error(f'There was an issue trying to update the {team.sname} roster.')
# # await helpers.pause_then_type(ctx, 'Yikes. I had an issue with Sheets. Send help.')
# # else:
# # await helpers.pause_then_type(ctx, 'Alrighty, your sheet is all up to date!')
# # if team.logo:
# # thumb = team.logo
# # else:
# # thumb = self.bot.get_user(team.gmid).avatar_url
# # await ctx.send(content=None, embed=helpers.get_active_roster(team, thumb))
# #
# # db.close()
@commands.hybrid_command(name='give-card', help='Mod: Give free card to team')
# @commands.is_owner()