1109 lines
50 KiB
Python
1109 lines
50 KiB
Python
import copy
|
|
import datetime
|
|
import logging
|
|
import re
|
|
|
|
import discord
|
|
import pygsheets
|
|
import requests
|
|
|
|
from helpers import *
|
|
from db_calls import *
|
|
from discord import Member
|
|
from discord.ext import commands, tasks
|
|
from discord import app_commands
|
|
from difflib import get_close_matches
|
|
|
|
# date = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}'
|
|
# logging.basicConfig(
|
|
# filename=f'logs/{date}.log',
|
|
# format='%(asctime)s - %(levelname)s - %(message)s',
|
|
# level=logging.WARNING
|
|
# )
|
|
|
|
|
|
class Admins(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
self.weekly_reset_done = False
|
|
|
|
# async def cog_load(self):
|
|
# await self.bot.change_presence(activity=discord.Game(name='strat | .help'))
|
|
|
|
async def cog_command_error(self, ctx, error):
|
|
await ctx.send(f'{error}')
|
|
|
|
# @tasks.loop(minutes=10)
|
|
# async def weekly_loop(self):
|
|
# now = datetime.datetime.now()
|
|
# if now.hour == 6 and now.weekday() == 0 and not self.weekly_reset_done:
|
|
# weekly_packs = await self.increment_week()
|
|
# self.weekly_reset_done = True
|
|
#
|
|
# sba = self.bot.get_guild(613880856032968834)
|
|
# news_ticker = discord.utils.get(sba.text_channels, name='pd-news-ticker')
|
|
# await news_ticker.send('The new week is here! Run `.comeonmanineedthis` for your weekly pack!\n\n'
|
|
# 'Cal will hand out packs for the final standings when he wakes his lazy ass up. ')
|
|
#
|
|
# cal_private = discord.utils.get(sba.text_channels, name='hello-manticorum67')
|
|
# await cal_private.send(f'Weekly packs:\n\n{weekly_packs}')
|
|
#
|
|
# if now.weekday() != 0 and self.weekly_reset_done:
|
|
# self.weekly_reset_done = False
|
|
#
|
|
# db.close()
|
|
|
|
# @staticmethod
|
|
# async def increment_week():
|
|
# current = Current.get()
|
|
# current.week += 1
|
|
# current.save()
|
|
#
|
|
# weekly_string = ''
|
|
# all_teams = Team.select()
|
|
# for x in all_teams:
|
|
# weekly_string += f'{x.sname}: {x.weeklypacks} packs\n'
|
|
# x.weeklyclaim = False
|
|
# x.dailyclaim = False
|
|
# x.weeklypacks = 0
|
|
# x.save()
|
|
#
|
|
# return weekly_string
|
|
|
|
group_give = app_commands.Group(name='give', description='Mod: Distribute packs or tokens')
|
|
|
|
@group_give.command(name='packs')
|
|
async def give_packs_subcommand(
|
|
self, interaction: discord.Interaction, num_packs: int, pack_type: Literal['Standard', 'Premium', 'MVP'],
|
|
team_abbrevs: str):
|
|
if not owner_only(interaction):
|
|
await interaction.response.send_message(random_no_gif())
|
|
return
|
|
|
|
current = db_get('current')
|
|
await interaction.response.defer()
|
|
p_query = db_get('packtypes', params=[('name', pack_type)])
|
|
|
|
response = ''
|
|
for x in team_abbrevs.split(' '):
|
|
team = db_get('teams', params=[('abbrev', x), ('season', current['season'])])['teams'][0]
|
|
|
|
if team:
|
|
total_packs = give_packs(team, num_packs, pack_type=p_query['packtypes'][0])
|
|
response += f'Just gave {num_packs} {pack_type} pack{"s" if num_packs > 1 else ""} to the ' \
|
|
f'{team["sname"]}. They now have {total_packs["count"]} ' \
|
|
f'pack{"s" if total_packs["count"] > 1 else ""}.\n'
|
|
|
|
elif x.upper() == 'LEAGUE':
|
|
all_teams = db_get('teams', params=[('season', current['season'])])
|
|
for y in all_teams['teams']:
|
|
logging.warning(f'Giving {num_packs} pack(s) to team: {y["abbrev"]}')
|
|
give_packs(team, num_packs)
|
|
response = f'Just gave all {all_teams["count"]} teams {num_packs} ' \
|
|
f'standard pack{"s" if num_packs > 1 else ""}!'
|
|
|
|
else:
|
|
await interaction.edit_original_response(content=f'Hmm...I\'m not sure who **{x.upper()}** is.')
|
|
return
|
|
|
|
logging.info(f'give info: {response}')
|
|
await interaction.edit_original_response(content=f'{response if len(response) > 0 else "All done!"}')
|
|
|
|
@commands.hybrid_command(name='post-guide', help='Mod: Post the ratings guide to team sheet')
|
|
@commands.is_owner()
|
|
async def post_guide_command(self, ctx, gm: Member):
|
|
team = get_team_by_owner(gm.id)
|
|
db_patch('teams', object_id=team['id'], params=[('has_guide', True)])
|
|
|
|
post_ratings_guide(team, self.bot)
|
|
|
|
await ctx.send(random_conf_gif())
|
|
|
|
@commands.hybrid_command(name='sync-sheets', help='Mod: Sync AI team sheets')
|
|
@commands.is_owner()
|
|
async def sync_sheets_command(self, ctx):
|
|
t_query = db_get('teams', params=[('is_ai', True)])
|
|
|
|
response = await ctx.send(f'Alright, I\'m getting started...')
|
|
|
|
sheets = get_sheets(self.bot)
|
|
for count, team in enumerate(t_query['teams']):
|
|
this_sheet = sheets.open_by_key(team['gsheet'])
|
|
team_data = this_sheet.worksheet_by_title('Team Data')
|
|
team_data.update_values(
|
|
crange='B1:B2',
|
|
values=[[f'{team["id"]}'], [f'\'{team_hash(team)}']]
|
|
)
|
|
await response.edit(content=f'Just finished the {team["sname"]} ({count + 1}/{len(t_query["teams"])})...')
|
|
|
|
await response.edit(content=f'All done!')
|
|
|
|
@commands.hybrid_command(name='update-rarity', help='Mod: Pull current rarities and update players')
|
|
@commands.is_owner()
|
|
async def update_rarity_command(self, ctx, sheet_url: str):
|
|
await ctx.send(f'Oh boy, here I go sheetsing again!')
|
|
|
|
# Template:
|
|
# https://docs.google.com/spreadsheets/d/14FpNo2JOmAKc7rdeiEGNUOud_gbLSrlcoic-OXlhsQc/edit#gid=1845561581
|
|
sheets = get_sheets(self.bot)
|
|
this_sheet = sheets.open_by_url(sheet_url)
|
|
logging.info(f'this_sheet: {this_sheet}')
|
|
up_sheet = this_sheet.worksheet_by_title('Rarity Updates')
|
|
logging.info(f'up_sheet: {up_sheet}')
|
|
all_players = up_sheet.range('A2:E')
|
|
# logging.info(f'all_players: {all_players}')
|
|
rarities = {
|
|
'MVP': 1,
|
|
'All-Star': 2,
|
|
'Starter': 3,
|
|
'Reserve': 4,
|
|
'Replacement': 5,
|
|
'Hall of Fame': 99
|
|
}
|
|
|
|
def new_cost(player, new_rarity, old_rarity):
|
|
old_cost = player['cost']
|
|
old_rarity = old_rarity
|
|
new_rarity = new_rarity
|
|
logging.info(f'old_rarity: {old_rarity} / new_rarity: {new_rarity}')
|
|
|
|
if old_rarity == 1:
|
|
if new_rarity == 2:
|
|
return max(old_cost - 540, 100)
|
|
elif new_rarity == 3:
|
|
return max(old_cost - 720, 50)
|
|
elif new_rarity == 4:
|
|
return max(old_cost - 780, 15)
|
|
elif new_rarity == 5:
|
|
return max(old_cost - 800, 5)
|
|
elif old_rarity == 2:
|
|
if new_rarity == 1:
|
|
return old_cost + 540
|
|
elif new_rarity == 3:
|
|
return max(old_cost - 180, 50)
|
|
elif new_rarity == 4:
|
|
return max(old_cost - 240, 15)
|
|
elif new_rarity == 5:
|
|
return max(old_cost - 260, 5)
|
|
elif old_rarity == 3:
|
|
if new_rarity == 1:
|
|
return old_cost + 720
|
|
elif new_rarity == 2:
|
|
return old_cost + 180
|
|
elif new_rarity == 4:
|
|
return max(old_cost - 60, 15)
|
|
elif new_rarity == 5:
|
|
return max(old_cost - 80, 5)
|
|
elif old_rarity == 4:
|
|
if new_rarity == 1:
|
|
return old_cost + 780
|
|
elif new_rarity == 2:
|
|
return old_cost + 240
|
|
elif new_rarity == 3:
|
|
return old_cost + 60
|
|
elif new_rarity == 5:
|
|
return max(old_cost - 20, 5)
|
|
elif old_rarity == 5:
|
|
if new_rarity == 1:
|
|
return old_cost + 800
|
|
elif new_rarity == 2:
|
|
return old_cost + 260
|
|
elif new_rarity == 3:
|
|
return old_cost + 80
|
|
elif new_rarity == 4:
|
|
return old_cost + 20
|
|
|
|
raise KeyError(f'Could not find a cost update for {player["p_name"]} from {player["rarity"]["name"]} to '
|
|
f'{new_rarity}')
|
|
|
|
player_id = 804
|
|
errors = []
|
|
new_players = []
|
|
done = 0
|
|
for line in all_players:
|
|
# logging.info(f'line: {line}')
|
|
if line[4].value == 'CHANGE':
|
|
try:
|
|
logging.info(f'Updating {line[1].value}')
|
|
this_player = db_get('players', object_id=line[0].value)
|
|
|
|
logging.info(f'this_player: {this_player["p_name"]}')
|
|
new_player = copy.deepcopy(this_player)
|
|
new_player['player_id'] = player_id + done
|
|
logging.info(f'new_player: {new_player["player_id"]}')
|
|
new_player['image'] = new_player['image'].replace("-launch", "-launch/update01")
|
|
new_player['rarity_id'] = rarities[line[3].value]
|
|
# new_player['cardset_id'] = 3
|
|
new_player['cost'] = new_cost(this_player, rarities[line[3].value], rarities[line[2].value])
|
|
logging.info(f'new_player cost: {new_player["cost"]}')
|
|
|
|
this_player = db_patch('players', object_id=this_player['player_id'], params=[
|
|
('cost', new_player['cost'])
|
|
])
|
|
logging.info(f'patched_player: {this_player["p_name"]} / cardset: {this_player["cardset"]["id"]}')
|
|
# new_players.append(new_player)
|
|
|
|
# new_player = db_patch('players', object_id=this_player['player_id'], params=[
|
|
# ('image', this_player['image'].replace("-launch", "-launch/update01")),
|
|
# ('rarity_id', rarities[line[3].value]), ('cost', new_cost(this_player, rarities[line[3].value]))
|
|
# ])
|
|
done += 1
|
|
except Exception as e:
|
|
e_message = f'{line[1].value}: {e}'
|
|
logging.error(e_message)
|
|
errors.append(e_message)
|
|
|
|
db_post('players', payload={'players': new_players})
|
|
await ctx.send(f'Updated {done} players!')
|
|
if len(errors) > 0:
|
|
e_string = "\n- ".join(errors)
|
|
await ctx.send(f'I encountered the following errors:\n\n{e_string}')
|
|
|
|
# @app_commands.command(name='tc', description='Mod: Test choice function')
|
|
# async def test_choices_command(self, interaction: discord.Interaction):
|
|
# await interaction.response.send_message(f'Let\'s test this function!')
|
|
# pl = db_get('players/random', params=[
|
|
# ('min_rarity', 5), ('max_rarity', 5), ('limit', 4)
|
|
# ])
|
|
# if pl['count']:
|
|
# players = pl['players']
|
|
# else:
|
|
# raise ConnectionError(f'Could not create MVP pack')
|
|
#
|
|
# def p_callback(player):
|
|
# db_get('players', object_id=player['player_id'])
|
|
#
|
|
# choice = await get_choice_from_cards(
|
|
# interaction, players, callback=p_callback, temp_message='Hello!', conf_message='All done - great choice!'
|
|
# )
|
|
# await interaction.edit_original_response(content=f'The choice was: {choice}')
|
|
|
|
# @commands.command(name='refresh')
|
|
# @commands.is_owner()
|
|
# async def import_players(self, ctx):
|
|
# rarities = {'MVP': 10, 'All-Star': 7, 'Starter': 5, 'Reserve': 3, 'Replacement': 0}
|
|
# war_vals = {
|
|
# 'SP': {'MVP': 7.5, 'All-Star': 5.5, 'Starter': 3.5, 'Reserve': 1.5},
|
|
# 'RP': {'MVP': 7.5, 'All-Star': 5.5, 'Starter': 3.5, 'Reserve': 1.5},
|
|
# 'Pos': {'MVP': 7.5, 'All-Star': 5.5, 'Starter': 3.5, 'Reserve': 1.5},
|
|
# 'Park': {'MVP': 4, 'All-Star': 3, 'Starter': 2, 'Reserve': 1}
|
|
# }
|
|
# for x in rarities.keys():
|
|
# check_rar = Rarity.get_or_none(Rarity.name == x)
|
|
# if not check_rar:
|
|
# new_rar = Rarity(value=rarities[x], name=x)
|
|
# new_rar.save()
|
|
#
|
|
# curr = Current.get_or_none()
|
|
# if not curr:
|
|
# new_curr = Current(season=2, week=1, packlimit=6)
|
|
# new_curr.save()
|
|
#
|
|
# await ctx.send('Let me go check the data sheet...')
|
|
#
|
|
# # Get data from Sheets
|
|
# async with ctx.typing():
|
|
# sheets = pygsheets.authorize(service_file='storage/paper-dynasty-service-creds.json')
|
|
# try:
|
|
# data_sheet = sheets.open_by_key('1amZzO8Fm4RN8QD5j-WVdp5XqSw54fU7CT8mummzN3Z4').\
|
|
# worksheet_by_title('Player Import')
|
|
# raw_data = data_sheet.get_values('A2', 'P10000')
|
|
# except Exception as e:
|
|
# logging.error(f'{e}')
|
|
# await ctx.send(f'Yikes. I need a grown-up to read this. I don\'t know what it means:\n\n{e}')
|
|
# return
|
|
# else:
|
|
# await ctx.send(f'Noice - got it! Give me a minute to go through this data...')
|
|
#
|
|
# tba_players = []
|
|
# async with ctx.typing():
|
|
# for row in raw_data:
|
|
# if row[0] != '':
|
|
# name = row[0]
|
|
# cardset = row[2]
|
|
#
|
|
# this_guy = Player.get_or_none((Player.name == name) & (Player.cardset == cardset))
|
|
# flag = False
|
|
# if not this_guy:
|
|
# mlbclub = row[1]
|
|
# cardset = row[2]
|
|
# wara = float(row[3])
|
|
# primary = row[4]
|
|
# url = row[5]
|
|
# franchise = row[15]
|
|
# if row[6] != '':
|
|
# url2 = row[6]
|
|
# else:
|
|
# url2 = None
|
|
# if row[7] != '':
|
|
# pos1 = row[7]
|
|
# else:
|
|
# pos1 = None
|
|
# if row[8] != '':
|
|
# pos2 = row[8]
|
|
# else:
|
|
# pos2 = None
|
|
# if row[9] != '':
|
|
# pos3 = row[9]
|
|
# else:
|
|
# pos3 = None
|
|
# if row[10] != '':
|
|
# pos4 = row[10]
|
|
# else:
|
|
# pos4 = None
|
|
# if row[11] != '':
|
|
# pos5 = row[11]
|
|
# else:
|
|
# pos5 = None
|
|
# if row[12] != '':
|
|
# pos6 = row[12]
|
|
# else:
|
|
# pos6 = None
|
|
# if row[13] != '':
|
|
# pos7 = row[13]
|
|
# else:
|
|
# pos7 = None
|
|
# if row[14] != '':
|
|
# pos8 = row[14]
|
|
# else:
|
|
# pos8 = None
|
|
#
|
|
# rarity = Rarity.get(Rarity.name == 'Replacement')
|
|
#
|
|
# if primary == 'RP':
|
|
# if wara >= war_vals['RP']['MVP']:
|
|
# rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# elif wara >= war_vals['RP']['All-Star']:
|
|
# rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# elif wara >= war_vals['RP']['Starter']:
|
|
# rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# elif wara > war_vals['RP']['Reserve']:
|
|
# rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# elif primary == 'SP':
|
|
# if wara >= war_vals['SP']['MVP']:
|
|
# rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# elif wara >= war_vals['SP']['All-Star']:
|
|
# rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# elif wara >= war_vals['SP']['Starter']:
|
|
# rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# elif wara > war_vals['SP']['Reserve']:
|
|
# rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# elif primary == 'Park':
|
|
# if wara >= war_vals['Park']['MVP']:
|
|
# rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# elif wara >= war_vals['Park']['All-Star']:
|
|
# rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# elif wara >= war_vals['Park']['Starter']:
|
|
# rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# elif wara > war_vals['Park']['Reserve']:
|
|
# rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# else:
|
|
# if wara >= war_vals['Pos']['MVP']:
|
|
# rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# elif wara >= war_vals['Pos']['All-Star']:
|
|
# rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# elif wara >= war_vals['Pos']['Starter']:
|
|
# rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# elif wara > war_vals['Pos']['Reserve']:
|
|
# rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
#
|
|
# tba_players.append({
|
|
# 'name': name,
|
|
# 'mlbclub': mlbclub,
|
|
# 'cardset': cardset,
|
|
# 'rarity': rarity,
|
|
# 'wara': wara,
|
|
# 'primary': primary,
|
|
# 'url': url,
|
|
# 'url2': url2,
|
|
# 'pos1': pos1,
|
|
# 'pos2': pos2,
|
|
# 'pos3': pos3,
|
|
# 'pos4': pos4,
|
|
# 'pos5': pos5,
|
|
# 'pos6': pos6,
|
|
# 'pos7': pos7,
|
|
# 'pos8': pos8,
|
|
# 'franchise': franchise
|
|
# })
|
|
# else:
|
|
# flag = False
|
|
# if row[8] != '':
|
|
# flag = True
|
|
# this_guy.pos2 = row[8]
|
|
# if row[9] != '':
|
|
# flag = True
|
|
# this_guy.pos3 = row[9]
|
|
# if row[10] != '':
|
|
# flag = True
|
|
# this_guy.pos4 = row[10]
|
|
# if row[11] != '':
|
|
# flag = True
|
|
# this_guy.pos5 = row[11]
|
|
# if row[12] != '':
|
|
# flag = True
|
|
# this_guy.pos6 = row[12]
|
|
# if row[13] != '':
|
|
# flag = True
|
|
# this_guy.pos7 = row[13]
|
|
# if row[14] != '':
|
|
# flag = True
|
|
# this_guy.pos8 = row[14]
|
|
#
|
|
# if flag:
|
|
# this_guy.save()
|
|
# flag = False
|
|
#
|
|
# # if this_guy.mlbclub != row[1]:
|
|
# # upd_players.append(f'{this_guy.name} mlbclub: {this_guy.mlbclub} to {row[1]}\n')
|
|
# # this_guy.mlbclub = row[1]
|
|
# # flag = True
|
|
# # if this_guy.wara != float(row[3]):
|
|
# # upd_players.append(f'{this_guy.name} wara: {this_guy.wara} to {row[3]}\n')
|
|
# # this_guy.wara = float(row[3])
|
|
# # flag = True
|
|
# # if this_guy.primary != row[4]:
|
|
# # upd_players.append(f'{this_guy.name} primary: {this_guy.primary} to {row[4]}\n')
|
|
# # this_guy.primary = row[4]
|
|
# # flag = True
|
|
# # if this_guy.url != row[5]:
|
|
# # upd_players.append(f'{this_guy.name} url updated\n')
|
|
# # this_guy.url = row[5]
|
|
# # flag = True
|
|
# # temp_url2 = None if row[6] == '' else row[6]
|
|
# # if this_guy.url2 != temp_url2:
|
|
# # upd_players.append(f'{this_guy.name} url2 updated\n')
|
|
# # this_guy.url2 = temp_url2
|
|
# # flag = True
|
|
# # if this_guy.pos1 != row[7]:
|
|
# # upd_players.append(f'{this_guy.name} pos1: {this_guy.pos1} to {row[7]}\n')
|
|
# # this_guy.pos1 = row[7]
|
|
# # flag = True
|
|
# # rarity = Rarity.get(Rarity.name == 'Replacement')
|
|
# #
|
|
# # if this_guy.primary == 'RP':
|
|
# # if this_guy.wara >= war_vals['RP']['MVP']:
|
|
# # rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# # elif this_guy.wara >= war_vals['RP']['All-Star']:
|
|
# # rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# # elif this_guy.wara >= war_vals['RP']['Starter']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# # elif this_guy.wara > war_vals['RP']['Reserve']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# # elif this_guy.primary == 'SP':
|
|
# # if this_guy.wara >= war_vals['SP']['MVP']:
|
|
# # rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# # elif this_guy.wara >= war_vals['SP']['All-Star']:
|
|
# # rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# # elif this_guy.wara >= war_vals['SP']['Starter']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# # elif this_guy.wara > war_vals['SP']['Reserve']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# # elif this_guy.primary == 'Park':
|
|
# # if this_guy.wara >= war_vals['Park']['MVP']:
|
|
# # rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# # elif this_guy.wara >= war_vals['Park']['All-Star']:
|
|
# # rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# # elif this_guy.wara >= war_vals['Park']['Starter']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# # elif this_guy.wara > war_vals['Park']['Reserve']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# # else:
|
|
# # if this_guy.wara >= war_vals['Pos']['MVP']:
|
|
# # rarity = Rarity.get(Rarity.name == 'MVP')
|
|
# # elif this_guy.wara >= war_vals['Pos']['All-Star']:
|
|
# # rarity = Rarity.get(Rarity.name == 'All-Star')
|
|
# # elif this_guy.wara >= war_vals['Pos']['Starter']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Starter')
|
|
# # elif this_guy.wara > war_vals['Pos']['Reserve']:
|
|
# # rarity = Rarity.get(Rarity.name == 'Reserve')
|
|
# #
|
|
# # if this_guy.rarity != rarity:
|
|
# # upd_players.append(f'{this_guy.name} rarity: {this_guy.rarity.name} to {rarity.name}\n')
|
|
# # this_guy.rarity = rarity
|
|
# # flag = True
|
|
# #
|
|
# # if flag:
|
|
# # this_guy.save()
|
|
# # flag = False
|
|
#
|
|
# with db.atomic():
|
|
# try:
|
|
# for batch in chunked(tba_players, 20):
|
|
# Player.insert_many(batch).execute()
|
|
# except Exception as e:
|
|
# logging.error(f'(import_players): {e}')
|
|
# await ctx.send(f'Oof, I ran into an issue importing those players. '
|
|
# f'This might be ugly:\n\n{e}')
|
|
# db.close()
|
|
# return
|
|
#
|
|
# num_players = Player.select().count()
|
|
# await ctx.send(f'Alright, I have {num_players} players in the database.\n'
|
|
# f'I added {len(tba_players)} new players.\n')
|
|
#
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='rebalance')
|
|
# @commands.is_owner()
|
|
# async def rebalance_command(self, ctx, pos, url_key, allow_new: bool = False):
|
|
# await ctx.send('Let me go check the data sheet...')
|
|
# if pos.upper() in ['SP', 'RP', 'POS']:
|
|
# sheet_title = f'{pos.upper()} Updates'
|
|
# else:
|
|
# await helpers.react_and_reply(ctx, '❌', 'I can only take SP, RP, or POS for position.')
|
|
# return
|
|
#
|
|
# # Get data from Sheets
|
|
# async with ctx.typing():
|
|
# sheets = pygsheets.authorize(service_file='storage/paper-dynasty-service-creds.json')
|
|
# data_sheet = sheets.open_by_key(url_key).worksheet_by_title(sheet_title)
|
|
# raw_data = data_sheet.get_values('A3', 'P10000')
|
|
# await ctx.send('Alrighty, pulled the data...')
|
|
#
|
|
# # Parse data
|
|
# update_players = []
|
|
# new_players = []
|
|
# error_players = []
|
|
# rarities = {
|
|
# 'MVP': Rarity.get(Rarity.name == 'MVP'),
|
|
# 'All-Star': Rarity.get(Rarity.name == 'All-Star'),
|
|
# 'Starter': Rarity.get(Rarity.name == 'Starter'),
|
|
# 'Reserve': Rarity.get(Rarity.name == 'Reserve'),
|
|
# 'Replacement': Rarity.get(Rarity.name == 'Replacement')
|
|
# }
|
|
#
|
|
# await ctx.send(f'I will look for updates now...')
|
|
# async with ctx.typing():
|
|
# for row in raw_data:
|
|
# if row[0] != '':
|
|
# cardset = row[0][:4]
|
|
# player_name = row[0][5:]
|
|
# rarity_name = row[1]
|
|
# this_player = Player.get_or_none(Player.cardset == cardset, Player.name == player_name)
|
|
# if not this_player:
|
|
# if allow_new:
|
|
# # Create new player object and save
|
|
# pass
|
|
# else:
|
|
# error_players.append(row[0])
|
|
# elif this_player.rarity != rarities[rarity_name]:
|
|
# this_player.rarity = rarities[rarity_name]
|
|
# update_players.append(this_player)
|
|
# else:
|
|
# break
|
|
#
|
|
# logging.info(f'Update players: {update_players}\n\nNew players: {new_players}\n\n'
|
|
# f'Error players: {error_players}')
|
|
# update_message = f'Here\'s what I\'ve got for ya:\n' \
|
|
# f'Updates: {len(update_players)}\n' \
|
|
# f'Errors: {len(error_players)}'
|
|
# await ctx.send(update_message)
|
|
#
|
|
# if len(error_players) == 0:
|
|
# async with ctx.typing():
|
|
# with db.atomic():
|
|
# for x in update_players:
|
|
# x.save()
|
|
#
|
|
# db.close()
|
|
# await ctx.send('All done!')
|
|
#
|
|
# @commands.command(name='tempteam', help='Admin command to add team')
|
|
# @commands.is_owner()
|
|
# async def add_team(self, ctx, abbrev: str, sname: str, lname: str, gmid: int, gmname: str):
|
|
# new_team = Team(abbrev=abbrev,
|
|
# sname=sname,
|
|
# lname=lname,
|
|
# gmid=gmid,
|
|
# gmname=gmname,
|
|
# season=1)
|
|
#
|
|
# if new_team.save() == 1:
|
|
# await ctx.send(f'Hey {ctx.guild.fetch_member(new_team.gmid).mention}, '
|
|
# f'you are now the GM of the {new_team.lname}!')
|
|
# else:
|
|
# await ctx.send(f'Nope. They suck and don\'t get a team. It has nothing to do with this stack of '
|
|
# f'errors I got when I tried to create their team.')
|
|
#
|
|
# db.close()
|
|
|
|
# @commands.command(name='setprimary', help='Admin command to set pos')
|
|
# @commands.is_owner()
|
|
# async def set_primary_command(self, ctx, pos, cardset, *, player_name):
|
|
# if pos.upper() not in ['C', '1B', '2B', '3B', 'SS', 'LF', 'CF', 'RF', 'DH', 'SP', 'RP']:
|
|
# await ctx.send(f'I cannot set a primary postion to **{pos.upper()}**.')
|
|
# return
|
|
#
|
|
# yp_query = Player.select(Player.name).where(Player.cardset == cardset)
|
|
# yearly_players = []
|
|
# for x in yp_query:
|
|
# yearly_players.append(x.name.lower())
|
|
#
|
|
# try:
|
|
# great_match = get_close_matches(player_name.lower(), yearly_players, cutoff=0.75)[0]
|
|
# this_guy = Player.get((fn.Lower(Player.name) == great_match.lower()), Player.cardset == cardset)
|
|
# except Exception as e:
|
|
# await ctx.send(f'I could not find {player_name.title()}. Is that the right year?')
|
|
# logging.error(f'**ERROR** (display_player): {e}')
|
|
# db.close()
|
|
# return
|
|
#
|
|
# this_guy.primary = pos.upper()
|
|
# this_guy.pos1 = pos.upper()
|
|
# this_guy.save()
|
|
#
|
|
# await ctx.send(helpers.random_conf_gif())
|
|
#
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='setcardurl', help='Admin command to set card')
|
|
# @commands.is_owner()
|
|
# async def set_cardurl_command(self, ctx, card_url, cardset, *, player_name):
|
|
# yp_query = Player.select(Player.name).where(Player.cardset == cardset)
|
|
# yearly_players = []
|
|
# for x in yp_query:
|
|
# yearly_players.append(x.name.lower())
|
|
#
|
|
# try:
|
|
# great_match = get_close_matches(player_name.lower(), yearly_players, cutoff=0.75)[0]
|
|
# this_guy = Player.get((fn.Lower(Player.name) == great_match.lower()), Player.cardset == cardset)
|
|
# except Exception as e:
|
|
# await ctx.send(f'I could not find {player_name.title()}. Is that the right year?')
|
|
# logging.error(f'**ERROR** (display_player): {e}')
|
|
# db.close()
|
|
# return
|
|
#
|
|
# embed = discord.Embed(title=f'{this_guy.name} New Card')
|
|
# embed.set_image(url=card_url)
|
|
# await ctx.send(content=None, embed=embed)
|
|
#
|
|
# prompt = 'Is this the URL you would like to use?'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, 'yesno', 45)
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if not resp:
|
|
# await ctx.send('No worries, let me know if you want to try again later.')
|
|
# db.close()
|
|
# return
|
|
# else:
|
|
# this_guy.url = card_url
|
|
# this_guy.save()
|
|
#
|
|
# await ctx.send(helpers.random_conf_gif())
|
|
#
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='setrarity', help='Admin command to set rarity')
|
|
# @commands.is_owner()
|
|
# async def set_rarity_command(self, ctx, rarity, cardset, *, player_name):
|
|
# this_rarity = Rarity.get_or_none(fn.Lower(Rarity.name) == rarity.lower())
|
|
# if not this_rarity:
|
|
# await ctx.send(f'I could not find **{rarity}** - is that a rarity name?')
|
|
# return
|
|
#
|
|
# yp_query = Player.select(Player.name).where(Player.cardset == cardset)
|
|
# yearly_players = []
|
|
# for x in yp_query:
|
|
# yearly_players.append(x.name.lower())
|
|
#
|
|
# try:
|
|
# great_match = get_close_matches(player_name.lower(), yearly_players, cutoff=0.75)[0]
|
|
# this_guy = Player.get((fn.Lower(Player.name) == great_match.lower()), Player.cardset == cardset)
|
|
# except Exception as e:
|
|
# await ctx.send(f'I could not find {player_name.title()}. Is that the right year?')
|
|
# logging.error(f'**ERROR** (display_player): {e}')
|
|
# db.close()
|
|
# return
|
|
#
|
|
# prompt = f'**{this_guy.cardset} {this_guy.name}** is currently rated **{this_guy.rarity.name}**; would '\
|
|
# f'you like to set the rarity to **{this_rarity.name}**?'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, qtype='yesno', timeout=20)
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if not resp:
|
|
# await ctx.send(f'No worries! I will leave {this_guy.name} alone.')
|
|
# return
|
|
# else:
|
|
# this_guy.rarity = this_rarity
|
|
# this_guy.save()
|
|
# await ctx.send(helpers.random_conf_gif())
|
|
|
|
# @commands.command(name='newspecial')
|
|
# @commands.is_owner()
|
|
# async def new_special_command(self, ctx):
|
|
# name_message = 'What name should this special have?'
|
|
# sdesc_message = 'What should the short description be?'
|
|
# ldesc_message = 'What should the long description be?'
|
|
# url_message = 'What URL should display with this special?'
|
|
# thumbnail_message = 'What thumbnail image would you like to use?'
|
|
# special_name = ''
|
|
# special_sdesc = ''
|
|
# special_ldesc = ''
|
|
# special_url = ''
|
|
# special_thumbnail = ''
|
|
#
|
|
# def check(mes):
|
|
# return mes.author == ctx.author and mes.channel == ctx.channel
|
|
#
|
|
# # Get special name
|
|
# await ctx.send(name_message)
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=check, timeout=15.0)
|
|
# special_name = resp.content
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# # Get special short description
|
|
# await ctx.send(sdesc_message)
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=check, timeout=30.0)
|
|
# special_sdesc = resp.content
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# # Get special long description
|
|
# await ctx.send(ldesc_message)
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=check, timeout=60.0)
|
|
# special_ldesc = resp.content
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# # Get special URL
|
|
# await ctx.send(url_message)
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=check, timeout=30.0)
|
|
# special_url = resp.content
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# # Get special URL
|
|
# await ctx.send(thumbnail_message)
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=check, timeout=30.0)
|
|
# special_thumbnail = resp.content
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# embed = discord.Embed(title=special_name, color=0x008000, description=special_sdesc)
|
|
# embed.add_field(name='Description', value=special_ldesc)
|
|
# if special_thumbnail.lower() != 'none':
|
|
# embed.set_thumbnail(url=special_thumbnail)
|
|
# if special_url.lower() != 'none':
|
|
# embed.set_image(url=special_url)
|
|
#
|
|
# await ctx.send(content='Is this what you want?', embed=embed)
|
|
#
|
|
# def confirmation(mes):
|
|
# return mes.author == ctx.author and mes.channel == ctx.channel and mes.content.lower() == 'yes'
|
|
#
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=confirmation, timeout=20.0)
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# new_special = Special(name=special_name, short_desc=special_sdesc, url=special_url,
|
|
# long_desc=special_ldesc, thumbnail=special_thumbnail, active=False)
|
|
#
|
|
# if new_special.save() == 1:
|
|
# await ctx.send(f'Alrighty - it is in! Its ID is {new_special.get_id()}.')
|
|
# else:
|
|
# await ctx.send('Yikes. That didn\'t go through. Sorry about that.')
|
|
#
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='flipspecial')
|
|
# @commands.is_owner()
|
|
# async def flip_special_command(self, ctx, special_id):
|
|
# this_special = Special.get_by_id(special_id)
|
|
# if not this_special:
|
|
# await ctx.send('I cannot find a special with that ID.')
|
|
# return
|
|
#
|
|
# await ctx.send(content='Is this the special you\'d like to toggle?',
|
|
# embed=helpers.get_special_embed(this_special))
|
|
#
|
|
# def confirmation(mes):
|
|
# return mes.author == ctx.author and mes.channel == ctx.channel and mes.content.lower() == 'yes'
|
|
#
|
|
# try:
|
|
# resp = await self.bot.wait_for('message', check=confirmation, timeout=10.0)
|
|
# except TimeoutError:
|
|
# await ctx.send('We can do this again later.')
|
|
# return
|
|
#
|
|
# if this_special.active:
|
|
# this_special.active = False
|
|
# else:
|
|
# this_special.active = True
|
|
#
|
|
# if this_special.save() == 1:
|
|
# await ctx.send('Done!')
|
|
# else:
|
|
# await ctx.send('Huh...well I tried, but it didn\'t work.')
|
|
#
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='newweek', help='Advance week in bot\'s db')
|
|
# @commands.is_owner()
|
|
# async def advanceweek(self, ctx):
|
|
# current = Current.get()
|
|
# logging.info(f'Updating week from {current.week} to {current.week + 1}...')
|
|
# update_string = await self.increment_week()
|
|
#
|
|
# await ctx.send(f'Updated week from {current.week - 1} to {current.week}.')
|
|
# await ctx.send(update_string)
|
|
#
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='setteamweekly', help='Admin command to set team\'s weekly packs')
|
|
# @commands.is_owner()
|
|
# async def set_weekly_command(self, ctx, team_abbrev, number):
|
|
# team = Team.get_or_none(Team.abbrev == team_abbrev.upper())
|
|
# if not team:
|
|
# await ctx.send(f'I couldn\'t find **{team_abbrev}**. Is that the team\'s abbreviation?')
|
|
# return
|
|
#
|
|
# team.weeklypacks = number
|
|
# if team.save() == 1:
|
|
# await ctx.send(f'Just set {team.abbrev}\'s weekly packs to {number}')
|
|
# else:
|
|
# await ctx.send(f'Oof. I tried. I failed. Sue me.')
|
|
#
|
|
# db.close()
|
|
|
|
# @commands.group(name='donation', help='Award a player for their donation')
|
|
# @commands.is_owner()
|
|
# async def donation_command(self, ctx):
|
|
# if ctx.invoked_subcommand is None:
|
|
# await ctx.send('The format for this command is: `donation <standard or premium> <@donator>`')
|
|
#
|
|
# @donation_command.command(name='standard')
|
|
# @commands.is_owner()
|
|
# async def std_donation_command(self, ctx, gm: Member, *num_packs: int):
|
|
# donator_team = Team.get_by_owner(gm.id)
|
|
# if not donator_team:
|
|
# await ctx.send(f'I can\'t find {gm.display_name}\'s team! HALP')
|
|
# return
|
|
#
|
|
# if num_packs:
|
|
# count = num_packs[0]
|
|
# else:
|
|
# count = 1
|
|
#
|
|
# economy = self.bot.get_cog('Economy')
|
|
# logging.info(f'Granting {donator_team.sname} {count} standard pack{"s" if count > 1 else ""} for '
|
|
# f'their donation.')
|
|
# economy.give_pack(donator_team, count)
|
|
# await ctx.send(helpers.random_conf_gif())
|
|
#
|
|
# db.close()
|
|
#
|
|
# @donation_command.command(name='premium')
|
|
# @commands.is_owner()
|
|
# async def prem_donation_command(self, ctx, gm: Member, *num_packs: int):
|
|
# donator_team = Team.get_by_owner(gm.id)
|
|
# if not donator_team:
|
|
# await ctx.send(f'I can\'t find {gm.display_name}\'s team! HALP')
|
|
# return
|
|
#
|
|
# if num_packs:
|
|
# count = num_packs[0]
|
|
# else:
|
|
# count = 1
|
|
#
|
|
# economy = self.bot.get_cog('Economy')
|
|
# logging.info(f'Granting {donator_team.sname} {count} premium pack{"s" if count > 1 else ""} for '
|
|
# f'their donation.')
|
|
# economy.give_pack(donator_team, num=count, p_type='premium')
|
|
# await ctx.send(helpers.random_conf_gif())
|
|
#
|
|
# all_teams = Team.select_season()
|
|
# for x in all_teams:
|
|
# if x != donator_team:
|
|
# economy.give_pack(x, count)
|
|
#
|
|
# await helpers.send_to_news(
|
|
# ctx,
|
|
# f'Everybody just got {count} pack{"s" if count > 1 else ""} thanks to {gm.mention}\'s donation. '
|
|
# f'Go rip {"them" if count > 1 else "it"} with .open!',
|
|
# None
|
|
# )
|
|
#
|
|
# db.close()
|
|
|
|
# @commands.command(name='setdaily', help='Set daily flag')
|
|
# @commands.is_owner()
|
|
# async def set_daily_command(self, ctx, gm: Member):
|
|
# this_team = Team.get_by_owner(gm.id)
|
|
# if not this_team:
|
|
# await ctx.send(f'I can\'t find {gm.display_name}\'s team! HALP')
|
|
# return
|
|
#
|
|
# this_team.dailyclaim = 1
|
|
# this_team.save()
|
|
#
|
|
# await ctx.message.add_reaction('✅')
|
|
# db.close()
|
|
#
|
|
# @commands.command(name='settheme', help='Set pack theme')
|
|
# @commands.is_owner()
|
|
# async def set_theme_command(self, ctx, theme):
|
|
# cardsets = [1941, 1962, 1986, 1996, 2001, 2007, 2014, 2018, 2019, 2020]
|
|
# # franchises = []
|
|
#
|
|
# if int(theme) in cardsets:
|
|
# current = Current.get()
|
|
# this_theme = PackTheme.get_or_none(PackTheme.cardset == theme)
|
|
# if not this_theme:
|
|
# this_theme = PackTheme(name=f'{theme} Cardset', cardset=theme)
|
|
# this_theme.save()
|
|
#
|
|
# current.active_theme = this_theme
|
|
# current.save()
|
|
#
|
|
# await ctx.send(f'Got it! Just set the current PackTheme to {theme.title()}')
|
|
# else:
|
|
# await ctx.send(f'Hmm...**{theme}** is not an available theme.')
|
|
#
|
|
# @commands.command(name='cleartheme', help='Clear pack theme')
|
|
# @commands.is_owner()
|
|
# async def clear_theme_command(self, ctx):
|
|
# current = Current.get()
|
|
# if not current.active_theme:
|
|
# await ctx.send('There is no theme currently set.')
|
|
# else:
|
|
# this_theme = PackTheme.get_by_id(current.active_theme)
|
|
# current.active_theme = None
|
|
# current.save()
|
|
# await ctx.send(f'Just deactivated the **{this_theme.name}** theme.')
|
|
#
|
|
# @commands.command(name='newaward', help='Grant award')
|
|
# @commands.is_owner()
|
|
# async def new_award_command(self, ctx, *, award_name):
|
|
# # f'{"In-Season" if in_or_off.lower() == "in" else "Off-Season"}'
|
|
# current = Current.get()
|
|
# award = {
|
|
# 'name': award_name,
|
|
# 'season': current.season,
|
|
# 'timing': "In-Season",
|
|
# 'player': None,
|
|
# 'team': None,
|
|
# 'image': None,
|
|
# 'invalid': False
|
|
# }
|
|
#
|
|
# async def add_recipient(search_string):
|
|
# this_team = Team.get_or_none(Team.abbrev == search_string.upper(), Team.season == award['season'])
|
|
# if this_team:
|
|
# award['team'] = this_team
|
|
# else:
|
|
# data = re.split(' ', search_string)
|
|
# cardset = data[0]
|
|
# name = data[1]
|
|
#
|
|
# yp_query = Player.select(Player.name).where(Player.cardset == cardset)
|
|
# yearly_players = []
|
|
# for x in yp_query:
|
|
# yearly_players.append(x.name.lower())
|
|
#
|
|
# try:
|
|
# close_matches = get_close_matches(name.lower(), yearly_players, cutoff=0.75)
|
|
# great_match = close_matches[0]
|
|
# this_guy = Player.get((fn.Lower(Player.name) == great_match), Player.cardset == cardset)
|
|
# award['player'] = this_guy
|
|
# except Exception as e:
|
|
# return None
|
|
#
|
|
# def get_embed():
|
|
# this_embed = discord.Embed(title=award['name'])
|
|
# this_embed.description = f'{award["timing"]} - S{award["season"]}'
|
|
# if award['player']:
|
|
# this_embed.add_field(name='Player', value=f'{award["player"].name}')
|
|
# if award['team']:
|
|
# this_embed.add_field(name='Team', value=f'{award["team"].lname}')
|
|
# if award['image']:
|
|
# try:
|
|
# this_embed.set_image(url=award['image'])
|
|
# except:
|
|
# award['invalid'] = True
|
|
# this_embed.add_field(name='Image', value='Invalid URL')
|
|
# return this_embed
|
|
#
|
|
# # Get team/player
|
|
# while True:
|
|
# prompt = 'Please enter the team abbreviation, player name, or manager name of the recipient.'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, 'text', timeout=45)
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if resp is None:
|
|
# await ctx.send('You think on it and hit me up when you\'re ready.')
|
|
# return
|
|
# else:
|
|
# await add_recipient(resp)
|
|
#
|
|
# await ctx.send('Here is the current award', embed=get_embed())
|
|
#
|
|
# prompt = 'Would you like to (re)enter a recipient?'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, 'yesno', timeout=45)
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if resp is None:
|
|
# await ctx.send('We can hold off on this for now. Let me know when you\'re ready to start again.')
|
|
# return
|
|
# elif not resp:
|
|
# break
|
|
#
|
|
# # Get image URL
|
|
# while True:
|
|
# prompt = 'Would you like to (re)enter an image URL for this award?'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, 'yesno', timeout=45, embed=get_embed())
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if not resp:
|
|
# break
|
|
# else:
|
|
# prompt = 'Please enter the image URL.'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, 'url', timeout=45)
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if resp is None:
|
|
# await ctx.send('Okey doke, nevermind. I get it. It\'s fine. We only did all this work for nothing. '
|
|
# 'Let me know when you want to start again.')
|
|
# return
|
|
# elif not resp:
|
|
# await ctx.send(f'**{resp}** is not a valid URL.')
|
|
# else:
|
|
# award['image'] = resp
|
|
#
|
|
# prompt = 'Would you like to submit this award?'
|
|
# this_q = helpers.Question(self.bot, ctx.channel, prompt, 'yesno', timeout=45, embed=get_embed())
|
|
# resp = await this_q.ask([ctx.author])
|
|
#
|
|
# if not resp:
|
|
# await ctx.send('Really? After all the ti- nevermind. Fine. Kill it. It\'s over. Bye.')
|
|
# return
|
|
# else:
|
|
# this_award = Award(
|
|
# name=award['name'],
|
|
# season=award['season'],
|
|
# timing=award['timing'],
|
|
# player=award['player'],
|
|
# team=award['team'],
|
|
# image=award['image']
|
|
# )
|
|
# this_award.save()
|
|
# db.close()
|
|
# await ctx.send(helpers.random_conf_gif())
|
|
|
|
|
|
async def setup(bot):
|
|
await bot.add_cog(Admins(bot))
|