Ejemplo n.º 1
0
    async def league(self, ctx, username):
        my_region = "na1"
        summoner = config.watcher.summoner.by_name(my_region, username)
        summoner_id = str(summoner['id'])
        champion_info = config.watcher.champion_mastery.by_summoner(
            my_region, summoner_id)
        dd = ddragon.ddragon()
        champ = []
        champ_lvl = []
        champ_play = []
        for i in range(5):
            champion_info[i]['lastPlayTime'] = datetime.utcfromtimestamp(
                champion_info[i]['lastPlayTime'] / 1000).strftime('%b %d, %Y')
            champion_info[i]['championId'] = dd.getChampion(
                champion_info[i]['championId']).name
            if champion_info[i]['chestGranted'] == "True":
                champion_info[i]['chestGranted'] = "Yes"
            else:
                champion_info[i]['chestGranted'] = "No"
            champ.append(f"{champion_info[i]['championId']}")
            champ_list = '\n'.join(map(str, champ))
            champ_lvl.append(f"{champion_info[i]['championLevel']}")
            champ_level = '\n'.join(map(str, champ_lvl))
            champ_play.append(f"{champion_info[i]['lastPlayTime']}")
            champ_playtime = '\n'.join(map(str, champ_play))

        lol_embed = discord.Embed(title=f"{username}'s Summoner Stats",
                                  color=discord.Color.blue())
        lol_embed.add_field(name="Champion", value=champ_list)
        lol_embed.add_field(name="Champion Level", value=champ_level)
        lol_embed.add_field(name="Last Played", value=champ_playtime)
        lol_embed.set_thumbnail(
            url=dd.getIcon(summoner['profileIconId']).image)
        await ctx.send(embed=lol_embed)
Ejemplo n.º 2
0
 def setValue(self, data):
     dd = ddragon.ddragon()
     self.content["itemId"].setValue(data)
     if data > 0:
         self.content["itemName"].setValue(dd.getItem(data).name)
         self.content["itemImage"].setValue(dd.getItem(data).image)
         self.content["tooltips"].setValue(
             "http://tooltips.canisback.com/{lang}/item/{id}".format(
                 lang="en", id=data))
Ejemplo n.º 3
0
 def setValue(self, data):
     dd = ddragon.ddragon()
     self.content["runeId"].setValue(data)
     if data > 6000:
         self.content["runeName"].setValue(dd.getRune(data).name)
         self.content["runeImage"].setValue(dd.getRune(data).image)
     else:
         self.content["runeName"].setValue(statsShards[data]["name"])
         self.content["runeImage"].setValue(statsShards[data]["image"])
Ejemplo n.º 4
0
 def setValue(self, data):
     dd = ddragon.ddragon()
     self.content["championId"].setValue(data)
     if data == -1:
         self.content["championName"].setValue("none")
         self.content["championImage"].setValue("http://raw.communitydragon.org/latest/plugins/rcp-fe-lol-champ-select/global/default/images/champion-grid/random-champion.png")
         
     else:
         self.content["championName"].setValue(dd.getChampion(data).name)
         self.content["championImage"].setValue(dd.getChampion(data).image)
Ejemplo n.º 5
0
    def setValue(self, data):
        for k in self.content:
            if k in data.keys():
                self.content[k].setValue(data[k])

        dd = ddragon.ddragon()
        self.content["championName"].setValue(
            dd.getChampion(data["championId"]).name)
        self.content["championIcon"].setValue(
            dd.getChampion(data["championId"]).image)
        self.content["image"].setValue(
            "http://forum.canisback.com/img/level_" +
            str(data["championLevel"]) + ".png")
import re
from lol_beautify_gdocs.gdocs_utils import get_document_id, get_service
from static_data import ddragon
from lol_beautify_gdocs.hardcoded_variables import other_pictures_dict

dd = ddragon.ddragon()


def beautify_document(document_descriptor: str):
    """
    Parameter
    ----------
    document : str
        url or id of the document; must have write access by the authenticated user
    """
    service = get_service()

    document_id = get_document_id(document_descriptor)

    document = service.documents().get(documentId=document_id).execute()
    content = document.get('body').get('content')

    images_requests = []
    tags_removal_requests = []
    # Regex catching numbers into <...>
    tag_regex = re.compile('[0-9]+<.*?>')

    for section in content:
        if 'paragraph' not in section:
            continue
        for element in section['paragraph']['elements']:
Ejemplo n.º 7
0
 def setValue(self, data):
     dd = ddragon.ddragon()
     self.content["spellId"].setValue(data)
     self.content["spellName"].setValue(dd.getSummoner(data).name)
     self.content["spellImage"].setValue(dd.getSummoner(data).image)