Пример #1
0
def cetus(args, client, world='Cetus'):
    platform = '_'.join(args[1:]).lower()
    if platform == 'switch' or platform == 'nintendo':
        platform = 'swi'
    elif platform == 'xbox':
        platform = "xb1"
    elif platform == '':
        platform = 'pc'
    elif platform not in ("pc", "ps4", "xb1", "swi"):
        return discord.Embed(title=world, description=Traduction.platformfail(platform), color=0xFF0000)
    if world == 'Cetus':
        data = json.loads(importjson('https://api.warframestat.us/' + platform + '/cetusCycle'))
        isDay = data['state']
        timeLeft = data['timeLeft']
        embed = discord.Embed(title="Cetus", description=" ".join(args), color=0xD8A24A)
        embed.set_thumbnail(
            url='https://vignette.wikia.nocookie.net/warframe/images/3/32/OstronSyndicateFlag.png/revision/latest?cb=20171021133528&path-prefix=fr')
        embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                         url='https://discordbots.org/bot/591950764289818634')
        embed.add_field(name=Traduction.Day(isDay), value=Traduction.timeleft() + timeLeft)
        return embed
    if world == 'Earth':
        data = json.loads(importjson('https://api.warframestat.us/' + platform + '/earthCycle'))
        isDay = data['state']
        timeLeft = data['timeLeft']
        embed = discord.Embed(title="Earth", description=" ".join(args), color=0x3565A9)
        embed.set_thumbnail(
            url='https://vignette.wikia.nocookie.net/warframe/images/1/1e/Earth.png/revision/latest/scale-to-width-down/350?cb=20161016212227')
        embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                         url='https://discordbots.org/bot/591950764289818634')
        embed.add_field(name=Traduction.Day(isDay), value=Traduction.timeleft() + timeLeft)
        return embed
Пример #2
0
def fissures(args, client):
    try:
        platform = args[1]
    except IndexError:
        platform = ""
    try:
        relicTier = args[2].capitalize()
    except IndexError:
        relicTier = ""
    if platform == 'switch' or platform == 'nintendo':
        platform = 'swi'
    elif platform == 'xbox':
        platform = "xb1"
    elif platform == '':
        platform = 'pc'
    elif platform not in ("pc", "ps4", "xb1", "swi"):
        return discord.Embed(title='Fissure', description=Traduction.platformfail(platform), color=0xFF0000)

    data = json.loads(importjson("https://api.warframestat.us/" + platform + "/fissures"))
    embed = discord.Embed(title="Fissure", description=" ".join(args), color=0xDCF3FF)
    embed.set_thumbnail(
        url='https://vignette.wikia.nocookie.net/warframe/images/9/9c/LuminousIconLarge.png/revision/latest?cb=20160717170505&path-prefix=fr')
    embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    for place in data:
        embed = Traduction.fissure(place, embed, relicTier)
        if len(embed.fields) >= 24:
            embed.set_footer(text=Traduction.MoreIG())
            return embed
    return embed
Пример #3
0
def getimage(item):
    try:
        imageNameJs = json.loads(importjson("https://api.warframestat.us/items/search/" + item))
    except json.decoder.JSONDecodeError:
        return ''
    try:
        imageName = imageNameJs[0]['imageName']
    except IndexError:
        return ''
    return "https://raw.githubusercontent.com/wfcd/warframe-items/development/data/img/" + imageName
Пример #4
0
def Invasions(client):
    embed = discord.Embed(title="Invasion", description="!invasion", color=0x514430)
    embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    embed.set_thumbnail(
        url="https://vignette.wikia.nocookie.net/warframe/images/2/26/InvasionSplash.png/revision/latest?cb=20140421123118")
    jsonall = json.loads(importjson("https://api.warframestat.us/pc/invasions"))
    for invas in jsonall:
        if "-" not in invas['eta']:
            value = invas['attackerReward']['asString'] + ' vs ' + invas['defenderReward']['asString'] if \
                invas['attackerReward']['asString'] != "" else invas['defenderReward']['asString']
            embed.add_field(name=invas['defendingFaction'] + ' vs ' + invas['attackingFaction'], value=value)
            embed.add_field(name="Time before end", value=invas['eta'])
    return embed
Пример #5
0
def nightwave(args):
    platform = '_'.join(args[1:]).lower()
    if platform == 'switch' or platform == 'nintendo':
        platform = 'swi'
    elif platform == 'xbox':
        platform = "xb1"
    elif platform == '':
        platform = 'pc'
    elif platform not in ("pc", "ps4", "xb1", "swi"):
        return Traduction.platformfail(platform)
    nightdic = json.loads(importjson("https://api.warframestat.us/" + platform + "/nightwave"))
    embed = discord.Embed(title="Nightwave", description=" ".join(args), color=0x8D32A8)
    if bool(nightdic['active']):
        return Traduction.Nightwave(nightdic, embed)
    else:
        embed = discord.Embed(title="Nightwave", description='Nora don\'t have any mission for you.', color=0xFF0000)
        embed.set_thumbnail(
            url='https://vignette.wikia.nocookie.net/warframe/images/9/95/Nora_Night_transmission.png/revision/latest?cb=20190301081607')
        embed.set_author(name="Nora",
                         icon_url="https://vignette.wikia.nocookie.net/warframe/images/9/95/Nora_Night_transmission.png/revision/latest?cb=20190301081607")
        return embed
Пример #6
0
def search(args, client):
    itemS = cleanItem(args[1:])
    embed = discord.Embed(title=itemS, description=" ".join(args),
                          color=0x514430)
    embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    embed.set_thumbnail(url=getimage(itemS.lower()))
    try:
        jsonall = json.loads(
            importjson("https://api.warframestat.us/drops/search/" + itemS))
    except json.decoder.JSONDecodeError:
        embed.add_field(name=Traduction.bug(itemS),
                        value=Traduction.bug(itemS))
        return embed

    jsonSorted = sorted(jsonall, key=lambda k: k['chance'], reverse=True)
    for item in jsonSorted:
        place = item['place']
        chance = item['chance']
        if itemS.lower() in item['item'].lower():
            embed.add_field(name="Drop rate: " + str(chance) + "%", value=place, inline=True)
    return embed
Пример #7
0
def baro(args, client):
    platform = '_'.join(args[1:]).lower()
    if platform == 'switch' or platform == 'nintendo':
        platform = 'swi'
    if platform == 'xbox':
        platform = "xb1"
    if platform == '':
        platform = 'pc'
    if platform not in ("pc", "ps4", "xb1", "swi"):
        return discord.Embed(title="Baro Ki'Teer", description=Traduction.platformfail(platform), color=0xFF0000)
    else:
        dicbaro = json.loads(importjson('https://api.warframestat.us/' + platform + '/voidTrader'))
    embed = discord.Embed(title="Baro Ki'Teer " + str(' '.join(args[1:]).lower()),
                          description=" ".join(args), color=0x29DDB1)
    embed.set_thumbnail(
        url='http://content.warframe.com/MobileExport/Lotus/Interface/Icons/Player/BaroKiteerAvatar.png')
    embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    embed.add_field(name='Location', value=dicbaro['location'])
    if bool(dicbaro['active']):
        return Traduction.baro_depart(dicbaro, embed)
    else:
        return Traduction.baro_arrive(dicbaro, embed)
Пример #8
0
def relicSearch(args, client):  # !relic
    # Content : https://drops.warframestat.us/data/relics/Meso/R1.json
    try:
        relicTier = args[1].capitalize()
        relicName = args[2].capitalize()
    except IndexError:
        return
    try:
        if args[3] == "1":
            rarete = "Exceptional"
        elif args[3] == "2":
            rarete = "Flawless"
        elif args[3] == "3":
            rarete = "Radiant"
        else:
            rarete = "Intact"
    except:
        rarete = "Intact"
    embed = discord.Embed(title=" Relic " + relicTier + ' ' + relicName, description=rarete,
                          color=0x514430)
    embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    embed.set_thumbnail(url=typeofrelic(rarete, relicTier))
    try:
        jsonall = json.loads(
            importjson("https://drops.warframestat.us/data/relics/" + relicTier + "/" + relicName + ".json"))
    except json.decoder.JSONDecodeError:
        embed.add_field(name=Traduction.bug(relicTier + " " + relicName),
                        value=Traduction.bug(relicTier + " " + relicName))
        return embed

    itemList = sorted(jsonall['rewards'][rarete], key=lambda k: k['chance'], reverse=True)
    for item in itemList:
        name = item['itemName']
        chance = item['chance']
        embed.add_field(name="Drop rate: " + str(chance) + "%", value=name, inline=True)
    return embed
Пример #9
0
def searchRelic(args, client):  # relicsearch/searchrelic
    # Where to get : https://api.warframestat.us/drops/search/MeSo r1
    try:
        relic = args[1] + " " + args[2]
    except IndexError:
        embed = discord.Embed(title=" Relic " + args[1], description=" ".join(args),
                              color=0x514430)
        embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                         url='https://discordbots.org/bot/591950764289818634')
        embed.set_thumbnail(url=typeofrelic(None, args[1]))
        embed.add_field(name=Traduction.bug(args[1]),
                        value=Traduction.bug(args[1]))##TODO Show !helpW relicSearch
        return embed

    embed = discord.Embed(title=" Relic " + relic, description=" ".join(args),
                          color=0x514430)
    embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    embed.set_thumbnail(url=typeofrelic(None, relic))
    try:
        jsonall = json.loads(
            importjson("https://api.warframestat.us/drops/search/" + relic))
    except json.decoder.JSONDecodeError:
        embed.add_field(name=Traduction.bug(relic),
                        value=Traduction.bug(relic))
        return embed

    jsonSorted = sorted(jsonall, key=lambda k: k['chance'], reverse=True)
    for item in jsonSorted:
        place = item['place']
        chance = item['chance']
        if "Relic" not in place:
            embed.add_field(name="Drop rate: " + str(chance) + "%", value=place, inline=True)
    if len(embed.fields) == 0:
        embed.add_field(name="Relic is vaulted", value="Relic is vaulted, so you can only buy it.")
    return embed
Пример #10
0
def sortie(args):
    platform = '_'.join(args[1:]).lower()
    if platform == 'switch' or platform == 'nintendo':
        platform = 'swi'
    elif platform == 'xbox':
        platform = "xb1"
    elif platform == '':
        platform = 'pc'
    elif platform not in ("pc", "ps4", "xb1", "swi"):
        return discord.Embed(title='Sortie', description=Traduction.platformfail(platform), color=0xFF0000)
    embed = discord.Embed(title="Sortie", description=" ".join(args), color=0xFFD700)
    embed.set_thumbnail(
        url='https://vignette.wikia.nocookie.net/warframe/images/1/15/Sortie_b.png/revision/latest?cb=20151217134250')
    data = json.loads(importjson('https://api.warframestat.us/' + platform + '/sortie'))
    missionList = data['variants']
    for i in range(len(missionList)):
        dictemp = missionList[i]
        missionType = dictemp['missionType']
        modifiername = dictemp['modifier']
        modifierdesc = dictemp['modifierDescription'].replace('. ', '.\n')
        node = dictemp['node']
        embed.add_field(name="Mission " + str(i + 1), value=node + ' ' + missionType)
        embed.add_field(name=modifiername, value=modifierdesc)
    return embed
Пример #11
0
def searchPrice(args, orderSearch, marketSize):
    item = ConvertPart(' '.join(args[1:]).lower()).replace(' ', '_')
    # https://warframe.market/items/bo_prime_handle
    # https://api.warframe.market/v1/items/akbronco_prime_blueprint/orders
    try:
        data_json = json.loads(
            importjson("https://api.warframe.market/v1/items/" + item +
                       "/orders"))['payload']
    except json.decoder.JSONDecodeError:
        if "set" in item:
            return discord.Embed(
                title="WTB/WTS " +
                str(' '.join(args[1:]).lower().replace('set', '')),
                description=Traduction.bug(item),
                color=0xFF0000)
        else:
            args.append("set")
            return searchPrice(args, orderSearch, marketSize)

    image = ""
    image_json = {}

    try:
        image_json = json.loads(
            importjson("https://api.warframe.market/v1/items/" +
                       item))['payload']['item']['items_in_set']
    except json.decoder.JSONDecodeError:
        image = "https://warframe.market/static/assets/frontend/logo_icon_only.png"

    # https://warframe.market/static/assets/icons/en/thumbs/akbronco_prime_blueprint.34b5a7f99e5f8c15cc2039a76c725069.128x128.png
    if image == "":
        for data in image_json:
            if 'set' in item:
                if item.replace('set', '')[-1] in data['thumb']:
                    image = "https://warframe.market/static/assets/" + data[
                        'thumb']
            elif item in data['thumb']:
                image = "https://warframe.market/static/assets/" + data['thumb']
        if image == "":
            image = "https://warframe.market/static/assets/" + image_json[0][
                'thumb']
    if orderSearch == "sell":
        json_sorted = sorted(data_json['orders'],
                             key=lambda k: k['platinum'],
                             reverse=False)
    else:
        json_sorted = sorted(data_json['orders'],
                             key=lambda k: k['platinum'],
                             reverse=True)

    orderList = []
    for data in json_sorted:
        plat = data['platinum']

        status = data['user']['status']

        username = data['user']['ingame_name']

        reputation = str(data['user']['reputation'])

        order = data['order_type']

        region = data['user']['region']

        quantity = str(data['quantity'])

        if status == "ingame" and order == orderSearch and region == "en":
            orderList.append({
                "platinium": plat,
                "player": username,
                "reputation": reputation,
                "amount": quantity,
                "image": image,
                "item": item
            })
        if len(orderList) >= marketSize:
            break
    return orderList