async def language(self, ctx, lang=""): to_delete, delay, old = await self.bot.read_settings(ctx.guild.id) if len(lang): if lang in ("fr", "en", "de", "es", "it", "ja", "ko", "pl", "pt", "ru", "tc", "tr", "zh"): update_lang_server(ctx.guild.id, lang) lang_pack = locales(lang) embed = discord.Embed( title=lang_pack["command_language_title"], description=lang_pack["command_language_description"]. format(old, ctx.guild.id, lang), colour=self.colour) else: lang_pack = locales(old) embed = discord.Embed( title=lang_pack["command_language_title"], description=lang_pack["command_language_description_error"] .format(lang), colour=self.colour) else: lang_pack = locales(old) embed = discord.Embed( title=lang_pack["command_language_title"], description=lang_pack["command_language_description_no_lang"]. format(old, ctx.guild.id), colour=self.colour) embed.set_thumbnail(url=ctx.guild.icon_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def bug(self, ctx, *message): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) if len(message) < 3: embed = discord.Embed( title=lang_pack["command_bug_title"], colour=self.colour, description=lang_pack["message_too_short"].format( ctx.author.mention), icon_url=ctx.guild.me.avatar_url) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, to_delete, embed=embed, delay=delay) dm = self.bot.get_user(self._id) message = ' '.join(message) await dm.send(f"[{ctx.author} - BUG] -> {message}") embed = discord.Embed(title=lang_pack["command_bug_title"], colour=self.colour, description=lang_pack["command_bug_sent"].format( ctx.author.mention), icon_url=ctx.guild.me.avatar_url) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, to_delete, embed=embed, delay=delay)
async def news(self, ctx, platform: str = None): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) if platform is not None and platform.lower() in [ 'pc', 'ps4', 'xb1', 'swi' ]: desc = '' data = ws_data(platform, lang, 'news') for c in reversed(data): desc += c['asString'] + '\n' embed = discord.Embed( title=lang_pack["command_news_title"].format(platform.upper()), colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time()), description=desc) embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay) elif platform is None: await e_send(ctx, to_delete, message=lang_pack["provide_platform"].format( ctx.author.mention), delay=delay) else: await e_send(ctx, to_delete, message=lang_pack["wrong_platform"].format( ctx.author.mention), delay=delay)
async def stats(self, ctx, *args): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) if len(args): try: args_endpoint = '_'.join(args).lower() capitalize_args = [x.capitalize() for x in args] fargs = ' '.join(capitalize_args) graphs_path = f"./graphs/{args_endpoint}.png" await self.make_graph(args_endpoint, fargs) msg = lang_pack["command_stat_msg_title"].format( ctx.author.mention, fargs) with open(graphs_path, 'rb') as p: if delay: await ctx.message.delete(delay=delay) await ctx.send(msg, file=discord.File(p, graphs_path), delete_after=delay) os.remove(graphs_path) except Exception as e: print(f"{type(e).__name__} : {e}") embed = discord.Embed( title=lang_pack["error"], colour=0xFF0026, timestamp=datetime.datetime.utcfromtimestamp(time.time()), description=lang_pack["wrong_item_name"]) embed.set_thumbnail( url= 'https://warframe.market/static/assets/frontend/logo_icon_only.png' ) embed.set_footer( text= "Made with ❤️ by Taki#0853 (WIP) | api.warframe.market", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def earth(self, ctx): to_delete, delay, lang = read_settings(ctx.guild.id) data = ws_data('pc', lang, 'earthCycle') lang_pack = locales(lang) timeLeft = data["timeLeft"] if timeLeft.startswith('-'): timeLeft = "0m:" if data["isDay"]: state = lang_pack["command_earth_to_night"] actual = "☀️" else: state = lang_pack["command_earth_to_day"] actual = "🌙" timeLeft += state embed = discord.Embed(colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp( time.time()), description=timeLeft) embed.set_author( name=lang_pack["command_earth_author_name"], icon_url= "https://vignette.wikia.nocookie.net/warframe/images/1/1e/Earth.png/revision/latest?cb=20161016212227" ) embed.add_field(name=lang_pack["command_earth_field_name_state"], value=f"{data['state'].capitalize()} {actual}") embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def sentient(self, ctx): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) Tmp = ws_offi()['Tmp'] if Tmp != '[]': Tmp = int(Tmp[7:10]) embed = discord.Embed( title=lang_pack["command_sentient_title_active"], description=lang_pack["command_sentient_description_active"]. format(sentient_node(Tmp)), colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time())) embed.add_field( name=lang_pack["command_sentient_field_name_note"], value=lang_pack["command_sentient_field_value_note"]) else: d = datetime.datetime.now() embed = discord.Embed( title=lang_pack["command_sentient_title_inactive"], description=lang_pack["command_sentient_description_inactive"]. format(d.strftime("%Y-%m-%d %H:%M:%S")), colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time())) embed.add_field( name=lang_pack["command_sentient_field_name_note"], value=lang_pack["command_sentient_field_value_note"]) embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, to_delete, embed=embed, delay=delay)
async def fish(self, ctx, location): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) if location.lower() == "fortuna": embed = discord.Embed( title=lang_pack["command_fish_title_fortuna"], colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time())) embed.set_image(url="https://semlar.com/fishing_map8.jpg") embed.set_footer( text="Made with ❤️ by Taki#0853 (WIP) | from semlar.com", icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, to_delete, embed=embed, delay=delay) if location.lower() == "cetus": to_delete, delay, lang = read_settings(ctx.guild.id) embed = discord.Embed(title=lang_pack["command_fish_title_cetus"], colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp( time.time())) embed.set_image(url="https://semlar.com/fishing_map.jpg") embed.set_footer( text="Made with ❤️ by Taki#0853 (WIP) | from semlar.com", icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, to_delete, embed=embed, delay=delay) else: return await e_send( ctx, to_delete, message=lang_pack["command_fish_provide_valid_map"].format( ctx.author.mention), delay=delay)
async def get_prefix(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) embed = discord.Embed( title=lang_pack["command_get_prefix_title"], description=await self.bot.read_prefix(ctx.guild.id), timestamp=datetime.datetime.utcfromtimestamp(time.time()), color=self.colour) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def fissures(self, ctx, platform: str = None, *highlight): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) if platform is not None and platform.lower() in [ "pc", "xb1", "ps4", "swi" ]: if len(highlight): highlight = [x.lower() for x in highlight] platform = platform.lower() data = await ws_data(self.bot.http_session, platform, lang, "fissures") embed = discord.Embed(colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp( time.time())) embed.set_author( name=lang_pack["command_fissures_author_name"].format( platform.upper()), url="https://warframe.fandom.com/wiki/Void_Fissure", icon_url=ctx.guild.me.avatar_url) for f in data: if f["active"]: mission_type = f['missionType'] tier = f['tier'] faction = f['enemy'] if not len(highlight): embed.add_field( name= f"• **{mission_type}** - **{tier}** {f['eta']} " + lang_pack["time_left"], value=f" **{f['node']}** - {faction}", inline=False) else: for h in highlight: if h in mission_type.lower() or h in tier.lower() or \ h in faction.lower(): embed.add_field( name= f"• **{mission_type}** - **{tier}** {f['eta']} " + lang_pack["time_left"], value=f" **{f['node']}** - {faction}", inline=False) embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay) elif platform is None: await e_send(ctx, to_delete, message=lang_pack["provide_platform"].format( ctx.author.mention), delay=delay) else: await e_send(ctx, to_delete, message=lang_pack["wrong_platform"].format( ctx.author.mention), delay=delay)
async def support(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) embed = discord.Embed( title=lang_pack["discord_support_title"], description= f'[{lang_pack["click_here"]}](https://discordapp.com/invite/wTxbQYb)', colour=self.colour) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def vote(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) embed = discord.Embed( title=lang_pack["command_vote_title"], description= f'[{lang_pack["click_here"]}](https://top.gg/bot/593364281572196353/vote)', colour=self.colour) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def invite(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) embed = discord.Embed( title=lang_pack["invite_bot"], description= f'[{lang_pack["click_here"]}](https://discordapp.com/oauth2/authorize?client_id=593364281572196353&scope=bot&permissions=470083648)', colour=self.colour) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def arbitration(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) data = await ws_data(self.bot.http_session, 'pc', lang, 'arbitration') embed = discord.Embed(title=lang_pack["command_arbitration_title"], colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp( time.time()), description=arbitration_eta(data["expiry"])) embed.add_field(name=f"{data['type']}", value=data['node']) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) embed.set_thumbnail(url=self.thumb_dev_comm) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def acolytes(self, ctx, platform="pc"): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) data = await ws_data(self.bot.http_session, platform, lang, 'persistentEnemies') lang_pack = locales(lang) if platform in ["pc", "xbox", "swi", "ps4"]: if len(data) <= 3: embed = discord.Embed( colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time())) embed.set_author( name=lang_pack["command_acolytes_author_title"].format( platform.upper()), url="https://warframe.fandom.com/wiki/Acolytes", icon_url= "https://vignette.wikia.nocookie.net/warframe/images/e/ec/StrikerAcolyte.png/revision/latest/scale-to-width-down/200?cb=20160125210745" ) for c in data: if c["isDiscovered"]: embed.add_field( name=lang_pack["command_acolytes_field_name"]. format(c["agentType"], c["rank"]), value=lang_pack[ "command_acolytes_field_value_discovered"]. format(c["lastDiscoveredAt"], c["healthPercent"] * 100), inline=False) else: embed.add_field( name=lang_pack["command_acolytes_field_name"]. format(c["agentType"], c["rank"]), value=lang_pack[ "command_acolytes_field_value_not_discovered"]. format(round(c["healthPercent"] * 100)), inline=False) else: embed = discord.Embed( title=lang_pack["command_acolytes_title_not_available"], colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time())) else: return await e_send(ctx, to_delete, message=lang_pack["wrong_platform"].format( ctx.author.mention), delay=delay) embed.set_thumbnail(url="https://i.imgur.com/2nsXVJ2.jpg") embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def donate(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) embed = discord.Embed(title=lang_pack["donate"], colour=self.colour) embed.add_field( name="Patreon", value= f'[{lang_pack["click_here"]}](https://www.patreon.com/takitsu)') embed.add_field( name=lang_pack["kofi"], value=f"[{lang_pack['click_here']}](https://ko-fi.com/takitsu)") embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def help_error(self, ctx, error): prefix = await self.bot.read_prefix(ctx.guild.id) to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) trade_command = f"""**`<{prefix}wtb | {prefix}b> <pc | xbox | ps4 | swi> [ITEM_NAME]`** - {lang_pack["help_wtb"]} **`<{prefix}wts | {prefix}s> <pc | xbox | ps4 | swi> [ITEM_NAME]`** - {lang_pack["help_wts"]} **`<{prefix}riven | {prefix}r> <pc | xbox | ps4 | swi> [ITEM_NAME]`** - {lang_pack["help_riven"]} **`{prefix}ducats`** - {lang_pack["help_ducats"]}""" ws_command = f"""**`<{prefix}fissures | {prefix}f> <pc | ps4 | xb1 | swi>`** - {lang_pack["help_fissures"]} **`{prefix}sortie`** - {lang_pack["help_sortie"]} **`{prefix}baro`** - {lang_pack["help_baro"]} **`{prefix}news <pc | xbox | ps4 | swi>`** - {lang_pack["help_news"]} **`{prefix}earth`** - {lang_pack["help_earth"]} **`{prefix}wiki [QUERY]`** - {lang_pack["help_wiki"]} **`{prefix}event`** - {lang_pack["help_event"]} **`{prefix}sentient`** - {lang_pack["help_sentient"]} **`{prefix}fish <cetus | fortuna>`** - {lang_pack["help_fish"]} **`{prefix}acolytes <pc | xbox | ps4 | swi>`** - Views acolytes currently available""" other_commands = f"""**`{prefix}bug [MESSAGE]`** - {lang_pack["help_bug"]} **`{prefix}suggestion [MESSAGE]`** - {lang_pack["help_suggestion"]} **`{prefix}ping`** - {lang_pack["help_ping"]} **`{prefix}about`** - {lang_pack["help_about"]} **`{prefix}donate`** - {lang_pack["help_donate"]} **`{prefix}vote`** - {lang_pack["help_vote"]} **`{prefix}support`** - {lang_pack["help_support"],} **`{prefix}invite`** - {lang_pack["help_invite"]} **`{prefix}language [COUNTRY_CODE]`** - {lang_pack["help_language"]} **`{prefix}set_prefix [PREFIX]`** - {lang_pack["help_set_prefix"]} **`{prefix}get_prefix`** - {lang_pack["help_get_prefix"]} **`{prefix}settings [--delete] [n | no]`** - {lang_pack["help_settings_delete"]} **`{prefix}settings [--delay] [TIME_IN_SECOND]`** - {lang_pack["help_settings_delay"]} **`<{prefix}help | {prefix}h> <all>`** - {lang_pack["help_help"]}""" embed = discord.Embed(title=lang_pack["help_error"], colour=self.colour, description=lang_pack["help_description"]) embed.add_field(name="Warframe Market commands", value=trade_command, inline=False) embed.add_field(name="Worldstate commands", value=ws_command, inline=False) embed.add_field(name="Bot commands", value=other_commands, inline=False) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await ctx.author.send(embed=embed)
async def ping(self, ctx): """Ping's Bot""" to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) before = time.monotonic() message = await ctx.send("ЁЯПУPing!", delete_after=delay) ping = (time.monotonic() - before) * 1000 embed = discord.Embed(colour=0xff00, title=lang_pack["command_ping_title"], description="ЁЯПУPong!\n{0} ms".format( int(ping))) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) try: await ctx.message.delete(delay=delay) except: pass await message.edit(content="", embed=embed)
async def embed_pagination(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) embed = discord.Embed(title=lang_pack["help_title"], description=lang_pack["help_description"], color=self.colour) embed.add_field(name='<:wf_market:641718306260385792> Warframe Market', value=lang_pack["help_waframe_market_description"]) embed.add_field(name='<:ws:641721981292773376> Worldstate', value=lang_pack["help_worldstate_description"], inline=False) embed.add_field(name=u"\u2699 " + lang_pack["help_bot_utility_name"], value=lang_pack["help_bot_utility_value"]) embed.add_field(name=lang_pack["help_donate"], value="[Kofi](https://ko-fi.com/takitsu)" "\n[Patreon](https://www.patreon.com/takitsu)", inline=False) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) return embed
async def baro(self, ctx): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) data = ws_data('pc', lang, 'voidTrader') if not len(data['inventory']): embed = discord.Embed( colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time()), description=lang_pack["command_baro_description_start"].format( data['startString'])) embed.set_author( name=lang_pack["command_baro_author_name"], icon_url= 'http://content.warframe.com/MobileExport/Lotus/Interface/Icons/Player/GlyphBaro.png' ) embed.add_field( name=lang_pack["command_baro_field_name_location"], value=lang_pack["command_baro_field_value_location"].format( data['character'], data['location'])) else: embed = discord.Embed( colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time()), description=lang_pack["command_baro_description_end"].format( data['location'], data['endString'])) embed.set_author( name=lang_pack["command_baro_author_name"], icon_url= 'http://content.warframe.com/MobileExport/Lotus/Interface/Icons/Player/GlyphBaro.png' ) embed.add_field(name=lang_pack["command_baro_field_name_location"], value=data['location']) for c in data['inventory']: embed.add_field(name=c['item'], value=str(c['ducats']) + '<:du:641336909989281842> + ' + str(c['credits']) + ' ' + lang_pack["credits"]) embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def event(self, ctx): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) data = ws_data('pc', lang, 'events') embed = discord.Embed(title=lang_pack["command_event_title"], colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp( time.time())) embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) if len(data): for x in data: try: embed.add_field(name='• ' + x['description'], value=x['asString'], inline=False) except: continue else: embed.description = lang_pack["command_event_description_no_event"] return await e_send(ctx, to_delete, embed=embed, delay=delay)
async def sortie(self, ctx): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) data = ws_data('pc', lang, 'sortie') embed = discord.Embed( colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time()), description=lang_pack["command_sortie_description"].format( data["faction"], data["eta"], data["boss"])) embed.set_author( name=lang_pack["command_sortie_author_name"], icon_url= 'https://vignette.wikia.nocookie.net/warframe/images/1/15/Sortie_b.png/revision/latest?cb=20151217134250' ) embed.set_thumbnail(url=self.thumb_dev_comm) for c in data["variants"]: embed.add_field(name=f'• {c["missionType"]} - {c["node"]}', value=f'{c["modifier"]}', inline=False) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def about(self, ctx): to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) prefix = await self.bot.read_prefix(ctx.guild.id) embed = discord.Embed(timestamp=datetime.datetime.utcfromtimestamp( time.time()), color=self.colour) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.add_field( name=lang_pack["invite_bot"], value= f"[{lang_pack['click_here']}](https://discordapp.com/oauth2/authorize?client_id=593364281572196353&scope=bot&permissions=470083648)", inline=False) embed.add_field( name=lang_pack["discord_support_title"], value= f"[{lang_pack['click_here']}](https://discordapp.com/invite/wTxbQYb)", inline=False) embed.add_field( name=lang_pack["donate"], value= "[Patreon](https://www.patreon.com/takitsu)\n[Kofi](https://ko-fi.com/takitsu)", inline=False) embed.add_field(name=lang_pack["command_about_title"], value=f"{prefix}help") nb_users = 0 for s in self.bot.guilds: nb_users += len(s.members) embed.add_field(name=lang_pack["servers"], value=len(self.bot.guilds)) embed.add_field(name=lang_pack["members"], value=nb_users) embed.add_field(name=lang_pack["creator"], value="Taki#0853") embed.add_field(name=lang_pack["igname"], value="Takitsu21") embed.add_field(name=lang_pack["command_about_contributor"], value="Ralagane, Taki : fr", inline=False) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def nightwave(self, ctx): try: to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) uri_emblem = "https://vignette.wikia.nocookie.net/warframe/images/e/e0/NightwaveSyndicate.png/revision/latest?cb=20190727121305" data = await ws_data(self.bot.http_session, 'pc', lang, 'nightwave') days, hours, minutes, seconds = self._to_string_time( data['expiry']) days_p, hours_p, minutes_p, seconds_p = self._to_string_time( data['activeChallenges'][0]['expiry']) season_deadline = f"**{days}d {hours}h {minutes}mn {seconds}s**" challenges_deadline = f"**{days_p}d {hours_p}h {minutes_p}mn {seconds_p}s**" embed = discord.Embed( description=lang_pack["command_nightwave_description"].format( season_deadline, challenges_deadline).replace("-", ""), colour=self.colour, timestamp=datetime.datetime.utcfromtimestamp(time.time())) embed.set_author( name=lang_pack["command_nightwave_author_name_actual_season"]. format(data['season']), icon_url=uri_emblem) embed.set_thumbnail(url=self.thumb_dev_comm) embed.set_footer(text=self.footer_ws, icon_url=ctx.guild.me.avatar_url) for x in reversed(data['activeChallenges']): embed.add_field(name='• ' + x['title'], value=x['desc'] + f'\n**{x["reputation"]}** ' + lang_pack["reputation"], inline=False) except: return await e_send( ctx, to_delete, message=lang_pack["command_nightwave_no_nightwave"].format( ctx.author.mention), delay=delay) return await e_send(ctx, to_delete, embed=embed, delay=delay)
async def help(self, ctx, arg=""): prefix = await self.bot.read_prefix(ctx.guild.id) to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) trade_command = { f"<{prefix}wtb | {prefix}b> <pc | xbox | ps4 | swi> [ITEM_NAME]": lang_pack["help_wtb"], f"<{prefix}wts | {prefix}s> <pc | xbox | ps4 | swi> [ITEM_NAME]": lang_pack["help_wts"], f"<{prefix}riven | {prefix}r> <pc | xbox | ps4 | swi> [ITEM_NAME]": lang_pack["help_riven"], f"{prefix}ducats": lang_pack["help_ducats"] } ws_command = { f"<{prefix}fissures | {prefix}f> <pc | ps4 | xb1 | swi> <FILTER>": lang_pack["help_fissures"], f"{prefix}sortie": lang_pack["help_sortie"], f"{prefix}baro": lang_pack["help_baro"], f"{prefix}news <pc | xbox | ps4 | swi>": lang_pack["help_news"], f"{prefix}earth": lang_pack["help_earth"], f"{prefix}wiki [QUERY]": lang_pack["help_wiki"], f"{prefix}event": lang_pack["help_event"], f"{prefix}sentient": lang_pack["help_sentient"], f"{prefix}fish <cetus | fortuna>": lang_pack["help_fish"], f"{prefix}acolytes <pc | xbox | ps4 | swi>": "Views acolytes currently available" } other_commands = { f"{prefix}bug [MESSAGE]": lang_pack["help_bug"], f"{prefix}suggestion [MESSAGE]": lang_pack["help_suggestion"], f"{prefix}ping": lang_pack["help_ping"], f"{prefix}about": lang_pack["help_about"], f"{prefix}donate": lang_pack["help_donate"], f"{prefix}vote": lang_pack["help_vote"], f"{prefix}support": lang_pack["help_support"], f"{prefix}invite": lang_pack["help_invite"], f"{prefix}language [COUNTRY_CODE]": lang_pack["help_language"], f"{prefix}set_prefix [PREFIX]": lang_pack["help_set_prefix"], f"{prefix}get_prefix": lang_pack["help_get_prefix"], f"{prefix}settings [--delete] [n | no]": lang_pack["help_settings_delete"], f"{prefix}settings [--delay] [TIME_IN_SECOND]": lang_pack["help_settings_delay"], f"<{prefix}help | {prefix}h> <all>": lang_pack["help_help"] } if not len(arg): toReact = [ 'тПк', '<:wf_market:641718306260385792>', '<:ws:641721981292773376>', u"\u2699" ] embed = await self.embed_pagination(ctx) pagination = await ctx.send(embed=embed) for reaction in toReact: await pagination.add_reaction(reaction) while True: def check(reaction, user): return user == ctx.message.author and str( reaction.emoji) in toReact try: reaction, user = await self.bot.wait_for('reaction_add', check=check, timeout=300.0) emoji = str(reaction.emoji) except asyncio.TimeoutError: try: await ctx.message.delete() except: pass return await pagination.delete() if 'тПк' in emoji: embed = await self.embed_pagination(ctx) thumb = ctx.guild.me.avatar_url elif '<:wf_market:641718306260385792>' in emoji: embed = discord.Embed( title="<:wf_market:641718306260385792> Warframe Market", color=self.colour) self._add_field(embed, trade_command) thumb = "https://warframe.market/static/assets/frontend/logo_icon_only.png" elif '<:ws:641721981292773376>' in emoji: embed = discord.Embed( title="<:ws:641721981292773376> Worldstate commands", color=self.colour) self._add_field(embed, ws_command) thumb = "https://avatars2.githubusercontent.com/u/24436369?s=280&v=4" elif u"\u2699" in emoji: embed = discord.Embed(title=u"\u2699 Bot commands", color=self.colour) self._add_field(embed, other_commands) thumb = ctx.guild.me.avatar_url embed.set_thumbnail(url=thumb) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await pagination.remove_reaction(reaction.emoji, user) await pagination.edit(embed=embed) elif arg == "all": commands = { "<:wf_market:641718306260385792> Warframe Market commands": trade_command, "<:ws:641721981292773376> Worldstate commands": ws_command, u"\u2699 Bot commands": other_commands } for k, v in commands.items(): embed = discord.Embed( title=k, colour=self.colour, description=lang_pack["help_description"]) self._add_field(embed, v) embed.set_thumbnail(url=ctx.guild.me.avatar_url) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) await ctx.send(embed=embed) else: await ctx.send( message=lang_pack["command_help_invalide_arg"].format( ctx.author.mention, prefix))
async def set_prefix(self, ctx, *, prefixes=""): await self.bot.u_prefix(ctx.guild.id, prefixes) to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) await ctx.send(lang_pack["command_set_prefix"].format(prefixes))
async def riven(self, ctx, platform: str = None, *args): to_delete, delay, lang = read_settings(ctx.guild.id) lang_pack = locales(lang) if platform is None: embed = self.embed_exceptions( ctx, "riven", description=["<pc | xbox | ps4 | swi> [ITEM_NAME]"]) return await e_send(ctx, to_delete, embed=embed, delay=delay) elif platform in ["pc", "xbox", "ps4", "swi"]: try: args = [x.lower() for x in args] fargs = '_'.join(args) auction_query = WfmApi( platform, 'auctions', f'search?type=riven&weapon_url_name={fargs}&polarity=any&sort_by=price_asc' ) data = auction_query.data() if len(data['payload']['auctions']): embed = discord.Embed( description=lang_pack[ "command_riven_status_description"], timestamp=datetime.datetime.utcfromtimestamp( time.time()), colour=self.colour) item_c = ' '.join(args).capitalize() embed.set_author( name=lang_pack["command_riven_author_name"].format( item_c), url='https://warframe.fandom.com/wiki/Riven_Mods', icon_url= 'http://content.warframe.com/MobileExport/Lotus/Interface/Cards/Images/OmegaMod.png' ) attributes = '```diff\n' i = 0 for auction_iter in data['payload']['auctions']: if auction_iter['owner']['status'] in [ "ingame", "online" ]: status_emoji, status_game = self.convert_status( auction_iter['owner']['status']) embed.add_field( name= f"**{item_c} {auction_iter['item']['name']}** {status_emoji}", value=lang_pack[ "command_riven_field_value_item_description"] .format( auction_iter['buyout_price'], auction_iter['starting_price'], auction_iter['top_bid'], self.convert_polarity( auction_iter['item']['polarity']), auction_iter['item']['mastery_level'], auction_iter['item']['re_rolls'], auction_iter['item']['mod_rank'], auction_iter['id'], auction_iter['owner']['ingame_name']), inline=False) for attribute in auction_iter['item'][ 'attributes']: attr = attribute['url_name'].replace('_', ' ') if attribute['positive']: attributes += f"+ {attribute['value']} {attr}\n" else: value = abs(attribute['value']) attributes += f"- {value} {attr}\n" attributes += '\n```' embed.add_field(name=lang_pack[ "command_riven_field_name_attributes"], value=attributes, inline=False) attributes = '```diff\n' if i == 5: break i += 1 embed.set_footer( text= "Made with ❤️ by Taki#0853 (WIP) | api.warframe.market", icon_url=ctx.guild.me.avatar_url) embed.set_thumbnail( url= 'https://warframe.market/static/assets/frontend/logo_icon_only.png' ) await e_send(ctx, to_delete, embed=embed, delay=delay) else: embed = discord.Embed( description=lang_pack[ "command_riven_description_no_offer"], timestamp=datetime.datetime.utcfromtimestamp( time.time()), colour=self.colour) embed.set_author( name=lang_pack["command_riven_author_name"].format( item_c), url='https://warframe.fandom.com/wiki/Riven_Mods', icon_url= 'http://content.warframe.com/MobileExport/Lotus/Interface/Cards/Images/OmegaMod.png' ) embed.set_footer( text= "Made with ❤️ by Taki#0853 (WIP) | api.warframe.market", icon_url=ctx.guild.me.avatar_url) await e_send(ctx, to_delete, embed=embed, delay=delay) except StatusError: embed = self.embed_exceptions( ctx, "riven", description=["<pc | xbox | ps4 | swi> [ITEM_NAME]"]) await e_send(ctx, to_delete, embed=embed, delay=delay) else: embed = self.embed_exceptions( ctx, "riven", description=["<pc | xbox | ps4 | swi> [ITEM_NAME]"]) await e_send(ctx, to_delete, embed=embed, delay=delay)
async def settings(self, ctx, *args): arg_l = len(args) to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) lang_pack = locales(lang) if not arg_l: embed = discord.Embed( title=lang_pack["command_settings_update"], description=lang_pack["command_settings_check_description"]. format(ctx.guild.id), timestamp=datetime.datetime.utcfromtimestamp(time.time()), color=self.colour) embed.set_thumbnail(url=ctx.guild.icon_url) embed.add_field(name=lang_pack["command_settings_delete_title"], value=lang_pack[convert_str(to_delete)]) embed.add_field(name=lang_pack["command_settings_delay"], value=delay) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, to_delete, embed=embed, delay=delay) elif arg_l == 2 and args[0] == '--delay': try: delay = abs(int(args[1])) await self.bot.u_guild_settings(ctx.guild.id, 1, delay) embed = discord.Embed( title=lang_pack["command_settings_update"], description=lang_pack[ "command_settings_check_description_updated"].format( ctx.guild.id), timestamp=datetime.datetime.utcfromtimestamp(time.time()), color=self.colour) embed.set_thumbnail(url=ctx.guild.icon_url) embed.add_field( name=lang_pack["command_settings_delete_title"], value=lang_pack["yes"]) embed.add_field(name=lang_pack["command_settings_delay"], value=delay) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) return await e_send(ctx, 1, embed=embed, delay=delay) except: to_delete, delay, lang = await self.bot.read_settings( ctx.guild.id) embed = await self.embed_exceptions( ctx, "settings", description=["[--delay] [TIME_IN_SECOND]"]) await e_send(ctx, to_delete, embed=embed, delay=delay) elif arg_l == 2 and args[0] == '--delete': try: delete = convert_str(args[1]) delete_bool = convert_bool(args[1]) await self.bot.u_guild_settings(ctx.guild.id, delete_bool, None) embed = discord.Embed( title=lang_pack["command_settings_update"], description=lang_pack[ "command_settings_check_description_updated"].format( ctx.guild.id), timestamp=datetime.datetime.utcfromtimestamp(time.time()), color=self.colour) embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)", icon_url=ctx.guild.me.avatar_url) embed.set_thumbnail(url=ctx.guild.icon_url) embed.add_field( name=lang_pack["command_settings_delete_title"], value=delete) to_delete, delay, lang = await self.bot.read_settings( ctx.guild.id) return await e_send(ctx, to_delete, embed=embed, delay=delay) except: to_delete, delay, lang = await self.bot.read_settings( ctx.guild.id) embed = self.embed_exceptions( ctx, "settings", description=["[--delete] [y | n]"]) await e_send(ctx, to_delete, embed=embed, delay=delay) else: to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id) embed = self.embed_exceptions(ctx, "settings", description=[ "[--delete] [y | n]", "[--delay] [TIME_IN_SECOND]" ]) await e_send(ctx, to_delete, embed=embed, delay=delay)