async def hq(ctx, *text: str): """commands for getting notified about hq games !hq register - register yourself for pings !hq unregister - take yourself off the list !hq check - check if you are registered !hq list - list everyone registered !hq ping - ping everyone registered !hq <number of people left> - get the payout for this number of people, assuming $5000 prize !hq <prize> <number of people> - get the payout for the number of people and the corresponding prize""" helpstring = "use '!help hq' to get help about this command" if len(text) == 0: await ctx.send(helpstring) else: if len(text) == 2 and text[0].isdigit() and text[1].isdigit(): money = round(int(text[0]) / int(text[1]), 2) await ctx.send("$" + str(money)) return elif len(text) == 1 and text[0].isdigit(): money = round(5000 / int(text[0]), 2) await ctx.send("$" + str(money)) return t = ''.join(text) if t == "register": await ctx.send(hqmod.register_user(ctx.message.author)) elif t == "unregister": await ctx.send(hqmod.unregister_user(ctx.message.author)) elif t == "check": if hqmod.is_user_registered(ctx.message.author): await ctx.send(ctx.message.author.display_name + " is registered for hq pings.") else: await ctx.send(ctx.message.author.display_name + " is **NOT** registered for hq pings.") elif t == "ping": await ctx.send(hqmod.list_users(mention=True)) elif t == "list": await ctx.send(hqmod.list_users()) else: await ctx.send(helpstring)
async def update_mlbtr(): await bot.wait_until_ready() channel = bot.get_channel(id=main_chid) triviach = discord.utils.find(lambda m: m.name == 'trivia', channel.server.channels) while not bot.is_closed: if hqmod.check_hq(): await bot.send_message( channel, ":rotating_light: HQ is starting soon :rotating_light: --- head to %s" % (triviach.mention)) await bot.send_message( triviach, ":rotating_light: HQ is starting soon :rotating_light:") await bot.send_message(triviach, hqmod.list_users(mention=True)) out = mlbtr.mlbtr() if out != None: await bot.send_message(channel, out) await asyncio.sleep(60 * 3)