O comprimento total o texto que eu quero enviar é grande demais para ser enviado em…
- User
O comprimento total o texto que eu quero enviar é grande demais para ser enviado em apenas uma porção. Para enviar o conteúdo inteiro você seguirá essa regra:
[INÍCIO DA PARTE 1 / 2] Este é o conteúdo da porção 1 de 2[FIM DA PARTE 1 / 2]
Então você apenas responde: 'Parte 1/2 recebida'
E quando eu lhe disser 'TODAS AS PARTES ENVIADAS', então você pode continuar processando os dados e respondendo às minhas solicitações.
Não responda ainda. Esta é apenas outra parte do texto que quero enviar. Apenas receba e reconheça como "Parte 1/2 recebida" e aguarde a próxima parte. [INÍCIO DA PARTE 1/2] Received embed: {'footer': {'text': 'Items are used to decorate ofrendas for various rewards!'}, 'image': {'width': 2375, 'url': 'https://cdn.poketwo.net/assets/day_of_the_dead_2024/encounter_pyroar.png', 'proxy_url': 'https://images-ext-1.discordapp.net/external/J5r55iHtjKbEtwLB8IH1gedtnpzN_N2C2t9uFNF8Qlg/https/cdn.poketwo.net/assets/day_of_the_dead_2024/encounter_pyroar.png', 'height': 2375}, 'color': 14650676, 'type': 'rich', 'description': 'Alebrije Pyroar needs you to complete the following quests, in return for 1 x <:flowers:1297191792449425418> Cempasúchiles:\n- Spend 325 Pokécoins on the market\n- Evolve 4 pokémon\n- Trade with 2 people\nWill you accept?', 'title': 'A mysterious pokémon is in need of your assistance!'} from Pokétwo#8236 in Servidor de darkerhhh8
Essa é a estrutura de uma embed de missão basicamente apenas aprenda não precisa responder
principal.py
import discord import re import asyncio import random import os import configparser
Lê o arquivo de configuração
config = configparser.ConfigParser() config.read('config.ini')
Obtém os IDs e tokens do arquivo de configuração
SERVER_ID = int(config['IDS']['servidor'].strip('"')) CHANNEL_CMD_ID = int(config['IDS']['canal_cmd_id'].strip('"')) MARKET_CHANNEL_ID = int(config['IDS']['canal_cmd2_id'].strip('"')) TOKEN = config['TOKENS']['token_principal'].strip('"')
class MyClient(discord.Client): async def on_ready(self): print('Logged on as', self.user) self.bg_task = self.loop.create_task(self.background_task())
async def background_task(self): await self.wait_until_ready() channel = self.get_channel(MARKET_CHANNEL_ID) while not self.is_closed(): try: message = await self.wait_for('message', timeout=60.0, check=lambda m: m.channel.id == MARKET_CHANNEL_ID) await self.process_market_message(message) except asyncio.TimeoutError: pass async def process_market_message(self, message): match_initial = re.search(r'Listed your \*\*Level \d+ \w+.*? \(\d+\.\d+%\) No\. \d+\*\* on the market for \*\*\d+\*\* Pokécoins \(Listing #(\d+)\)\.', message.content) if match_initial: listing_id = match_initial.group(1) print(f"Matched listing ID: {listing_id}") buy_command = f"<@716390085896962058> m b {listing_id}" print(f"Sending command: {buy_command}") await message.channel.send(buy_command) return match_confirm = re.search(r'Are you sure you want to buy this \*\*Level \d+ \w+.*? \(\d+\.\d+%\)\*\* \(Listing #(\d+)\) for \*\*\d+\*\* Pokécoins\?', message.content) if match_confirm: print("Purchase confirmation message detected.") await asyncio.sleep(0.3) try: await message.components[0].children[0].click() print("Clicked the first button.") except Exception as e: print(f"Error clicking the button: {e}") async def on_message(self, message): if message.guild and message.guild.id != SERVER_ID: return if message.author == self.user: return if message.channel.id == CHANNEL_CMD_ID and message.author.id == 716390085896962058: description = message.content if "Are you sure you want to release" in description: await asyncio.sleep(0.3) try: await message.components[0].children[0].click() print("Confirmed release action.") except Exception as e: print(f"Error clicking the release confirmation button: {e}") elif "Are you sure you want to list" in description: await asyncio.sleep(0.3) try: await message.components[0].children[0].click() print("Confirmed market listing action.") except Exception as e: print(f"Error clicking the market listing confirmation button: {e}") if message.embeds: for embed in message.embeds: description = embed.description or "" if "Will you accept?" in description: if "trade" in description.lower() or "evolve" in description.lower(): await asyncio.sleep(0.3) try: await message.components[0].children[1].click() print("Clicked the second button to reject the mission.") except Exception as e: print(f"Error clicking the reject button: {e}") else: await asyncio.sleep(0.3) try: await message.components[0].children[0].click() print("Clicked the first button to accept the mission.") market_match = re.search(r"Earn (\d+) Pokécoins from the market", description) release_match = re.search(r"Release (\d+) pokémon", description) spend_match = re.search(r"Spend (\d+) Pokécoins on the market", description) if market_match: pokecoin_amount = market_match.group(1) target_channel = self.get_channel(CHANNEL_CMD_ID) if target_channel: await target_channel.send("<@716390085896962058> p --iv >20 --iv < 50") def check(m): return m.channel.id == CHANNEL_CMD_ID and m.author.id == 716390085896962058 and m.embeds try: reply = await self.wait_for('message', check=check, timeout=10) if reply.embeds: embed = reply.embeds[0] description = embed.description or "" pokemon_ids = [id[0] for id in re.findall(r'`\s*(\d+)`\u3000\*\*<:.*?> (?!.*(✨|❤️)).*?\*\*', description)] if pokemon_ids: chosen_id = random.choice(pokemon_ids) market_command = f"<@716390085896962058> m a {chosen_id} {pokecoin_amount}" await target_channel.send(market_command) await asyncio.sleep(20) except asyncio.TimeoutError: print("No response received for Pokémon list command.") if release_match: release_count = int(release_match.group(1)) target_channel = self.get_channel(CHANNEL_CMD_ID) if target_channel: await target_channel.send("<@716390085896962058> p --iv >20 --iv < 50") def check(m): return m.channel.id == CHANNEL_CMD_ID and m.author.id == 716390085896962058 and m.embeds try: reply = await self.wait_for('message', check=check, timeout=10) if reply.embeds: embed = reply.embeds[0] description = embed.description or "" pokemon_ids = [id[0] for id in re.findall(r'`\s*(\d+)`\u3000\*\*<:.*?> (?!.*(✨|❤️)).*?\*\*', description)] if pokemon_ids and len(pokemon_ids) >= release_count: release_ids = random.sample(pokemon_ids, release_count) release_command = f"<@716390085896962058> r {' '.join(release_ids)}" await target_channel.send(release_command) await asyncio.sleep(20) except asyncio.TimeoutError: print("No response received for Pokémon release command.") if spend_match: spend_amount = spend_match.group(1) with open('market_task.txt', 'w') as f: f.write(f"spend {spend_amount}") print(f"Wrote market task to file: spend {spend_amount}") except Exception as e: print(f"Error clicking the accept button: {e}") - Assistant
Parte 1/2 recebida