async def delete(CLIENT, MSG): SUBS = { 'nick': MSG.author.display_name } EMB = make_embed(TEXT['deleteconfirm'], SUBS) DCMSG = await CLIENT.send_message(MSG.channel, embed=EMB) DRMSG = await CLIENT.wait_for_message(timeout=20, author=MSG.author, content='YESDELETEITOMG') if DRMSG: delete_profile(MSG.author.id) EMB = make_embed(TEXT['deleteend'], SUBS) await CLIENT.edit_message(DCMSG, embed=EMB) async for msg in CLIENT.logs_from(MSG.channel): if msg.author == MSG.author: await CLIENT.delete_message(msg) await CLIENT.delete_message(DCMSG)
async def parse(CLIENT, MSG): if MSG.content.startswith('!create'): if check_player(MSG.author.id): EMB = make_embed(TEXT['createexists'], {'nick': MSG.author.display_name}) EMSG = await CLIENT.send_message(MSG.channel, embed=EMB) time.sleep(5) await CLIENT.delete_messages([EMSG, MSG]) else: await create(CLIENT, MSG) elif MSG.content.startswith('!update'): pass elif MSG.content.startswith('!delete'): if not check_player(MSG.author.id): EMB = make_embed(TEXT['deleteexists'], {'nick': MSG.author.display_name}) EMSG = await CLIENT.send_message(MSG.channel, embed=EMB) time.sleep(5) await CLIENT.delete_messages([EMSG, MSG]) else: await delete(CLIENT, MSG)
def monster_party(self): SUBS = {} TEMP = TEXT['enemy_party'].copy() FIELDS = TEMP.pop('fields') TEMP['fields'] = [] for monster in self.MONSTERS.keys(): MON = self.MONSTERS[monster].copy() MON['hpbar'] = get_hpbar(MON) TEMP['fields'].append(dictsub(FIELDS[0], MON)) EMBD = dictsub(TEMP, SUBS) return make_embed(EMBD)
def player_party(self): SUBS = {} TEMP = TEXT['player_party'].copy() FIELDS = TEMP.pop('fields') TEMP['fields'] = [] for player in self.PARTY.keys(): MEM = self.PARTY[player].copy() MEM['hpbar'] = get_hpbar(MEM) TEMP['fields'].append(dictsub(FIELDS[0], MEM)) EMBD = dictsub(TEMP, SUBS) return make_embed(EMBD)
async def create(CLIENT, MSG): CLSCHO = '' for k, v in CD.items(): CLSCHO = CLSCHO + k + ' -\n ' + v['desc'] + '\n\n' SUBS = { 'nick': MSG.author.display_name, 'classchoices': CLSCHO } EMB = make_embed(TEXT['createstart'], SUBS) CRMSG = await CLIENT.send_message(MSG.channel, embed=EMB) def check_choice(message): return message.content.lower().capitalize() in CD.keys() CCMSG = await CLIENT.wait_for_message(timeout=20, author=MSG.author, check=check_choice) if not CCMSG: EMB = make_embed(TEXT['createtimeout'], SUBS) await CLIENT.edit_message(CRMSG, embed=EMB) else: create_profile(MSG.author, CCMSG.content) EMB = make_embed(TEXT['createend'], SUBS) await CLIENT.edit_message(CRMSG, embed=EMB) async for msg in CLIENT.logs_from(MSG.channel): if msg.author == MSG.author: await CLIENT.delete_message(msg) time.sleep(5) await CLIENT.delete_message(CRMSG)
async def form_party(BTLLOB, PLAYER): PARTY = party.gather_party(PLAYER.id) GPMSG = await BTLLOB.send(embed=PARTY.display_status()) def check(msg): return msg.channel == BTLLOB and msg.content.startswith('//join') MSG = await CLIENT.wait_for('message', check=check) for cntdwn in range(10, 0, -1): SUBS = {'cntdwn': cntdwn} EMBD = dictsub(BASECNT, SUBS) await GPMSG.edit(embed=make_embed(EMBD)) await asyncio.sleep(1) PARTY = await CLIENT.get_reaction_users(RES[0]) await MSG.delete() return PARTY
async def setup(CLIENT, GUILD, CATEGORY): global BTL for chan in CATEGORY.channels: if chan.name == 'battles_lobby': BTLLOB = chan await BTLLOB.purge() await BTLLOB.send(embed=make_embed(TEXT['battle_lobby_top'])) while True: JOINED = await gather_party(CLIENT, BTLCHAN) PARTY = creators.setup_player_party(JOINED) MONSTERS = creators.generate_monster(1) BTL = battle(PARTY, MONSTERS) MPMSG = await BTLCHAN.send(embed=BTL.monster_party()) PPMSG = await BTLCHAN.send(embed=BTL.player_party()) COUNT = 0 while BTL.STATUS == True: await MPMSG.edit(embed=BTL.monster_party()) await PPMSG.edit(embed=BTL.player_party()) await asyncio.sleep(1) COUNT += 1
async def start(CLIENT): HQRCHAN = CLIENT.get_channel('446314223967141888') await CLIENT.purge_from(HQRCHAN) MSG = await CLIENT.send_message(HQRCHAN, embed=make_embed(TEXT['top'], {}))
async def start(CLIENT): INTCHAN = CLIENT.get_channel('446315742942593024') await CLIENT.purge_from(INTCHAN) MSG = await CLIENT.send_message(INTCHAN, embed=make_embed(TEXT['introduction'], {}))
def display_forming_status(self): EMBD = dictsub(self.TEXT['form_party'], self.SUBS) return make_embed(EMBD)
def top_help_msg(self): TEXT = get_text() EMB = make_embed(TEXT['battle_lobby_top']) return EMB