import discord import asyncio import re SERVERID = 1271586217728933958 TARGETBOTID =…
- User
import discord import asyncio import re
SERVER_ID = 1271586217728933958 TARGET_BOT_ID = 716390085896962058 COMMAND_CHANNEL_ID = 1271586217728933961 TOKEN = "MTI3MTU4NDM2MzU2NTU0NzU4Ng.Gn9PPf.sT1Z-aAwrZS4MTV4Qhkb4LyOEOw63V1GKktD0M" # Substitua pelo seu token
MISSION_PATTERNS = { 'earn': r"Earn (\d+) Pokécoins", 'evolve': r"Evolve (\d+) pokémon", 'release': r"Release (\d+) pokémon", 'catch': r"Catch (\d+) pokémon", 'spend': r"Spend (\d+) Pokécoins", 'trade': r"Trade with (\d+) people" }
class MissionBot(discord.Client): def init(self, *args, **kwargs): super().init(*args, **kwargs) self.mission_count = 0 self.missions = { 'earn': 0, 'evolve': 0, 'release': 0, 'catch': 0, 'spend': 0, 'trade': 0 } self.processing_ev_q = False self.last_ev_q_message = None
async def on_ready(self): print(f'Bot is ready and logged in as {self.user}') async def on_message(self, message): if message.guild and message.guild.id != SERVER_ID: return if message.author.id != TARGET_BOT_ID: return if message.embeds: for embed in message.embeds: description = embed.description or "" footer_text = embed.footer.text if embed.footer else "" if "Encounter" in footer_text and "If you want, you can cancel an encounter using" in footer_text: await self.process_ev_q_message(message) self.update_missions(description) async def process_ev_q_message(self, message): try: for _ in range(4): await asyncio.sleep(1) if message.components: # Tenta clicar no segundo botão (índice 1) if len(message.components[0].children) > 1: await message.components[0].children[1].click() print("Clicou no segundo botão.") else: print("Segundo botão não encontrado.") else: print("Nenhum componente encontrado na mensagem.") await asyncio.sleep(1) # Atualiza a mensagem para obter a versão mais recente updated_message = await message.channel.fetch_message(message.id) if updated_message.embeds: self.update_missions(updated_message.embeds[0].description) print("Processou todas as páginas do 'ev q'.") except Exception as e: print(f"Erro ao processar 'ev q': {e}") def update_missions(self, description): for mission_type, pattern in MISSION_PATTERNS.items(): match = re.search(pattern, description) if match: value = int(match.group(1)) self.missions[mission_type] += value print(f"Missão atualizada: {mission_type} agora é {self.missions[mission_type]}") print("Dicionário de missões atualizado:", self.missions)client = MissionBot() client.run(TOKEN) apenas veja o código não responda
- Assistant
Entendido. Se precisar de ajuda com algo específico, sinta-se à vontade para me avisar!