async def automate_beg(): if not multimer.over(BEG): return while True: await pls(BEG) cooldown = await wait_for_cooldown(BEG_COOLDOWN) if cooldown == TIMEOUT: continue break multimer.start(BEG, cooldown)
async def automate_trivia(): if not multimer.over(TRIVIA): return while True: await pls(TRIVIA) msg = await wait_for_message(content=None, timeout=5) if msg == TIMEOUT or msg.embeds[0].author and TRIVIA not in msg.embeds[ 0].author.name: continue else: cooldown = read_cooldown_from_message(msg) if cooldown: multimer.start(TRIVIA, cooldown) return trivia = plstrivia.read(msg.embeds[0].description) break worth = plstrivia.read_worth(msg) print(f'\n[Trivia - {worth} coins]', trivia.question) answer = plstrivia.try_answer(trivia) print('[Answer Data]', answer) new_trivia = not answer if new_trivia or worth == 50: answer = random.randint(1, 4) if worth == 50: print('[Worth = 50] Randomizing') else: answer = trivia.answers.index(answer) if worth == 10: print('[Worth = 10] Avoiding option', answer) options = [i + 1 for i in range(4) if i + 1 != answer] answer = random.choice(options) await send(answer) multimer.start(TRIVIA, TRIVIA_COOLDOWN) msg = await wait_for_message(timeout=10) if new_trivia and msg != TIMEOUT: if TRIVIA_CORRECT in msg.content: trivia.correct_answer = trivia.answers[answer] elif TRIVIA_INCORRECT in msg.content: correct_answer = re.findall(TRIVIA_ANSWER_PATTERN, msg.content)[0] trivia.correct_answer = correct_answer plstrivia.log_new(trivia) print('[Correct Answer]', trivia.correct_answer)
async def automate_bet(): if not multimer.over(BET): return global plsbet_amount, plslots_amount amounts = [plslots_amount, plsbet_amount] start_coins = [START_SLOTS, START_BET] zipped = zip(BET_GAMES, amounts, MULTIPLIERS_ON_LOST, start_coins) for game, bet_amount, multiplier, start_coin in zipped: if WITHDRAW_IF_NOT_ENOUGH_FOR_BET and not await withdraw_enough( bet_amount): bet_amount = start_coin if game == SLOTS and sum(last_balance) < plsbet_amount: break else: continue msg = await bank(game, bet_amount, msg_content='You', try_again_cooldown=True) if 'bluff' in msg.content: bet_amount = start_coin if multiplier == DEFAULT_MULTIPLIER: continue won = await read_won_status(msg) if won == WON: bet_amount = start_coin elif won in [LOST, TIE]: if multiplier == 2 and bet_amount >= 1024 and ( bet_amount % 2 == 0 or bet_amount % 2.5 == 0): multiplier = 2.5 bet_amount *= multiplier bet_amount = math.ceil(bet_amount) if bet_amount > MAX_BEFORE_RESET: bet_amount = start_coin if game == SLOTS: plslots_amount = bet_amount elif game == BET: plsbet_amount = bet_amount multimer.start(BET, BET_COOLDOWN)
async def automate_meme(): if not multimer.over(POSTMEMES): return while True: await pls(POSTMEMES) cooldown = await wait_for_meme_option(POSTMEME_COOLDOWN) if cooldown == TIMEOUT: continue elif cooldown == BUY_LAPTOP: if await withdraw_enough(LAPTOP_COST): await pls(BUY_LAPTOP) continue else: cooldown = POSTMEME_COOLDOWN break await send('d') break multimer.start(POSTMEMES, cooldown)
async def automate_sell(): if not multimer.over(SELL): return while True: await pls(INVENTORY) msg = await wait_for_message(PLS + SHOP) # in case of empty inventory if msg == TIMEOUT: continue break items = msg.embeds[0].fields[0].value if msg.embeds else '' items = re.findall(INVENTORY_PATTERN, items) for count, item_name, item_type in items: if item_name in ITEMS_NOT_FOR_SALE: continue action = USE if item_name in ITEMS_TO_USE else SELL await bank(f'{action} {item_name}', count, msg_content='') break multimer.start(SELL, SELL_COOLDOWN)
async def automate_scout(): if not multimer.over(SCOUT): return await deposit(ALL, try_again_cooldown=True) while True: await pls(SCOUT) area = await wait_for_best_scout_option() cooldown = SCOUT_COOLDOWN if area == TIMEOUT: continue elif type(area) is str: await send(area) elif type(area) is float: cooldown = area multimer.start(SCOUT, cooldown) break if AFTER_SCOUT_WITHDRAWAL == ALL: await withdraw(ALL) else: await withdraw_enough(AFTER_SCOUT_WITHDRAWAL)