コード例 #1
0
ファイル: dexload.py プロジェクト: CPlusMinus2000/PokeComics
def pull_pokemon(folder: str = "pokeapi", init: int = 1) -> None:
    """
    Pulls files from the PokéApi database.
    Currently only pulls Pokémon data, but it should be easy to pull more.
    """

    i = init
    with open("index.yml", 'r') as ifile:
        index = yaml.safe_load(ifile)
    
    with open("forms.json", 'r') as ffile:
        forms = json.load(ffile)
    
    while i <= MAX_POKEMON:
        pok = pk.V2Client().get_pokemon(i)            
        if pok.name.split('-')[0] in forms:
            poks = forms[pok.name.split('-')[0]]
            for p in poks:
                pok = pk.V2Client().get_pokemon(p)
                with open(f"{folder}/{pok.name}.json", 'w') as f:
                    json.dump(todict(pok), f, indent=4, sort_keys=True)
        
        else:
            with open(f"{folder}/{pok.name}.json", 'w') as f:
                json.dump(todict(pok), f, indent=4, sort_keys=True)
            
        i += 1
コード例 #2
0
ファイル: pokehelper.py プロジェクト: r0adkll/rotom.py
def get_species(species_id):
    try:
        client = pokepy.V2Client()
        return client.get_pokemon_species(species_id)
    except:
        print("Couldn't find species for %d" % species_id)
        return
コード例 #3
0
def build_items():
    """
    Args:
        None.
    Returns:
        An object that contains all infortmation we will be containing in our
        pokedex.
    Throws:
        beckett.exceptions.InvalidStatusCodeError
    """

    items = {}
    client = pokepy.V2Client()
    i = 1
    while True:
        try:
            item = client.get_item(i)
        except beckett_except.InvalidStatusCodeError:
            break
        items[i] = {}
        items[i].update({"name": item.name})
        items[i].update({"attr": [attr.name for attr in item.attributes]})
        items[i].update({"cat": item.category.name})
        items[i].update({
            "fling": [
                item.fling_power, item.fling_effect.name
                if item.fling_effect is not None else None
            ]
        })
        items[i].update({"cost": item.cost})
        print("[DONE] ID: " + str(i) + " | NAME: " + item.name)
        i += 1
    return items
コード例 #4
0
def main():
    page = requests.get("https://www.smogon.com/dex/sm/pokemon/articuno/")
    status = page.status_code
    soup = BeautifulSoup(page.content, 'html.parser')
    scripts = soup.find_all('script')
    body = scripts[0]
    body_text = str(body)
    lines = body_text.splitlines()
    info_line = lines[1]
    split_line = info_line.split("= ")
    json_dict = json.loads(split_line[1])
    #print(type(json_dict['injectRpcs'][2]))
    #print(len(json_dict['injectRpcs'][2]))

    #print(type((json_dict['injectRpcs'][2])[1]))


    #print(((json_dict['injectRpcs'][2])[1])['strategies'])

    #print(len(((json_dict['injectRpcs'][2])[1])['strategies'])) give us a list of dict
    strats_list = (((json_dict['injectRpcs'])[2])[1])['strategies']
    #print(strats_list)
    #print(json.dumps(strats_list[0]))

    client = pokepy.V2Client()
    #print(client.get_pokemon(5).name)

    new_dict = dict()
    new_dict['name'] = "articuno"
    new_dict['presets'] = []
    print(new_dict['name'])
コード例 #5
0
    def __init__(self, idPokemon: str):
        client = pokepy.V2Client()

        self.__pokeApi = client.get_pokemon(
            idPokemon)  #depends on the requests, maybe
        self.__speciesApi = client.get_pokemon_species(
            idPokemon)  #depends on the requests, maybe
        namePokemon = self.__speciesApi.name
        self.name = namePokemon.capitalize()

        self.number = int(self.__pokeApi.id)

        idChain = self.__speciesApi.evolution_chain.url.split("/")[-2]
        self.__chainApi = client.get_evolution_chain(
            idChain).chain  #depends on the requests, maybe

        self.infoPage = f'https://www.serebii.net/pokedex-sm/{self.number:03}.shtml'
        self.iconUrl = f'https://www.serebii.net/pokedex-sm/icon/{self.number:03}.png'
        self.imageUrl = f'https://assets.pokemon.com/assets/cms2/img/pokedex/detail/{self.number:03}.png'

        self.types = list(
            map(lambda a: ((a.type.name).capitalize()), self.__pokeApi.types))
        self.evolvesFrom = self.__speciesApi.evolves_from_species.name.capitalize(
        ) if self.__speciesApi.evolves_from_species else "-"

        root = getEvolutionTree(self.__chainApi)
        evolutions = findEvolutions(root=root, name=namePokemon)
        self.evolvesTo = evolutions if evolutions else "-"
コード例 #6
0
 async def sc(self, ctx, *, poke):
     """포켓몬들의 스텟을 보여줍니다 이름은 영어로 넣어주세요"""
     pokemon = pokepy.V2Client().get_pokemon(str(poke))
     embed = discord.Embed(title=pokemon.name, colour=colour)
     embed.set_image(
         url=
         f"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{pokemon.id}.png"
     )
     embed.add_field(name="채력",
                     value=str(pokemon.stats[0].base_stat),
                     inline=True)
     embed.add_field(name="공격력",
                     value=str(pokemon.stats[1].base_stat),
                     inline=True)
     embed.add_field(name="방어력",
                     value=str(pokemon.stats[2].base_stat),
                     inline=True)
     embed.add_field(name="특수 공격",
                     value=str(pokemon.stats[3].base_stat),
                     inline=True)
     embed.add_field(name="특수 방어",
                     value=str(pokemon.stats[4].base_stat),
                     inline=True)
     embed.add_field(name="스피드",
                     value=str(pokemon.stats[5].base_stat),
                     inline=True)
     embed.add_field(name="타입",
                     value=", ".join(ty.type.name for ty in pokemon.types),
                     inline=True)
     await ctx.send(embed=embed)
コード例 #7
0
def show_name(pokemon):
    """
    This function shows the pokemon
    Args:
        pokemon:  We pass the pokemon as a parameter.
    """
    poke = pokepy.V2Client().get_pokemon(pokemon)
    name = poke.name
    return name
コード例 #8
0
def show_id(pokemon):
    """
    We show the pokemon's identification
    Args:
        pokemon:  We pass the pokemon as a parameter.
    """
    poke = pokepy.V2Client().get_pokemon(pokemon)
    id_poke = poke.id
    return id_poke
コード例 #9
0
ファイル: pokehelper.py プロジェクト: r0adkll/rotom.py
def find_pokemon_api(card):
    """
    Find the pokemon object from the Pokeapi using a given card
    :param card:
    :return:
    """
    name = clean_card_name(card)
    try:
        client = pokepy.V2Client()
        return client.get_pokemon(name)
    except:
        print("Couldn't find pokemon for %s" % name)
        return
コード例 #10
0
ファイル: bot.py プロジェクト: JFalnes/TheNiklasBot
def poke_api(msg):
    """uses pokepy and pokeapi
    https://pokeapi.github.io/pokepy/"""
    try:
        pokemon_name = pokepy.V2Client().get_pokemon(msg)

        response = f'Name: {pokemon_name.name}\n' \
                   f'Weight: {pokemon_name.weight}\n' \
                   f'Type: {pokemon_name.types[0].type.name}'
        return response
    except:
        error_code = f'{msg} IS NOT A POKEMON'
        return error_code
コード例 #11
0
def obtain_img_pokemon(pokemon, ruta=""):
    """
    We can get pokemon's image
    Args:
        pokemon:  We pass the pokemon as a parameter.
        ruta : We pass the route as a parameter.
    """
    if (not os.environ.get('PYTHONHTTPSVERIFY', '')
            and getattr(ssl, '_create_unverified_context', None)):
        ssl._create_default_https_context = ssl._create_unverified_context
    poke = pokepy.V2Client().get_pokemon(pokemon)
    url = poke.sprites.front_default
    urllib.request.urlretrieve(url, ruta + str(pokemon) + ".png")
    return url, ruta
コード例 #12
0
def get_pokemon_name_from_id(pokemon_id: int) -> str:
    """Gets a pokemon's name from ID

    Args:
        pokemon_id: The pokemon's id from its pokedex id

    Returns:
        The pokemon's name as a string
    """
    pokemon_name = pokepy.V2Client().get_pokemon(pokemon_id).name
    if pokemon_name in special_pokemon_names:
        return pokemon_name
    return pokemon_name.split('-')[
        0]  # This gets everything before the first hyphen as some of them
コード例 #13
0
ファイル: dl_utils.py プロジェクト: StJobertus/pb-sim
def get_pokemon(pokemon_name: str):
    """Returns a dictionary containing all necessary data about the pokemon"""
    client = pokepy.V2Client()
    try:
        raw = client.get_pokemon(pokemon_name)
    except InvalidStatusCodeError:
        return
    types = []
    for i in range(len(raw.types) - 1, -1, -1):
        types.append(raw.types[i].type.name)
    abilities = []
    for i in range(len(raw.abilities) - 1, -1, -1):
        abilities.append(raw.abilities[i].ability.name)
    base_stats = []
    for i in range(len(raw.stats) - 1, -1, -1):
        base_stats.append(raw.stats[i].base_stat)
    raw_species = client.get_pokemon_species(pokemon_name)
    move_list = []
    for key in raw.moves:
        move_list.append({
            'name':
            key.move.name,
            'learn_method':
            key.version_group_details[0].move_learn_method.name,
            'level_learned_at':
            key.version_group_details[0].level_learned_at
        })
    move_list.sort(key=itemgetter('level_learned_at'))
    move_list.sort(key=itemgetter('learn_method'))
    poke_data = {
        'name': raw.name,
        'id': raw.id,
        'types': types,
        'abilities': abilities,
        'base_stats': base_stats,
        'base_xp': raw.base_experience,
        'evolution_chain_id':
        int(raw_species.evolution_chain.url.split('/')[-2]),
        'growth_rate': raw_species.growth_rate.name,
        'base_happiness': raw_species.base_happiness,
        'capture_rate': raw_species.capture_rate,
        'gender_rate': raw_species.gender_rate,
        'hatch_counter': raw_species.hatch_counter,
        'moves': move_list
    }
    print(f'{raw.name} was found in the database!')
    return poke_data
コード例 #14
0
    def save(self, commit=True):
        pokemon = super(PokemonForm, self).save(commit=False)
        entered_pkmn = pokepy.V2Client().get_pokemon(self.cleaned_data['pkmn_name'])
        pokemon.pkmn_name = entered_pkmn.name.capitalize()
        pokemon.pkmn_number = entered_pkmn.id
        pokemon.pkmn_type1 = entered_pkmn.types[0].type.name.upper()
        pokemon.ability = entered_pkmn.abilities[0].ability.name.capitalize()

        try:
            pokemon.pkmn_type2 = entered_pkmn.types[1].type.name.upper()
        except IndexError:
            pass

        if commit:
            pokemon.save()

        return pokemon
コード例 #15
0
ファイル: pokeapi.py プロジェクト: CPlusMinus2000/PokeComics
    def get_sprite(self, use_api: bool = False) -> str:
        """
        Gets an image link to the official artwork sprite of
        the Pokémon with name or ID `pokemon`.
        """

        if use_api:
            info = pk.V2Client().get_pokemon(self.name)
            if type(info) == list:
                info = info[0]
            
            return ART % f"{info.name}.png"
        
        elif self.form is not None:
            return ART % f"{self.form}.png"
        else: # Use locally stored files to access IDs          
            return ART % f"{self.name}.png"
コード例 #16
0
def build_moves():
    """
    Args:
        None.
    Returns:
        An object that contains all infortmation we will be containing in our
        pokedex.
    Throws:
        beckett.exceptions.InvalidStatusCodeError
    """

    moves = {}
    client = pokepy.V2Client()
    for i in range(1, 729):
        try:
            move = client.get_move(i)
        except beckett_except.InvalidStatusCodeError:
            break
        moves[i] = {}
        moves[i].update({"name": move.name})
        moves[i].update({"acc": move.accuracy})
        moves[i].update({"effect_chance": move.effect_chance})
        moves[i].update({"pp": move.pp})
        moves[i].update({"priority": move.priority})
        moves[i].update({"power": [move.power, move.damage_class.name]})
        moves[i].update({"ailment": move.meta.ailment.name})
        moves[i].update({"cat": move.meta.category.name})
        moves[i].update({"hits": [move.meta.min_hits, move.meta.max_hits]})
        moves[i].update({"turns": [move.meta.min_turns, move.meta.max_turns]})
        moves[i].update({"drain": move.meta.drain})
        moves[i].update({"heal": move.meta.healing})
        moves[i].update({"crit": move.meta.crit_rate})
        moves[i].update({"ail_chance": move.meta.ailment_chance})
        moves[i].update({"flinch": move.meta.flinch_chance})
        moves[i].update({"stat_chance": move.meta.stat_chance})
        moves[i].update({
            "stat_change":
            [[stat.change, stat.stat.name] for stat in move.stat_changes]
        })
        moves[i].update({"target": move.target.name})
        moves[i].update({"type": move.type.name})
        print("[DONE] ID: " + str(i) + " | NAME: " + move.name)
    return moves
コード例 #17
0
ファイル: dl_utils.py プロジェクト: StJobertus/pb-sim
def get_evolution_chain(chain_id: int):
    """Returns a dictionary containing all necessary data about the evolution chain"""
    client = pokepy.V2Client()
    try:
        raw = client.get_evolution_chain(chain_id)
    except InvalidStatusCodeError:
        return
    stage_1_evolutions = []
    for key in raw.chain.evolves_to:
        try:
            item = key.evolution_details[0].item.name
        except AttributeError:
            item = None
        stage_1_evolutions.append({
            'name': key.species.name,
            'evolution_details': {
                'item': item,
                'min_level': key.evolution_details[0].min_level
            }
        })
    stage_2_evolutions = []
    if len(raw.chain.evolves_to) >= 1:
        for key in raw.chain.evolves_to[0].evolves_to:
            try:
                item = key.evolution_details[0].item.name
            except AttributeError:
                item = None
            stage_2_evolutions.append({
                'name': key.species.name,
                'evolution_details': {
                    'item': item,
                    'min_level': key.evolution_details[0].min_level
                }
            })
    evo_data = {
        'chain_id': raw.id,
        'base': raw.chain.species.name,
        'stage_1_evolutions': stage_1_evolutions,
        'stage_2_evolutions': stage_2_evolutions
    }
    print(f'Evolution chain {chain_id} was found in the database!')
    return evo_data
コード例 #18
0
 async def pokedexcmd(self, message):
     """It is a pokedex"""
     logger.debug("Init Pokedex")
     poke_client = pokepy.V2Client(cache='in_disk')
     logger.debug("PokeAPI Client acquired")
     response = ''
     args = utils.get_args_raw(message)
         
     if len(args) < 1:
         logger.debug("Random Pokemon")
         await utils.answer(message, 'No pokemon name given, getting a random pokemon...')
         await asyncio.sleep(3)
         query = random.randint(1,807)
         response = self.get_info(poke_client, query)
         await utils.answer(message, response)
     else:
         logger.debug("Pokemon "+args)
         input_name = self.parse_args(args) #Replacing white spaces with -
         response = self.get_info(poke_client, input_name)
         await utils.answer(message, response)
コード例 #19
0
ファイル: dl_utils.py プロジェクト: StJobertus/pb-sim
def get_move(move_name: str):
    """Returns a dictionary containing all necessary data about the move"""
    client = pokepy.V2Client()
    try:
        raw = client.get_move(move_name)
    except InvalidStatusCodeError:
        return
    move_data = {
        'name': raw.name,
        'id': raw.id,
        'accuracy': raw.accuracy,
        'power': raw.power,
        'pp': raw.pp,
        'effect_chance': raw.effect_chance,
        'priority': raw.priority,
        'damage_class': raw.damage_class.name,
        'type': raw.type.name,
        'description': raw.effect_entries[0].effect
    }
    print(f'{raw.name} was found in the database!')
    return move_data
コード例 #20
0
def complete_pokemon_movement_data(moves: list) -> OrderedDict:
    """
    Get more data from movement

    :param moves: movements list
    :type moves: list
    :return: Dictionary with power pp and more data
    :rtype: OrderedDict
    """
    client = pokepy.V2Client()
    moves_complete = OrderedDict()

    for move in moves:
        moves_complete[move] = {"pp": 0, "power": 0, "accuracy": 0, 'type': ''}
        response = client.get_move(move)
        moves_complete[move]["accuracy"] = response.accuracy
        moves_complete[move]["power"] = response.power
        moves_complete[move]["pp"] = response.pp
        moves_complete[move]["type"] = response.type.name

    return moves_complete
コード例 #21
0
import pokepy, os
client = pokepy.V2Client(cache='in_disk',
                         cache_location=os.path.join(os.getcwd(), 'data'))
コード例 #22
0
ファイル: pokeapi.py プロジェクト: CPlusMinus2000/PokeComics
        elif not entries and language != "en":
            return "Sorry, I can't find any entries with that language."
        elif not entries:
            return "Weird... I can't find any entries."
        else:
            return random.sample(entries, 1)[0]
    
    def get_size(self) -> str:
        """
        Gets a string representing height and weight (in metric).
        """

        return f"{self.height / 10}m/{self.weight / 10}kg"
    
    def format_gender(self) -> str:
        """
        Returns a string representing gender ratio.
        """

        ratio = self.attrs["gender_rate"]
        if ratio == -1:
            return "Genderless"
        else:
            male, female = "\N{MALE SIGN}", "\N{FEMALE SIGN}"
            return f"{(8 - ratio) / 0.08}% {male}/{ratio / 0.08}% {female}"


if __name__ == "__main__":
    mew = pk.V2Client().get_pokemon("mew")
    print(mew.name)
コード例 #23
0
# -*- coding: utf-8 -*-
"""Pokepy calls module.

This module contains all pokeapi calls that are need in the
whole project. Separating this in a single module, we abstract
the client initiation and can have some more complex API requests
with some logic included.

"""

import pokepy
from random import randrange
from typing import List, Union
from pokemon import Pokemon

client = pokepy.V2Client(cache='in_disk')

def get_move(name: str) -> pokepy.resources_v2.MoveResource:
    return client.get_move(name)

def get_pokemon(identifier: Union[str, int]) -> pokepy.resources_v2.MoveResource:
    return client.get_pokemon(identifier)


def get_random_pokemon(pokemons: int, level: int) -> Pokemon:
    """ Return a random pokémon inside the given limit.
    
    Args:
        pokemons: upper random selection limit (numbered by Pokédex).
        level: level of the random pokémon generated.
    Returns:
コード例 #24
0
ファイル: main.py プロジェクト: madboyop/Inline-Rotom-2.0
import re

import pokepy
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.types import InlineQueryResultArticle, InputTextMessageContent

from pokemon import pokemon_text
from moveset import moveset_text
from locations import locations_text
from markup import data_markup, moveset_markup, locations_markup

from Config import Config

app = Client("Debug")
pk = pokepy.V2Client()
user_dict = {}
with open("src/pkmn.txt") as f:
    pokemon_list = [pkmn[:-1] for pkmn in f.readlines()]


@app.on_inline_query()
def main(app, inline_query):
    if len(inline_query.query) < 3:
        inline_query.answer(results=[],
                            switch_pm_text="Help",
                            switch_pm_parameter="start",
                            cache_time=5)
        return
    matches = [
        pkmn for pkmn in pokemon_list
コード例 #25
0
async def on_message(message):
    if message.author.bot: return
    if message.content == f'{prefix} 문자감지':
        if len(message.attachments):
            try:
                text = await message.attachments[0].read()
                textrecog = text_recognize(kakao_key, text, text_detect(kakao_key, text))
            except Exception as ex:
                if str(ex).startswith('400 Client Error'):
                    await message.channel.send('우어.. 문자 감지를 실패했다..')
                else:
                    await message.channel.send(f'에러...:\n{ex}')
            else:
                recogtext = []
                for onebox in textrecog:
                    if onebox != '':
                        recogtext.append(onebox)
                textder_str = '`, `'.join(recogtext)
                if textder_str == '':
                	await message.channel.send('우어.. 문자 감지를 실패했다..')
                	return
                #end_time = time.time()
                embed = discord.Embed(description=f'감지된 문자\n\n`{textder_str}`')
                embed.set_thumbnail(url=message.attachments[0].url)
                embed.set_footer(text=message.author, icon_url=message.author.avatar_url)
                await message.channel.send(embed=embed)
        else:
            await message.channel.send('우어.. 이미지 제대로 올려라..')
    if message.content.startswith(f"{prefix} 날씨"):
        if message.content[6:] == '' or message.content[6:] == "": return await message.channel.send('우어.. 날씨 지역을 입력해라..')
        try:
            enc_location = parse.quote(message.content[6:]+'날씨')
            hdr = {'User-Agent': 'Mozilla/5.0'}
            url = f'https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query={enc_location}'
            req = Request(url, headers=hdr)
            html = urlopen(req)
            bsObj = bs4.BeautifulSoup(html, "html.parser")
            todayBase = bsObj.find('div', {'class': 'main_info'})

            todayTemp1 = todayBase.find('span', {'class': 'todaytemp'})
            todayTemp = todayTemp1.text.strip()  # 온도

            todayValueBase = todayBase.find('ul', {'class': 'info_list'})
            todayValue2 = todayValueBase.find('p', {'class': 'cast_txt'})
            todayValue = todayValue2.text.strip()  # 밝음,어제보다 ?도 높거나 낮음을 나타내줌

            todayFeelingTemp1 = todayValueBase.find('span', {'class': 'sensible'})
            todayFeelingTemp = todayFeelingTemp1.text.strip()  # 체감온도

            todayMiseaMongi1 = bsObj.find('div', {'class': 'sub_info'})
            todayMiseaMongi2 = todayMiseaMongi1.find('div', {'class': 'detail_box'})
            todayMiseaMongi3 = todayMiseaMongi2.find('dd')
            todayMiseaMongi = todayMiseaMongi3.text  # 미세먼지

            tomorrowBase = bsObj.find('div', {'class': 'table_info weekly _weeklyWeather'})
            tomorrowTemp1 = tomorrowBase.find('li', {'class': 'date_info'})
            tomorrowTemp2 = tomorrowTemp1.find('dl')
            tomorrowTemp3 = tomorrowTemp2.find('dd')
            tomorrowTemp = tomorrowTemp3.text.strip()  # 오늘 오전,오후온도

            tomorrowAreaBase = bsObj.find('div', {'class': 'tomorrow_area'})
            tomorrowMoring1 = tomorrowAreaBase.find('div', {'class': 'main_info morning_box'})
            tomorrowMoring2 = tomorrowMoring1.find('span', {'class': 'todaytemp'})
            tomorrowMoring = tomorrowMoring2.text.strip()  # 내일 오전 온도

            tomorrowValue1 = tomorrowMoring1.find('div', {'class': 'info_data'})
            tomorrowValue = tomorrowValue1.text.strip()  # 내일 오전 날씨상태, 미세먼지 상태

            tomorrowAreaBase = bsObj.find('div', {'class': 'tomorrow_area'})
            tomorrowAllFind = tomorrowAreaBase.find_all('div', {'class': 'main_info morning_box'})
            tomorrowAfter1 = tomorrowAllFind[1]
            tomorrowAfter2 = tomorrowAfter1.find('p', {'class': 'info_temperature'})
            tomorrowAfter3 = tomorrowAfter2.find('span', {'class': 'todaytemp'})
            tomorrowAfterTemp = tomorrowAfter3.text.strip()  # 내일 오후 온도

            tomorrowAfterValue1 = tomorrowAfter1.find('div', {'class': 'info_data'})
            tomorrowAfterValue = tomorrowAfterValue1.text.strip()

            embed = discord.Embed(
            title=message.content[6:]+ ' 날씨 정보',
            description=message.content[6:]+ '날씨 정보입니다.',
            colour=discord.Colour.blue()
            )
            embed.add_field(name='현재온도', value=todayTemp+'˚', inline=False)  # 현재온도
            embed.add_field(name='체감온도', value=todayFeelingTemp, inline=False)  # 체감온도
            embed.add_field(name='현재상태', value=todayValue, inline=False)  # 밝음,어제보다 ?도 높거나 낮음을 나타내줌
            embed.add_field(name='현재 미세먼지 상태', value=todayMiseaMongi, inline=False)  # 오늘 미세먼지
            embed.add_field(name='오늘 오전/오후 날씨', value=tomorrowTemp, inline=False)  # 오늘날씨 # color=discord.Color.blue()
            embed.add_field(name='**----------------------------------**',value='**----------------------------------**', inline=False)  # 구분선
            embed.add_field(name='내일 오전온도', value=tomorrowMoring+'˚', inline=False)  # 내일오전날씨
            embed.add_field(name='내일 오전 날씨 상태, 미세먼지 상태', value=tomorrowValue, inline=False)  # 내일오전 날씨상태
            embed.add_field(name='내일 오후온도', value=tomorrowAfterTemp + '˚', inline=False)  # 내일오후날씨
            embed.add_field(name='내일 오후 날씨 상태, 미세먼지 상태', value=tomorrowAfterValue, inline=False)  # 내일오후 날씨상태


            await message.channel.send(embed=embed)
        except Exception as ex:
            return await message.channel.send(f'에러남.\n{ex}')
    if message.content.startswith(f"{prefix} 타이머"):
        try:
            timer = message.content.split()[2]
            story = message.content.split(" ", maxsplit=3)[3]
            if not timer: return await message.channel.send("시간을 적어주세요.")
            if story:
                if(len(story) > 1000): return await message.channel.send('이런 타이머 끝난 뒤에 받을 메세지가 1000자가 넘네요!')
            if int(timer) <= 0: return await message.channel.send('0초 또는 음수는 안되요..')
            if str(timer) in '.': return await message.channel.send('소수 안됨')
            await message.channel.send(f'{timer}초 뒤에 멘션이 옵니다.\n(봇 꺼지면 안 옴)')
            await asyncio.sleep(int(timer))
            if story: return await message.channel.send(f'<@{message.author.id}>님 **{story}**(이)라고 님이 시킴.(참고: {timer}초)')
            await message.channel.send(f'<@{message.author.id}>님아 시간이 다 됬음.(참고: {timer}초)')
        except Exception as ex: return await message.channel.send('에러남..\n %s'%(ex))
    if message.content == f'{prefix} 지진':
        r = requests.get('https://m.kma.go.kr/m/eqk/eqk.jsp?type=korea').text
        soup = BeautifulSoup(r, "html.parser")
        table = soup.find("table", {"class": "table02 style01"})
        td = table.find_all("td")

        date = earthquake(td[1])
        gyumo = earthquake(td[3])
        jindo = earthquake(td[5])
        location = earthquake(td[7])
        depth = earthquake(td[9])
        detail = earthquake(td[10])

        embed = discord.Embed(description=date, color=discord.Colour.dark_blue())
        try:
            img = soup.find("div", {"class": 'img-center'}).find("img")["src"]
            img = f"http://m.kma.go.kr{img}"
            if img is None:pass
            else: embed.set_image(url=img)
        except: pass

        embed.add_field(name="규모", value=gyumo, inline=True)
        embed.add_field(name="발생위치", value=location, inline=True)
        embed.add_field(name="발생깊이", value=depth, inline=True)
        embed.add_field(name="진도", value=jindo, inline=True)
        embed.add_field(name="참고사항", value=detail, inline=True)
        embed.set_footer(text="기상청")

        await message.channel.send(embed=embed)
    if message.content.startswith(f"{prefix} 카트"):
        try:
            response = requests.get('http://kart.nexon.com/Garage/Main?strRiderID='+message.content[6:])
            response2 = requests.get('http://kart.nexon.com/Garage/Record?strRiderID='+message.content[6:])
            
            readerhtml = response.text
            readerhtml2 = response2.text
            
            soup = BeautifulSoup(readerhtml, 'lxml')
            soup2 = BeautifulSoup(readerhtml2, 'lxml')

            #차고1#
            nick = soup.find('span', {'id' : 'RiderName'}).text #닉네임
            club = soup.find('span', {'id' : 'GuildName'}).text #클럽
            rprank = soup.find('span',{'class' : 'RecordData1'}).text #RP 순위
            rp = soup.find('span',{'class' : 'RecordData2'}).text #RP
            avatar = soup.find('div', {'id' : 'CharInfo'}) #avatar.png
            avatar2 = avatar.find('img').get('src') #avatar.png표시
            
            #차고2#
            cnt = soup2.find('div', {'id' : 'CntRecord2'}) #차고 메인 전체 크롤링
            dlfind = cnt.findAll('dl') #dl태그 찾기
            starty = dlfind[0].find('dd').text[0:4] #게임시작 년
            startm = dlfind[0].find('dd').text[5:7] #게임시작 월
            startd = dlfind[0].find('dd').text[8:10] #게임시작 일
            startday = dlfind[0].find('dd').text[11:] #게임 시작후 지금까지 일
            racing = dlfind[1].find('dd').text #게임시간
            gameon = dlfind[2].find('dd').text #게임 실행
            recenty = dlfind[3].find('dd').text[0:4] #최근 실행 년
            recentm = dlfind[3].find('dd').text[5:7] #최근 실행 월
            recentd = dlfind[3].find('dd').text[8:10] #최근실행 일

            #전체 승률#
            recorddata2 = soup2.find('div', {'id' : 'CntRecord'}) #승률창 크롤링
            allwinrate = recorddata2.find('td',{'class' : 'RecordL2'}).text[0:3] #전체승률 %
            allwin = recorddata2.find('td',{'class' : 'RecordL2'}).text[4:] #전체 전적
            allwinrp = recorddata2.find('td',{'class' : 'RecordL3'}).text #전체 RP 랭킹
            
            #스피드#
            winrate = recorddata2.find('table', {'class' : 'RecordL'}) #스피드 크롤링
            sprate = winrate.findAll('td') #스피드전적창에서 td찾기
            spallrt = sprate[4].text[0:3] #스피드 전체 %
            spallrt2 = sprate[4].text[4:] #스피드 전체 전적
            sprprank = sprate[5].text #스피드 RP 랭킹
            
            #아이템#
            iprallrt = sprate[7].text[0:3] #스피드 크롤링과 같은 클래스 아이템 전체 %
            iprallrt2 = sprate[7].text[4:] #아이템 전체 전적
            iprprank = sprate[8].text #아이템 RP 랭킹
            
            #출력#
            embed = discord.Embed(color=0x900020, title = message.content[6:]) #버건디 컬러 embed + 닉네임
            embed.add_field(name = "NickName", value = nick, inline = True) #닉네임 출력
            embed.add_field(name = "Club", value = club, inline = True) #클럽 출력
            embed.add_field(name = "RP", value = rprank + "\n" + rp, inline = True) #RP순위와 RP출력
            embed.add_field(name = "All Win Rate", value = allwinrate + "\n" + "(" + allwin + ")", inline = True) #전체승률 출력
            embed.add_field(name = "Speed Win Rate", value = spallrt + "\n" + "(" + spallrt2 + ")", inline = True) #스피드 승률 출력
            embed.add_field(name = "Item Win Rate", value = iprallrt + "\n" + "(" + iprallrt2 + ")", inline = True) #아이템 승률 출력
            embed.add_field(name = "All RP", value = allwinrp, inline = True) #전체 RP 출력
            embed.add_field(name = "Speed RP", value = sprprank, inline = True) #스피드 RP 출력
            embed.add_field(name = "Item RP", value = iprprank, inline = True) #아이템 RP 출력
            embed.add_field(name = "Rider Creation", value = f'{starty}년 '+f'{startm}월 '+f'{startd}일' "\n" + startday, inline = True)
            #게임시작일 출력
            embed.add_field(name = "Driving Time", value = racing, inline = True) #주행시간 출력
            embed.add_field(name = "Game Runs", value = gameon, inline = True) #게임 실행 횟수 출력
            embed.add_field(name = "Recent Access", value = f'{recenty}년 '+f'{recentm}월 '+f'{recentd}일') #게임 최근 접속일 출력
            embed.add_field(name="TMI",value=f'[KartRiderTMI](https://tmi.nexon.com/kart/user?nick={nick})') #카트라이더 TMI 연결
            embed.set_footer(text="Source - NextHeroes\nLv2 S2 KartRiderClub NextLv's Bot") #만든 사람
            embed.set_thumbnail(url = avatar2) #avatar.png 출력
            await message.channel.send(embed=embed) #embed 
        except Exception as ex: await message.channel.send('에러가 났네요^^\n{}'.format(ex))
    
    if message.content.startswith(f"{prefix} 롤전적"):
        playerNickname = message.content[7:]
        checkURLBool = urlopen('https://www.op.gg/summoner/userName='******'html.parser')

        RankMedal = bs.findAll('img', {'src': re.compile('\/\/[a-z]*\-[A-Za-z]*\.[A-Za-z]*\.[A-Za-z]*\/[A-Za-z]*\/[A-Za-z]*\/[a-z0-9_]*\.png')})

        mostUsedChampion = bs.find('div', {'class': 'ChampionName'})
        mostUsedChampionKDA  = bs.find('span', {'class': 'KDA'})

        if playerNickname == '':
            embed = discord.Embed(title="소환사 이름이 입력되지 않았습니다!", color=discord.Colour.blue())
            return await message.channel.send(embed=embed)
        elif len(deleteTags(bs.findAll('h2', {'class': 'Title'}))) != 0:
            embed = discord.Embed(title="존재하지 않는 소환사", description="", color=discord.Colour.gold())
            return await message.channel.send(embed=embed)
        else:
            try:
                solorank_Types_and_Tier_Info = deleteTags(bs.findAll('div', {'class': {'RankType', 'TierRank'}}))
                solorank_Point_and_winratio = deleteTags(bs.findAll('span', {'class': {'LeaguePoints', 'wins', 'losses', 'winratio'}}))
                flexrank_Types_and_Tier_Info = deleteTags(bs.findAll('div', {'class': {'sub-tier__rank-type', 'sub-tier__rank-tier', 'sub-tier__league-point', 'sub-tier__gray-text'}}))
                flexrank_Point_and_winratio = deleteTags(bs.findAll('span', {'class': {'sub-tier__gray-text'}}))
                if len(solorank_Point_and_winratio) == 0 and len(flexrank_Point_and_winratio) == 0:
                    embed = discord.Embed(title="소환사 전적검색", description="", color=discord.Colour.dark_gray())
                    embed.add_field(name="Summoner Search From op.gg", value=opggsummonersearch + playerNickname,inline=False)
                    embed.add_field(name="Ranked Solo : Unranked", value="Unranked", inline=False)
                    embed.add_field(name="Flex 5:5 Rank : Unranked", value="Unranked", inline=False)
                    embed.set_thumbnail(url='https:' + RankMedal[0]['src'])
                    embed.set_footer(text='소스 출처: hands8142(Github User)')
                    await message.channel.send("소환사 " + playerNickname + "님의 전적", embed=embed)
                elif len(solorank_Point_and_winratio) == 0:
                    mostUsedChampion = bs.find('div', {'class': 'ChampionName'})
                    mostUsedChampion = mostUsedChampion.a.text.strip()
                    mostUsedChampionKDA = bs.find('span', {'class': 'KDA'})
                    mostUsedChampionKDA = mostUsedChampionKDA.text.split(':')[0]
                    mostUsedChampionWinRate = bs.find('div', {'class': "Played"})
                    mostUsedChampionWinRate = mostUsedChampionWinRate.div.text.strip()
                    FlexRankTier = flexrank_Types_and_Tier_Info[0] + ' : ' + flexrank_Types_and_Tier_Info[1]
                    FlexRankPointAndWinRatio = flexrank_Types_and_Tier_Info[2] + " /" + flexrank_Types_and_Tier_Info[-1]

                    embed = discord.Embed(title="소환사 전적검색", description="", color=discord.Colour.blue())
                    embed.add_field(name="Summoner Search From op.gg", value=opggsummonersearch + playerNickname, inline=False)
                    embed.add_field(name="Ranked Solo : Unranked", value="Unranked", inline=False)
                    embed.add_field(name=FlexRankTier, value=FlexRankPointAndWinRatio, inline=False)
                    embed.add_field(name="Most Used Champion : " + mostUsedChampion, value="KDA : " + mostUsedChampionKDA + " / " + " WinRate : " + mostUsedChampionWinRate, inline=False)
                    embed.set_thumbnail(url='https:' + RankMedal[1]['src'])
                    embed.set_footer(text='소스 출처: hands8142(Github User)')
                    await message.channel.send("소환사 " + playerNickname + "님의 전적", embed=embed)
                elif len(flexrank_Point_and_winratio) == 0:
                    mostUsedChampion = bs.find('div', {'class': 'ChampionName'})
                    mostUsedChampion = mostUsedChampion.a.text.strip()
                    mostUsedChampionKDA = bs.find('span', {'class': 'KDA'})
                    mostUsedChampionKDA = mostUsedChampionKDA.text.split(':')[0]
                    mostUsedChampionWinRate = bs.find('div', {'class': "Played"})
                    mostUsedChampionWinRate = mostUsedChampionWinRate.div.text.strip()
                    SoloRankTier = solorank_Types_and_Tier_Info[0] + ' : ' + solorank_Types_and_Tier_Info[1]
                    SoloRankPointAndWinRatio = solorank_Point_and_winratio[0] + "/ " + solorank_Point_and_winratio[1] + " " + solorank_Point_and_winratio[2] + " /" + solorank_Point_and_winratio[3]

                    embed = discord.Embed(title="소환사 전적검색", description="", color=discord.Colour.blue())
                    embed.add_field(name="Summoner Search From op.gg", value=opggsummonersearch + playerNickname, inline=False)
                    embed.add_field(name=SoloRankTier, value=SoloRankPointAndWinRatio, inline=False)
                    embed.add_field(name="Flex 5:5 Rank : Unranked", value="Unranked", inline=False)
                    embed.add_field(name="Most Used Champion : " + mostUsedChampion, value="KDA : " + mostUsedChampionKDA + " / " + "WinRate : " + mostUsedChampionWinRate, inline=False)
                    embed.set_thumbnail(url='https:' + RankMedal[0]['src'])
                    embed.set_footer(text='소스 출처: hands8142(Github User)')
                    await message.channel.send("소환사 " + playerNickname + "님의 전적", embed=embed)
                else:
                    solorankmedal = RankMedal[0]['src'].split('/')[-1].split('?')[0].split('.')[0].split('_')
                    flexrankmedal = RankMedal[1]['src'].split('/')[-1].split('?')[0].split('.')[0].split('_')
                    SoloRankTier = solorank_Types_and_Tier_Info[0] + ' : ' + solorank_Types_and_Tier_Info[1]
                    SoloRankPointAndWinRatio = solorank_Point_and_winratio[0] + "/ " + solorank_Point_and_winratio[1] + " " + solorank_Point_and_winratio[2] + " /" + solorank_Point_and_winratio[3]
                    FlexRankTier = flexrank_Types_and_Tier_Info[0] + ' : ' + flexrank_Types_and_Tier_Info[1]
                    FlexRankPointAndWinRatio = flexrank_Types_and_Tier_Info[2] + " /" + flexrank_Types_and_Tier_Info[-1]
                    mostUsedChampion = bs.find('div', {'class': 'ChampionName'})
                    mostUsedChampion = mostUsedChampion.a.text.strip()
                    mostUsedChampionKDA = bs.find('span', {'class': 'KDA'})
                    mostUsedChampionKDA = mostUsedChampionKDA.text.split(':')[0]
                    mostUsedChampionWinRate = bs.find('div', {'class': "Played"})
                    mostUsedChampionWinRate = mostUsedChampionWinRate.div.text.strip()
                    cmpTier = tierCompare(solorankmedal[0], flexrankmedal[0])
                    embed = discord.Embed(title="소환사 전적검색", description="", color=discord.Colour.blue())
                    embed.add_field(name="Summoner Search From op.gg", value=opggsummonersearch + playerNickname, inline=False)
                    embed.add_field(name=SoloRankTier, value=SoloRankPointAndWinRatio, inline=False)
                    embed.add_field(name=FlexRankTier, value=FlexRankPointAndWinRatio, inline=False)
                    embed.set_footer(text='소스 출처: hands8142(Github User)')
                    embed.add_field(name="Most Used Champion : " + mostUsedChampion, value="KDA : " + mostUsedChampionKDA + " / " + " WinRate : " + mostUsedChampionWinRate, inline=False)
                    
                    if cmpTier == 0:
                        embed.set_thumbnail(url='https:' + RankMedal[0]['src'])
                    elif cmpTier == 1:
                        embed.set_thumbnail(url='https:' + RankMedal[1]['src'])
                    else:
                        if solorankmedal[1] > flexrankmedal[1]:
                            embed.set_thumbnail(url='https:' + RankMedal[0]['src'])
                        elif solorankmedal[1] < flexrankmedal[1]:
                            embed.set_thumbnail(url='https:' + RankMedal[0]['src'])
                        else:
                            embed.set_thumbnail(url='https:' + RankMedal[0]['src'])
                    await message.channel.send("소환사 " + playerNickname + "님의 전적", embed=embed)
                
            except Exception as e:
                await message.channel.send(f'😥 에러가 났습니다..(주륵)\n{e}')

    if message.content == f"{prefix} 뉴스":
        html = urllib.request.urlopen('https://news.naver.com/')
        bsObj = bs4.BeautifulSoup(html, "html.parser")
        news = bsObj.select('#today_main_news > div.hdline_news > ul > li > div.hdline_article_tit > a')
        str_ = ''
        for a in news:
            str_ += f'`{a.text.strip()}`\n\n'
        
        await message.channel.send(str_)

    if message.content == f"{prefix} 유명인":
        if not len(message.attachments): return await message.channel.send('우어.. 이미지 제대로 올려라..')
        try:
            text = await message.attachments[0].read()
            files = {'image': text}
            headers = {"X-Naver-Client-Id": 'Zf95N7IPgvO8Sj_FM4hv', "X-Naver-Client-Secret": '9AMXsj3CQo'}
            response = requests.post('https://openapi.naver.com/v1/vision/celebrity',  files=files, headers=headers)
            rescode = response.status_code
            if(rescode==200):
                result = json.loads(response.text)
                embed = discord.Embed(description='인식한 유명인(신뢰도: {}%)\n\n**이름**\n{}'.format(round(result['faces'][0]['celebrity']['confidence'] * 100, 2), result['faces'][0]['celebrity']['value']), colour=discord.Colour.blue())
                embed.set_footer(text='정확하지 않을 수 있음', icon_url=message.author.avatar_url)
                await message.channel.send(embed=embed)
            else:
                await message.channel.send('에러 코드\n{}'.format(rescode))
        except Exception as ex: return await message.channel.send('에러남.\n{}'.format(ex))

    if message.content.startswith(f"{prefix} pyeval"):
        if message.author.id != 674877162557407242: return await message.channel.send("봇 주인만 가능!")
        if message.content[11:] == '' or message.content[11:] == " ":
            await message.channel.send('`존비야 pyeval <PY_command>`')
            return
        try:
            embed = discord.Embed(title='python eval', description='**📥 Input: **\n```py\n{}```\n**📤 Output: **\n```py\n{}\n```'.format(message.content[11:], eval(message.content[11:])))
            embed.set_footer(text=message.author, icon_url=message.author.avatar_url)
            await message.channel.send(embed=embed)
        except Exception as ex:
            embed = discord.Embed(title='python eval Error...', description='**📥 Input: **\n```py\n{}```\n**📤 Output: **\n```py\n{}\n```'.format(message.content[11:], ex))
            embed.set_footer(text=message.author, icon_url=message.author.avatar_url)
            await message.channel.send(embed=embed)

    if message.content == f'{prefix} 업다운':
        if await is_gaming(message): return
        gaming_list.append(message.author.id)
        correct = random.randint(1, 50)
        count = 5
        log = ''
        embed = discord.Embed(title="업다운", description="5번의 기회만 주어집니다. 신중히 선택해주세요! \n**1~%s**안의 숫자를 입력해주세요."%(50))
        embed.set_footer(text="게임을 그만하려면 '취소'를 입력하세요.")
        try:
            msg = await message.channel.send(embed=embed)

            while count > 0:
                def check_updown_input(m):
                    try:
                        int(m.content)
                        return (
                            m.channel == message.channel
                            and m.author == message.author
                            and int(m.content) in list(range(1, 50+1))
                        )
                    except:
                        if (m.channel == message.channel and m.author == message.author and m.content == '취소'):return True
                        else:return False
            
                user_input = await client.wait_for("message", check=check_updown_input, timeout=30)

                try:
                    await user_input.delete()
                except: pass

                if user_input.content == f'취소':
                    embed = discord.Embed(title="게임 취소됨", description="게임이 취소되었습니다!")
                    await message.channel.send(embed=embed)
                    break
                else:
                    if (int(user_input.content)) == correct:
                        embed = discord.Embed(title="정답이에요!", description="축하해요! 정답입니다!")
                        await message.channel.send(embed=embed)
                        break
                    elif int(user_input.content) > correct:
                        count -= 1
                        embed = discord.Embed(description="입력하신 숫자보다 정답이 낮아요! %s회 남았어요." % (str(count)))
                        await message.channel.send(embed=embed)
                        log += '%s - 🔽 Down\n'%(user_input.content)
                        embed = discord.Embed(title="업다운", description="%s번의 기회가 남았습니다! 신중히 선택해주세요! \n**1~%s**안의 숫자를 입력해주세요.\n\n%s"%(int(count), 50, log))
                        embed.set_footer(text="게임을 그만하려면 '%s 취소'를 입력하세요."%(prefix))
                        await msg.edit(embed=embed)
                    elif int(user_input.content) < correct:
                        count -= 1
                        embed = discord.Embed(description="입력하신 숫자보다 정답이 높아요! %s회 남았어요." % (str(count)))
                        await message.channel.send(embed=embed)
                        log += '%s - 🔼 Up\n'%(user_input.content)
                        embed = discord.Embed(title="업다운", description="%s번의 기회가 남았습니다! 신중히 선택해주세요! \n**1~%s**안의 숫자를 입력해주세요.\n\n%s"%(int(count), 50, log))
                        embed.set_footer(text="게임을 그만하려면 '%s 취소'를 입력하세요."%(prefix))
                        await msg.edit(embed=embed)
                    if count == 0:
                        embed = discord.Embed(description="5번 안에 답을 맞추지 못 했네요.. 답은 %s였어요!\n\n%s" % (str(correct), log))
                        await message.channel.send(embed=embed)

            gaming_list.remove(message.author.id)
        except Exception as ex:
            gaming_list.remove(message.author.id)
            await message.channel.send('게임에 오류가 발생하여 게임을 중지했습니다..\n{}'.format(ex))
    
    if message.content == f'{prefix} 캡챠':
        code = "0"
        url = f"https://openapi.naver.com/v1/captcha/nkey?code={code}"
        request = urllib.request.Request(url)
        request.add_header("X-Naver-Client-Id", client_id)
        request.add_header("X-Naver-Client-Secret", client_secret)
        response = urllib.request.urlopen(request)
        rescode = response.getcode()
        if rescode == 200:
            response_body = response.read()
            key = response_body.decode('utf-8')
            key = json.loads(key)
            key = key['key']
            url = "https://openapi.naver.com/v1/captcha/ncaptcha.bin?key=" + key
            request = urllib.request.Request(url)
            request.add_header("X-Naver-Client-Id", client_id)
            request.add_header("X-Naver-Client-Secret", client_secret)
            response = urllib.request.urlopen(request)
            rescode = response.getcode()
            if rescode == 200:
                response_body = response.read()
                name = str(message.author.id) + '.png'
                with open(name, 'wb') as f:
                    f.write(response_body)
                await message.channel.send(file=discord.File(str(message.author.id) + '.png'))

                def check(msg):
                    return msg.author == message.author and msg.channel == message.channel

                try:
                    msg = await client.wait_for("message", timeout=60, check=check)
                except:
                    await message.channel.send("시간초과입니다.")
                    return

                code = "1"
                value = msg.content
                url = "https://openapi.naver.com/v1/captcha/nkey?code=" + code + "&key=" + key + "&value=" + str(quote(value))
                request = urllib.request.Request(url)
                request.add_header("X-Naver-Client-Id", client_id)
                request.add_header("X-Naver-Client-Secret", client_secret)
                response = urllib.request.urlopen(request)
                rescode = response.getcode()
                if (rescode == 200):
                    response_body = response.read()
                    sid = response_body.decode('utf-8')
                    answer = json.loads(sid)
                    answer = answer['result']
                    time = json.loads(sid)
                    time = time['responseTime']
                    if str(answer) == 'True':
                        await message.channel.send("정답입니다. 걸린시간:" + str(time) + '초')
                    if str(answer) == 'False':
                        await message.channel.send("틀리셨습니다. 걸린시간:" + str(time) + '초')
                else:
                    print("Error Code:" + rescode)
            else:
                print("Error Code:" + rescode)
        else:
            print("Error Code:" + rescode)
    
    if message.content == f'{prefix} 지뢰찾기' or message.content == f'{prefix} 지뢰':
        init_map = [
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', ''],
            ['', '', '', '', '', '', '', '']
        ]
        zz = ['0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟', '🟧', '🟪', ':bomb:']
        now_map = zzz(init_map, zz)
        c = 0
        for i in range(7):
            for j in range(7):
                if now_map[i][j] in '||:bomb:||':
                    c += 1

        await message.channel.send(embed=discord.Embed(description=f"지뢰 갯수: {c}개\n{get_playlist(now_map)}", color=discord.Colour.blue()).set_footer(text="스포일러를 클릭해주세요!"))

    if message.content.startswith(f'{prefix} 포켓검색') or message.content.startswith(f'{prefix} 포켓몬'):
        try:
            PoketmonNickName = message.content[8:]
            if PoketmonNickName == '' or PoketmonNickName == ' ': return await message.channel.send('뒤에다가 포켓몬 이름을 영어로 적어라..')
            pokemon = pokepy.V2Client().get_pokemon(str(PoketmonNickName))
            embed = discord.Embed(title=pokemon.name, color=discord.Colour.dark_green()).set_thumbnail(url=f"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{pokemon.id}.png").add_field(name='체력', value=str(pokemon.stats[0].base_stat), inline=True)
            embed.add_field(name="공격력", value=str(pokemon.stats[1].base_stat), inline=True)
            embed.add_field(name="방어력", value=str(pokemon.stats[2].base_stat), inline=True)
            embed.add_field(name="특수 공격", value=str(pokemon.stats[3].base_stat), inline=True)
            embed.add_field(name="특수 방어", value=str(pokemon.stats[4].base_stat), inline=True)
            embed.add_field(name="스피드", value=str(pokemon.stats[5].base_stat), inline=True)
            embed.add_field(name="타입", value=", ".join(ty.type.name for ty in pokemon.types), inline=True)
            await message.channel.send(embed=embed)
        except Exception as ex: await message.channel.send(f'에러남.\n{ex}')
    
    if message.content.startswith(f'{prefix} 메이플'):
        try:
            mapleLink = "https://maplestory.nexon.com"
            mapleCharacterSearch = "https://maplestory.nexon.com/Ranking/World/Total?c="
            mapleUnionLevelSearch = "https://maplestory.nexon.com/Ranking/Union?c="
            playerNickname = ''.join((message.content).split(' ')[2:])
            html = urlopen(mapleCharacterSearch + quote(playerNickname))
            bs = BeautifulSoup(html, 'html.parser')
            html2 = urlopen(mapleUnionLevelSearch + quote(playerNickname))
            bs2 = BeautifulSoup(html2,'html.parser')

            if len(message.content.split(" ")) == 2:
                embed = discord.Embed(title="닉네임이 입력되지 않았습니다", description="", color=discord.Colour.red())
                await message.channel.send(embed=embed)
            elif bs.find('tr', {'class': 'search_com_chk'}) == None:
                embed = discord.Embed(title="해당 닉네임을 가진 플레이어가 존재하지 않습니다!", description="", color=discord.Colour.red())
                await message.channel.send(embed=embed)
            else:
                characterRankingLink = bs.find('tr', {'class': 'search_com_chk'}).find('a', {'href': re.compile('\/Common\/Character\/Detail\/[A-Za-z0-9%?=]*')})['href']
                characterUnionRanking = bs2.find('tr', {'class': 'search_com_chk'})
                if characterUnionRanking == None: pass
                else:
                    characterUnionRanking = characterUnionRanking.findAll('td')[2].text
                html = urlopen(mapleLink + characterRankingLink)
                bs = BeautifulSoup(html, 'html.parser')
                personalRankingPageURL = bs.find('a', {'href': re.compile('\/Common\/Character\/Detail\/[A-Za-z0-9%?=]*\/Ranking\?p\=[A-Za-z0-9%?=]*')})['href']
                html = urlopen(mapleLink + personalRankingPageURL)
                bs = BeautifulSoup(html, 'html.parser')
                popularityInfo = bs.find('span',{'class' : 'pop_data'}).text.strip()
                getCharacterImage = bs.find('img',{'src': re.compile('https\:\/\/avatar\.maplestory\.nexon\.com\/Character\/[A-Za-z0-9%?=/]*')})['src']
                infoList = []
                RankingInformation = bs.findAll('dd')
                for inf in RankingInformation:
                    infoList.append(inf.text)
                embed = discord.Embed(title="플레이어 " + playerNickname + " 정보", description=infoList[0] + " | " +infoList[1] + " | " + "Server : " + infoList[2], color=0x5CD1E5)
                embed.add_field(name="아래를 클릭해 해당 플레이어의 정보를 확인하세요!", value = f'[여기를 클릭하세요!]({mapleLink + personalRankingPageURL})', inline=False)
                embed.add_field(name="전체 순위",value=infoList[4], inline=True)
                embed.add_field(name="세계 랭킹", value=infoList[6], inline=True)
                embed.add_field(name="직업 순위", value=infoList[8], inline=True)
                embed.add_field(name="인기 순위", value=infoList[10] + "(" +popularityInfo + ")", inline=True)
                if characterUnionRanking == None:
                    embed.add_field(name="Maple Union", value=infoList[12],inline=True)
                else:
                    embed.add_field(name="Maple Union", value=infoList[12] + "(LV." + characterUnionRanking + ")", inline=True)
                embed.add_field(name="성취 순위", value=infoList[14], inline=True)
                embed.set_thumbnail(url='https://ssl.nx.com/s2/game/maplestory/renewal/common/logo.png')
                embed.set_footer(text='Service provided by Hoplin.',icon_url='https://avatars2.githubusercontent.com/u/45956041?s=460&u=1caf3b112111cbd9849a2b95a88c3a8f3a15ecfa&v=4')
                await message.channel.send("플레이어 " + playerNickname +" 정보", embed=embed)
        except Exception as ex: await message.channel.send(f'에러남.\n{ex}')

    if message.content.startswith(f'{prefix} 틱택토'):
        if isinstance(message.channel, discord.channel.DMChannel): return
        if await is_gaming(message): return
        gaming_list.append(message.author.id)
        try:
            m = await message.channel.send(embed=discord.Embed(description="\\✅를 눌러 게임을 시작하고\n\\❌를 눌러 매칭을 취소하세요!", color=discord.Colour.blue()))
            await m.add_reaction("✅")
            await m.add_reaction("❌")
            def check_emoji(reaction, user):
                if user.id == message.author.id and str(reaction) == "❌": return True
                return (
                    user != message.author
                    and str(reaction.emoji) == "✅"
                    and user.id != client.user.id
                    and reaction.message.id == m.id
                    and not user.id in gaming_list
                    and not user.author.bot
                )
            try:
                reaction, user = await client.wait_for("reaction_add", check=check_emoji, timeout=60.0)
                if str(reaction) == "❌":
                    gaming_list.remove(message.author.id)
                    return await message.channel.send(embed=discord.Embed(description="매칭이 취소되었어요!", color=discord.Colour.blue()))
                elif str(reaction) == "✅":
                    gaming_list.append(user.id)
                    playlist = random.sample([message.author.id, user.id], 2)
                    ox = random.sample(["⭕", "❌"], 2)
                    list_ = [
                        ["1️⃣", "2️⃣", "3️⃣"],
                        ["4️⃣", "5️⃣", "6️⃣"],
                        ["7️⃣", "8️⃣", "9️⃣"]
                    ]
                    now_board = get_playlist(list_)
                    pae = {playlist[0]: ox[0], playlist[1]: ox[1]}
                    aa = list(range(1, 10))
                    p = await message.channel.send(embed=discord.Embed(description="%s\n\n%s - %s\n%s - %s"%(now_board, client.get_user(playlist[0]), ox[0], client.get_user(playlist[1]), ox[1]), color=discord.Colour.blue()))
                    game = True
                    count = 0
                    while game:
                        for c in playlist:
                            count += 1
                            await p.edit(embed=discord.Embed(description="%s님의 턴!\n\n%s\n\n%s - %s\n%s - %s"%(client.get_user(c), now_board, client.get_user(playlist[0]), ox[0], client.get_user(playlist[1]), ox[1]), color=discord.Colour.blue()))
                            try:
                                def check_msg(m):
                                    try:
                                        content = int(m.content)
                                    except: return False
                                    return (
                                        m.channel == message.channel
                                        and m.author.id == c
                                        and content in aa
                                    )
                                
                                msg = await client.wait_for("message", check=check_msg, timeout=30)
                                try: await msg.delete()
                                except: pass
                                aa.remove(int(msg.content))
                                list_ = change_board(pae[c], list_, int(msg.content))
                                now_board = get_playlist(list_)
                                if check_win(list_):
                                    await p.edit(embed=discord.Embed(description="🏆 %s님의 우승!\n\n%s\n\n%s - %s\n%s - %s"%(client.get_user(c), now_board, client.get_user(playlist[0]), ox[0], client.get_user(playlist[1]), ox[1]), color=discord.Colour.blue()))
                                    await message.channel.send(embed=discord.Embed(title="🏆 %s님의 우승!"%(client.get_user(c)), color=discord.Colour.blue()))
                                    game = False
                                    break
                                if check_draw(list_):
                                    await p.edit(embed=discord.Embed(description="무승부!\n\n%s\n\n%s - %s\n%s - %s"%(now_board, client.get_user(playlist[0]), ox[0], client.get_user(playlist[1]), ox[1]), color=discord.Colour.blue()))
                                    await message.channel.send(embed=discord.Embed(title="무승부!", color=discord.Colour.blue()))
                                    game = False
                                    break
                                if count == 5:
                                    await p.delete()
                                    p = await message.channel.send(embed=discord.Embed(description="%s님의 턴!\n\n%s\n\n%s - %s\n%s - %s"%(client.get_user(c), now_board, client.get_user(playlist[0]), ox[0], client.get_user(playlist[1]), ox[1]), color=discord.Colour.blue()))
                            except asyncio.TimeoutError:
                                await message.channel.send("시간이 초과되어 %s님이 패배.."%(client.get_user(c)))
                                game = False
                                break
                            except Exception as ex:
                                await message.channel.send("에러가 나 %s님이 패배..\n에러: %s"%(client.get_user(c),ex))
                                game = False
                                break
                    gaming_list.remove(message.author.id)
                    gaming_list.remove(user.id)
            except asyncio.TimeoutError:
                gaming_list.remove(message.author.id)
                return await message.channel.send("시간이 초과되어 매칭이 취소됬어요!")
            except Exception as ex:
                gaming_list.remove(message.author.id)
                return await message.channel.send("삐--\n%s"%(e))
        except Exception as ex:
            gaming_list.remove(message.author.id)
            await message.channel.send("네. 에러\n%s"%(ex))
    
    if message.content.startswith(f'{prefix} 마크서버'):
        name = message.content[9:]
        if name == "" or name == " ": return await message.channel.send("마크 서버 이름을 안 적었네요.")
        try:
            server = MinecraftServer.lookup(name)
            status = server.status()
        except:
            return await message.channel.send(embed=discord.Embed(description='서버가 오프라인이거나,\n존재하지 않는 서버 주소입니다.', colour=discord.Colour.red()))
        try:
            astr = ''
            if str(type(status.description)) == "<class 'dict'>" and status.description["extra"]:
                des = status.description["extra"]
                for i in des:
                    astr += f"{i['text']}"
            else: astr = status.description
            await message.channel.send(embed=discord.Embed(title = f'`{name}` 서버 상태', description = f'[자세히 보러가기](https://mcsrvstat.us/server/{name})\n\n상태 : 온라인\n접속 유저 : {status.players.online}\n서버 버전 : {status.version}\n서버 속도 (서버 핑) : {status.latency} ms\n\n서버 설명 : \n{astr}', colour=discord.Colour.blue()).set_footer(text=f"이 정보는 사실과 차이가 있을수 있습니다."))
        except Exception as ex:
            await message.channel.send(embed=discord.Embed(title=f'서버가 오프라인이거나 에러가 났습니다.\n{ex}', colour=discord.Colour.red()))
コード例 #26
0
 def __init__(self):
     # Create a client for API calls.
     self.client = pokepy.V2Client()
コード例 #27
0
ファイル: bot.py プロジェクト: lexsys-dev/pokebot
ABOUT_TEXT = 'Bot made by Abhay Kshatriya.\n Hosted by lexsys'
HELP_TEXT = """
Lista de comandos disponíveis:
/ajuda - Apresenta esta lista
/about - About the bot
Modules:
/pokedex - Gets the ability, type and learnset of a Pokemon
/ability - Get info about an ability/a Pokemon's all abilities
/learnset - Get Bulbapedia link to Learnset of a Pokemon
/pic - Get a Pokemon's sprite
/random - Get a random pokemon
/type - Get a Pokemon's type(s) and type weaknesses
/starter - Gets you your own unique starter pokemon
"""

poke_client = pokepy.V2Client(cache='in_disk',
                              cache_location=(os.environ['HOME'] + '/.cache'))


def parse_args(args):
    return '-'.join(args).lower()


def start(update, context):
    update.message.reply_text(text=START_TEXT)


def about(update, context):
    update.message.reply_text(text=ABOUT_TEXT)


def get_help(update, context):
コード例 #28
0
import math

import discord
import pokepy
from discord.ext import commands
from utils import globalcommands

gcmds = globalcommands.GlobalCMDS()
poke_bot = pokepy.V2Client(cache='in_disk', cache_location="./pokepy_cache")
move_status_icon_urls = [
    "https://oyster.ignimgs.com/mediawiki/apis.ign.com/pokemon-switch/e/ef/Physical.png?width=325",
    "https://oyster.ignimgs.com/mediawiki/apis.ign.com/pokemon-switch/2/24/Special.png?width=325",
    "https://oyster.ignimgs.com/mediawiki/apis.ign.com/pokemon-switch/d/d0/Status.png?width=325"
]
"""
German Translation for the ability command is thanks to Isabelle. Thank you so much. I wouldn't have been able to make
high quality translations that are actually grammatically correct.
"""


class Pokedex(commands.Cog):
    def __init__(self, bot):
        global gcmds
        self.bot = bot
        gcmds = globalcommands.GlobalCMDS(self.bot)

    def truncate(self, number: float, decimal_places: int) -> float:
        stepper = 10.0**decimal_places
        return math.trunc(stepper * number) / stepper

    async def check_pokemon(self, name: str) -> pokepy.api.rv2.PokemonResource:
コード例 #29
0
__author__ = 'Tom Riddle'
import pokepy
# client for the api
client = pokepy.V2Client()

# a list of all types
types = [
    "normal", "fire", "water", "elecric", "grass", "ice", "fighting", "poison",
    "ground", "flying", "psychic", "bug", "rock", "ghost", "dragon", "dark",
    "steel", "fairy"
]


def get_num(attacker, defender):
    """
        A function that gets the effectiveness of one type against another using the api
        Input - attacker, defender
        Output - the effectiveness of the attacker agaist the defender
    """

    global client
    type = client.get_type(attacker)[0]
    zero = [x.name for x in type.damage_relations.no_damage_to]

    half = [x.name for x in type.damage_relations.half_damage_to]

    double = [x.name for x in type.damage_relations.double_damage_to]

    if defender in zero:
        return 0
    if defender in half:
コード例 #30
0
ファイル: pokedex.py プロジェクト: pointtonull/poke-bard
import re

import pokepy

from . import shakespeare

POKEDEX = pokepy.V2Client()
TRANSFORMS = [
    (re.compile(r"\n"), r" "),
    (re.compile(r"\f"), r" "),
    (re.compile(r"  "), r" "),
]


class PokemonNotFoundError(ValueError):
    pass


def _clean_description(description: str) -> str:
    """
    Some text that is available in pokeapi has been stripped from Games .dat
    and ROM images, without data cleaning. This mean the original non-printable
    screen control characters are kept in many cases.

    This function takes a description and returns a version with these
    characters removed.
    """
    description = description.strip()
    for pattern, replacement in TRANSFORMS:
        description = pattern.sub(replacement, description)
    return description