Example #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
Example #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
Example #3
0
def relicSearch(args, client):
    data_html = source_html(
        "https://n8k6e2y6.ssl.hwcdn.net/repos/hnfvc0o3jnfvc873njb03enrf56.html"
    )
    item = list(' '.join(args[1:3]).lower())
    item[0] = item[0].upper()
    item[len(item) - 2] = item[len(item) - 2].upper()
    item = "".join(item)
    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"
    limit1 = '</td></tr><tr class="blank-row"><td class="blank-row" colspan="2"></td></tr><tr><th colspan="2">'
    tab = data_html[
        data_html.find(item + " Relic (" + rarete + ")"):data_html.
        find(limit1, data_html.find(item + " Relic (" +
                                    rarete + ")"))].replace(
                                        "</th></tr><tr><td>", "\n**").replace(
                                            "</td><td>", "** ").replace(
                                                "</td></tr><tr><td>", "\n**")
    embed = discord.Embed(title=" Relic " + item + ' ' + rarete,
                          description=datetime.today().strftime("%d/%m/%Y"),
                          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, item))
    pos = 0
    for i in range(0, tab.count(" (")):
        pos = tab.find('\n', pos) + len('\n')
        Data = tab[tab.find(')', pos) +
                   len(')'):tab.find(')',
                                     tab.find(')', pos) + len(')')) + len(')')]
        name = Data[Data.find('**') +
                    len('**'):Data.find('**',
                                        Data.find('**') + len('**'))]
        chance = Data[Data.find('** ') + len('** '):]
        if len(name) > 5:
            embed.add_field(name=name, value=chance, inline=True)
    if tab == "":
        embed.add_field(name=Traduction.bug(item), value=Traduction.bug(item))
        return embed
    else:
        return embed
Example #4
0
def issuesend(message, args):
    if len(args) < 3:
        return Traduction.IssueParameter()
    parameter = ' '.join(args[2:])
    command = args[1]
    embed = discord.Embed(title=command, description=parameter, color=0x00ff00)
    embed.set_author(name=str(message.author), icon_url=message.author.avatar_url)
    embed.set_footer(text=str(message.author.id))
    return embed
Example #5
0
def options(args, message):
    try:
        if args[1] == args[2]:
            str(args[2])
    except IndexError:
        return Traduction.optionError()
    else:
        pass
    args[2] = args[2].replace('"', '')
    if args[1] == 'commandbegin':
        configch(str(message.guild.id), 'COMMANDBEGIN', args[2])
        return Traduction.optioncommandbegin(args[2])
    elif args[1] == 'language':
        if args[2] == 'fr':
            configch(str(message.guild.id), 'LANGUAGE', 'fr')
            return "Le bot est maintenant en français."
        elif args[2] == 'en':
            configch(str(message.guild.id), 'LANGUAGE', 'en')
            return "The bot is now in english."
        elif args[2] == 'pt':
            configch(str(message.guild.id), 'LANGUAGE', 'pt')
            return "O robô está agora em português."
        else:
            return "The bot is only available in english,french and portuguese.(en,fr,pt)"
    elif args[1] == 'timer':
        try:
            timer = int(args[2])
        except AttributeError:
            timer = 0 ##TODO Error si autre qu'un chiffre au lieu de 0
        if timer > 5:
            timer = 5
        elif 0 > timer:
            timer = 0
        configch(str(message.guild.id), 'TIMER', int(timer))
        return Traduction.optionTimer(str(timer))
    elif args[1] == 'market':
        market = int(args[2])
        if market > 5:
            market = 5
        elif 1 > market:
            market = 1
        configch(str(message.guild.id), 'sizeMarket', int(market))
        return Traduction.optionMarket(str(market))
    return Traduction.optionError()
Example #6
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
Example #7
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
Example #8
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)
Example #9
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
Example #10
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
Example #11
0
def MobsModsdrops(args):
    data_html = source_html(
        "https://n8k6e2y6.ssl.hwcdn.net/repos/hnfvc0o3jnfvc873njb03enrf56.html"
    )
    item = list(' '.join(args[1:]).lower())
    item = "".join(item)
    zone = data_html[data_html.find("Mod Drops by Enemy:"):data_html.
                     find("Mod Drops by Mod:")].lower()
    tab = "**" + zone[zone.find(item + '</th><th colspan="2">'):zone.find(
        '</td></tr><tr class="blank-row"><td class="blank-row" colspan="3"></td></tr><tr><th>',
        zone.find(item + '</th><th colspan="2">'))].replace(
            "</th></tr><tr><td></td><td>", "\n").replace(
                "</td><td>", " ").replace("</td></tr><tr><td>", "\n").replace(
                    '</th><th colspan="2">', "\n").replace(
                        item, item + "**```fix").replace(
                            "\n ", "\n").capitalize() + "```"
    if tab == "**```":
        return Traduction.bug(item)
    else:
        return tab
Example #12
0
def ducats(client):
    data = source_html('https://warframe.market/tools/ducats')
    dicducats = json.loads(StringBetween(data, '"payload": ', '}]}') + '}]}')
    dicitem = json.loads(
        '{"items": ' +
        StringBetween(data, '"items": ', '}], ').replace('\\', '') + '}]}')
    ducatsparplatinium = dicducats['previous_hour'][0][
        'ducats_per_platinum_wa']
    ducats = dicducats['previous_hour'][0]['ducats']
    id = dicducats['previous_hour'][0]['item']
    item = ""
    for i in range(len(dicitem['items'])):
        if dicitem['items'][i]['id'] == id:
            item = dicitem['items'][i]['item_name']
            break
    embed = discord.Embed(title="Ducats",
                          description=" ".join("!ducats"),
                          color=0xDFB85E)
    embed.set_author(name=client.user.name,
                     icon_url=client.user.avatar_url,
                     url='https://discordbots.org/bot/591950764289818634')
    return Traduction.ducats(item, ducats, ducatsparplatinium, embed)
Example #13
0
def ItemDrops(args):
    data_html = source_html(
        "https://n8k6e2y6.ssl.hwcdn.net/repos/hnfvc0o3jnfvc873njb03enrf56.html"
    )
    item = list(' '.join(args[1:]).lower())
    item = "".join(item)
    zone = data_html[data_html.find("Blueprint/Item Drops by Blueprint/Item:"):
                     data_html.find("Resource Drops by Enemy:")].lower()
    tab = '**' + zone[zone.find(item + '</th></tr><tr><th>'):zone.find(
        '</td></tr><tr class="blank-row"><td class="blank-row" colspan="3"></td></tr><tr><th colspan="3">',
        zone.find(item + '</th></tr><tr><th>'))].replace(
            '</th></tr><tr><th>', '**\n__').capitalize().replace(
                '</th><th>', '__\t\t__').replace(
                    '</th></tr><tr><td>', '__\n```diff\n').replace(
                        '</td><td>', '\t\t').replace('</td></tr><tr><td>',
                                                     '\n') + '```'
    if tab == "**```" and "blueprint" not in item:
        args.append("blueprint")
        return ItemDrops(args)
    elif tab == "**```":
        return Traduction.bug(item)
    else:
        return tab
Example #14
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
Example #15
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
Example #16
0
def mods(args):
    item = list(' '.join(args[1:]).lower())
    item = "".join(item)
    tab = ""
    modslist = source_html('https://wf.snekw.com/mods-wiki').lower()
    if modslist.count(item) == 0:
        return Traduction.bug(item)
    data_html = source_html(
        "https://n8k6e2y6.ssl.hwcdn.net/repos/hnfvc0o3jnfvc873njb03enrf56.html"
    )
    zone = data_html[data_html.find("Mod Drops by Mod:"):data_html.
                     find("Blueprint/Item Drops by Enemy:")].lower()
    if zone.count(item) >= 1:
        tab = '**' + zone[zone.find(item + '</th></tr><tr><th>'):zone.find(
            '</td></tr><tr class="blank-row"><td class="blank-row" colspan="3"></td></tr><tr><th colspan="3">',
            zone.find(item + '</th></tr><tr><th>'))].replace(
                '</th></tr><tr><th>', '**\n__').capitalize().replace(
                    '</th><th>', '__\t\t\t__').replace(
                        '</th></tr><tr><td>', '__\n```diff\n').replace(
                            '</td><td>', '\t').replace('</td></tr><tr><td>',
                                                       '\n') + '```\n'
    data_html = source_html(
        "https://drops.warframestat.us/data/all.json").lower()
    if data_html.count(item) >= 1:
        tab = tab + '**' + item.capitalize() + '**\n'
        posData = 0
        for i in range(0, data_html.count(item)):
            posData = data_html.find(item, posData + len(item))
            Objectivename = data_html[
                data_html.rfind('"objectivename":"', 0, posData) +
                len('"objectivename":"'):data_html.find(
                    '"',
                    data_html.rfind('"objectivename":"', 0, posData) +
                    len('"objectivename":"'))]
            if Objectivename == 'ds':
                zoneb = data_html[data_html.rfind("}]", 0, posData):data_html.
                                  rfind(":[{", 0, posData)]
                MissionName = zoneb[zoneb.find('"') +
                                    1:zoneb.find('"',
                                                 zoneb.find('"') + 2)]
                gamemode = zoneb[zoneb.find('{"gamemode":"') +
                                 len('{"gamemode":"'):zoneb.find(
                                     '"',
                                     zoneb.find('{"gamemode":"') +
                                     len('{"gamemode":" '))]
                if MissionName == 'c' or MissionName == 'b' or MissionName == 'a':
                    MissionName2 = data_html[
                        data_html.
                        rfind('"', 0, data_html.rfind('":{"ga', 0, posData)) +
                        1:data_html.rfind('":{"ga', 0, posData)].capitalize()
                    gamemode = data_html[
                        data_html.rfind('"gamemode":"', 0, posData) +
                        len('"gamemode":"'):data_html.find(
                            '"',
                            data_html.rfind('"gamemode":"', 0, posData) +
                            len('"gamemode":"'))].capitalize()
                    MissionName = 'Rotation ' + MissionName
                    MissionName = MissionName2.capitalize(
                    ) + '\n' + MissionName
                Objectivename = '\n**' + MissionName + '** : ' + gamemode.capitalize(
                )
            chancedrop = data_html[data_html.find('"chance":', posData) +
                                   len('"chance":'):data_html.find(
                                       '}',
                                       data_html.find('"chance":', posData) +
                                       len('"chance":'))]
            tab = tab + Traduction.FindHere(
            ) + Objectivename + '\nDrop Chance: ' + chancedrop + '\n'
            if len(tab) >= 1750:
                return tab[:1900].replace(
                    '%)', "%)\n") + '\nAnd more...', 'message.author'
    if not tab == "":
        return tab, "msg"
    else:
        return Traduction.bug(item), "msg"
Example #17
0
def ressource(args):
    data_html = source_html(
        "https://n8k6e2y6.ssl.hwcdn.net/repos/hnfvc0o3jnfvc873njb03enrf56.html"
    )
    item = list(' '.join(args[1:]).lower())
    item = "".join(item)
    tab = ""
    pos = 0
    zone = data_html[data_html.find("Resource Drops by Resource:"):data_html.
                     find("Sigil Drops by Enemy:")].lower()
    if zone.count(item) != 0:
        tab = '**' + zone[zone.find(item + '</th></tr><tr><th>'):zone.find(
            '</td></tr><tr class="blank-row"><td class="blank-row" colspan="3"></td></tr><tr><th colspan="3">',
            zone.find(item + '</th></tr><tr><th>'))].replace(
                '</th></tr><tr><th>', '**\n__').capitalize().replace(
                    '</th><th>', '__\t\t\t__').replace(
                        '</th></tr><tr><td>', '__\n```diff\n').replace(
                            '</td><td>', '\t').replace('</td></tr><tr><td>',
                                                       '\n') + '```'
    zone = data_html[data_html.find("Missions:"):data_html.find("Relics:"
                                                                )].lower()
    if zone.count(item) != 0:
        Mission = '?????????'
        Rotation = '????????????'
        MissionLimit1 = '<td class="blank-row" colspan="2"></td></tr><tr><th colspan="2">'
        MissionLimit2 = '</th></tr>'
        RotationLimit1 = '<tr><th colspan="2">rotation'
        RotationLimit2 = '</th></tr>'
        for i in range(
                zone.count(item)
        ):  # </td></tr><tr><th colspan="2">Rotation B</th></tr><tr><td>
            pos = zone.find(
                item, pos + 5
            )  # </td></tr><tr class="blank-row"><td class="blank-row" colspan="2"></td></tr><tr><th colspan="2">Mars/Gradivus (Caches)</th></tr><tr><th colspan
            if Mission == zone[zone.rfind(MissionLimit1, 0, pos) +
                               len(MissionLimit1):zone.find(
                                   MissionLimit2,
                                   zone.rfind(MissionLimit1, 0, pos) +
                                   len(MissionLimit1))] and Rotation == zone[
                                       zone.rfind(RotationLimit1, 0, pos) +
                                       len('<tr><th colspan="2">'):zone.find(
                                           RotationLimit2,
                                           zone.rfind(RotationLimit1, 0, pos) +
                                           len('<tr><th colspan="2">'))]:
                objet = zone[zone.rfind('<tr><td>', 0, pos) +
                             len("<tr><td>"):pos +
                             len(item)]  # </td></tr><tr><td>
                chance = zone[zone.find('</td><td>', pos) +
                              len("</td><td>"):zone.find(
                                  '</td>',
                                  zone.find('</td><td>', pos) +
                                  len("</td><td>"))]  # </td></tr><tr><td>
                tab = tab + objet.capitalize() + '\t' + chance
            else:
                Mission = zone[zone.rfind(MissionLimit1, 0, pos) +
                               len(MissionLimit1):zone.find(
                                   MissionLimit2,
                                   zone.rfind(MissionLimit1, 0, pos) +
                                   len(MissionLimit1))]
                if Mission == 'urvival)':
                    Mission = 'Mercury/Apollodorus (Survival)'
                Rotation = zone[zone.rfind(RotationLimit1, 0, pos) +
                                len('<tr><th colspan="2">'):zone.find(
                                    RotationLimit2,
                                    zone.rfind(RotationLimit1, 0, pos) +
                                    len('<tr><th colspan="2">'))]
                objet = zone[zone.rfind('<tr><td>', 0, pos) +
                             len("<tr><td>"):pos +
                             len(item)]  # </td></tr><tr><td>
                chance = zone[zone.find('</td><td>', pos) +
                              len("</td><td>"):zone.find(
                                  '</td>',
                                  zone.find('</td><td>', pos) +
                                  len("</td><td>"))]  # </td></tr><tr><td>
                if "rotation" not in Rotation:
                    Rotation = "???"
                tab = tab + '\n**' + Mission.capitalize(
                ) + '**\n**' + Rotation.capitalize().replace(
                    ' b', ' B').replace(' c', ' C').replace(
                        ' a',
                        ' A') + '**\n' + objet.capitalize() + '\t' + chance
            if len(tab) >= 1750:
                return tab[:1900].replace(
                    '%)', "%)\n") + '\n```And more...', 'message.author'
    if tab == "" or item == "region resource":
        return Traduction.bug(item), 'msg'
    else:
        return tab.replace('%)', "%)\n"), 'msg'
Example #18
0
 async def on_message(message):
     if message.author != client.user:
         update(message)
     try:
         if message.author == client.user and Settings.timer != 0 and "settings" not in message.content:
             actualtime = time.time()
             while time.time() - actualtime < Settings.timer:
                 pass
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
     except (AttributeError, discord.errors.NotFound):
         pass
     try:
         if message.content.startswith(Settings.commandbegin + 'ducats'):  # DUCATS
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             msg = await message.channel.send(Traduction.Loading(message).format(message))
             async with message.channel.typing():
                 await msg.edit(embed=ducats(client))
         elif message.content.startswith(Settings.commandbegin + 'WTB ') or message.content.startswith(
                 Settings.commandbegin + 'wtb '):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             async with message.channel.typing():
                 args = message.content.split(" ")
                 orderList = searchPrice(args, "sell", Settings.marketSize)
                 if isinstance(orderList, discord.Embed):  # Y'a erreur
                     await message.channel.send(embed=orderList)
                 else:
                     for order in orderList:
                         embed = discord.Embed(title="WTB " + str(' '.join(args[1:]).lower()),
                                               description=" ".join(args), color=0x4296ad)
                         embed.set_thumbnail(url=order['image'])
                         embed = Traduction.WTB(order['player'], order['amount'], order['item'],
                                                str(int(order['platinium'])),
                                                order['reputation'], embed,
                                                ("https://warframe.market/items//" + order['item']))
                         await message.channel.send(embed=embed)
         elif message.content.startswith(Settings.commandbegin + 'credits'):  # credits
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             await message.channel.send(Traduction.credit(message).format(message))
         elif message.content.startswith(Settings.commandbegin + 'WTT ') or message.content.startswith(
                 Settings.commandbegin + 'wtt '):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             async with message.channel.typing():
                 args = message.content.split(" ")
                 orderList = searchPrice(args, "sell", Settings.marketSize)
                 if isinstance(orderList, discord.Embed):  # Y'a erreur
                     await message.channel.send(embed=orderList)
                 else:
                     for order in orderList:
                         embed = discord.Embed(title="WTB " + str(' '.join(args[1:]).lower()),
                                               description=" ".join(args), color=0x4296ad)
                         embed.set_thumbnail(url=order['image'])
                         embed = Traduction.WTB(order['player'], order['amount'], order['item'],
                                                str(int(order['platinium'])),
                                                order['reputation'], embed,
                                                ("https://warframe.market/items//" + order['item']))
                         await message.channel.send(embed=embed)
                     orderList = searchPrice(args, "buy", Settings.marketSize)
                     for order in orderList:
                         embed = discord.Embed(title="WTS " + str(' '.join(args[1:]).lower()),
                                               description=" ".join(args), color=0x4296ad)
                         embed.set_thumbnail(url=order['image'])
                         embed = Traduction.WTS(order['player'], order['amount'], order['item'],
                                                str(int(order['platinium'])),
                                                order['reputation'], embed,
                                                ("https://warframe.market/items//" + order['item']))
                         await message.channel.send(embed=embed)
         elif message.content.startswith(Settings.commandbegin + 'WTS ') or message.content.startswith(
                 Settings.commandbegin + 'wts '):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             async with message.channel.typing():
                 args = message.content.split(" ")
                 orderList = searchPrice(args, "buy", Settings.marketSize)
                 if isinstance(orderList, discord.Embed):  # Y'a erreur
                     await message.channel.send(embed=orderList)
                 else:
                     for order in orderList:
                         embed = discord.Embed(title="WTS " + str(' '.join(args[1:]).lower()),
                                               description=" ".join(args), color=0x4296ad)
                         embed.set_thumbnail(url=order['image'])
                         embed = Traduction.WTS(order['player'], order['amount'], order['item'],
                                                str(int(order['platinium'])),
                                                order['reputation'], embed,
                                                ("https://warframe.market/items//" + order['item']))
                         await message.channel.send(embed=embed)
         elif message.content.startswith(Settings.commandbegin + 'relic '):  # relic
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             async with message.channel.typing():
                 args = message.content.split(" ")
                 await message.channel.send(embed=relicSearch(args, client))
         elif message.content.startswith(Settings.commandbegin + 'helpW'):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             args = message.content.split(" ")
             help_info = help(args)
             if help_info[1] == '`':
                 await message.author.send(str(help_info).format(message))
             else:
                 await message.channel.send(str(help_info[0]).format(message))
         elif message.content.startswith(
                 Settings.commandbegin + 'settings') and message.author.guild_permissions.manage_messages:
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             args = message.content.split(" ")
             await message.channel.send(options(args, message).format(message))
         elif message.content.startswith(Settings.commandbegin + 'baro') or message.content.startswith(
                 Settings.commandbegin + 'voidtrader'):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             args = message.content.split(" ")
             await message.channel.send(embed=baro(args, client))
         elif message.content.startswith(Settings.commandbegin + 'nora') or message.content.startswith(
                 Settings.commandbegin + 'nightwave'):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             args = message.content.split(" ")
             await message.channel.send(embed=nightwave(args))
         elif message.content.startswith(Settings.commandbegin + 'fissure'):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             args = message.content.split(" ")
             await message.channel.send(embed=fissures(args, client))
         elif message.content.startswith('!defaultconfig') and message.author.guild_permissions.manage_messages:
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             configch(str(message.guild.id), 'COMMANDBEGIN', '!')
             await message.channel.send('Command begin : !'.format(message))
         elif message.content.startswith(Settings.commandbegin + 'issue '):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             args = message.content.split(" ")
             try:
                 await client.get_channel(611237128529117292).send(embed=issuesend(message, args))
             except (AttributeError, discord.errors.NotFound):
                 await client.get_channel(611237128529117292).send(issuesend(message, args))
             else:
                 await message.author.send(Traduction.IssueSend().format(message))
         elif message.content.startswith(Settings.commandbegin + 'cetus'):
             args = message.content.split(" ")
             await message.channel.send(embed=cetus(args, client))
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
         elif message.content.startswith(Settings.commandbegin + 'earth'):
             args = message.content.split(" ")
             await message.channel.send(embed=cetus(args, client, 'Earth'))
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
         elif message.content.startswith(Settings.commandbegin + 'vote'):
             embed = discord.Embed(title=client.user.name,
                                   description='If you want to help me have a better view, please go vote on: [[Discord Bots](https://discordbots.org/api/widget/591950764289818634.svg)](https://discordbots.org/bot/591950764289818634/vote)',
                                   color=0x7289DA)  # todo translate
             embed.set_author(name=client.user.name, icon_url=client.user.avatar_url,
                              url='https://discordbots.org/bot/591950764289818634')
             embed.set_image(url='https://discordbots.org/api/widget/upvotes/591950764289818634.png')
             embed.set_thumbnail(url=client.user.avatar_url)
             await message.channel.send(embed=embed)
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
         elif message.content.startswith(Settings.commandbegin + 'searchrelic ') or message.content.startswith(
                 Settings.commandbegin + 'relicsearch '):
             async with message.channel.typing():
                 args = message.content.split(" ")
                 await message.channel.send(embed=searchRelic(args, client))
                 try:
                     await message.delete()
                 except (AttributeError, discord.errors.NotFound):
                     pass
         elif message.content.startswith(Settings.commandbegin + 'sortie'):
             args = message.content.split(" ")
             await message.channel.send(embed=sortie(args))
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
         elif message.content.startswith(Settings.commandbegin + 'search ') or message.content.startswith(
                 Settings.commandbegin + 'itemdrops '):
             try:
                 await message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             async with message.channel.typing():
                 args = message.content.split(" ")
                 await message.channel.send(embed=search(args, client))
         elif message.content.startswith(Settings.commandbegin + 'invasion'):
             try:
                 await  message.delete()
             except (AttributeError, discord.errors.NotFound):
                 pass
             await message.channel.send(embed=Invasions(client))