Untitled
unknown
plain_text
a year ago
2.4 kB
3
Indexable
Never
import os import re import asyncio import discum import logging from dotenv import load_dotenv # Load environment variables from .env file load_dotenv() version = 'v2.0' logs_id = 1161997624052809778 with open('data/pokemon', 'r', encoding='utf8') as file: pokemon_list = file.read() with open('data/legendary', 'r') as file: legendary_list = file.read() with open('data/mythical', 'r') as file: mythical_list = file.read() with open('data/level', 'r') as file: to_level = file.readline() num_pokemon = 0 shiny = 0 legendary = 0 mythical = 0 main = 743115484672688248 poketwo = 716390085896962058 # Use the environment variable for the token TOKEN = os.getenv('TOKEN') intervals = [3.0, 2.2, 2.4, 2.6, 2.8] def solve(message): hint = [] for i in range(15, len(message) - 1): if message[i] != '\\': hint.append(message[i]) hint_string = '' for i in hint: hint_string += i hint_replaced = hint_string.replace('', '.') solution = re.findall('^' + hint_replaced + '$', pokemon_list, re.MULTILINE) return solution bot = discum.Client(token=TOKEN, log=False) @bot.gateway.command def helloworld(resp): if resp.event.ready_supplemental: # ready_supplemental is sent after ready user = bot.gateway.session.user print("Logged in as {}#{}".format(user['username'], user['discriminator'])) @bot.gateway.command async def on_message(message): channel = message.channel # Check if the message is from the PokéTwo bot if message.author.id == poketwo: # If the message is a wild Pokémon spawn message, catch the Pokémon if message.embeds: embed_title = message.embeds[0].title if 'A wild pokémon has appeared!' in embed_title: await asyncio.sleep(4) await channel.send('h') pokemon_name = message.embeds[0].description.split(' ')[1] # Send a message to the bot to catch the Pokémon await bot.sendMessage('@Pokétwo catch {pokemon_name}') # Configure logging to show debug messages logging.basicConfig(level=logging.DEBUG) # Example usage logging.debug('This is a debug message') logging.info('This is an info message') logging.warning('This is a warning message') logging.error('This is an error message') logging.critical('This is a critical message') bot.gateway.run(auto_reconnect=True)