diff --git a/jarvis/cogs/dbrand.py b/jarvis/cogs/dbrand.py index 859220f..858a5bb 100644 --- a/jarvis/cogs/dbrand.py +++ b/jarvis/cogs/dbrand.py @@ -123,6 +123,56 @@ class DbrandCog(Extension): await ctx.send(embeds=embed) + async def _db_support_cmd(self, ctx: InteractionContext) -> None: + status = self.cache.get("status") + if not status or status["cache_expiry"] <= datetime.now(tz=timezone.utc): + status = await parse_db_status() + status["cache_expiry"] = datetime.now(tz=timezone.utc) + timedelta(hours=2) + self.cache["status"] = status + status = status.get("operations") + emojies = [x["Status"] for x in status] + fields = [ + EmbedField(name=f'{x["Status"]} {x["Service"]}', value=x["Detail"]) + for x in status + if x["Service"] == "Email Support" + ] + color = "#FBBD1E" + if all("green" in x for x in emojies): + color = "#38F657" + elif all("red" in x for x in emojies): + color = "#F12D20" + embed = build_embed( + title="Contact Support", + description="", + fields=fields, + url="https://dbrand.com/support", + color=color, + ) + + embed.set_thumbnail(url="https://dev.zevaryx.com/db_logo.png") + embed.set_footer( + text="dbrand.com", + icon_url="https://dev.zevaryx.com/db_logo.png", + ) + + await ctx.send(embeds=embed) + + @db.subcommand( + sub_cmd_name="contact", + sub_cmd_description="Contact support", + ) + @cooldown(bucket=Buckets.USER, rate=1, interval=30) + async def _contact(self, ctx: InteractionContext) -> None: + return await self._db_support_cmd(ctx) + + @db.subcommand( + sub_cmd_name="support", + sub_cmd_description="Contact support", + ) + @cooldown(bucket=Buckets.USER, rate=1, interval=30) + async def _support(self, ctx: InteractionContext) -> None: + return await self._db_support_cmd(ctx) + @db.subcommand(sub_cmd_name="gripcheck", sub_cmd_description="Watch a dbrand grip get thrown") async def _gripcheck(self, ctx: InteractionContext) -> None: video_url = "https://cdn.discordapp.com/attachments/599068193339736096/890679742263623751/video0.mov" @@ -155,22 +205,6 @@ class DbrandCog(Extension): ) await ctx.send(embeds=embed) - @db.subcommand( - sub_cmd_name="contact", - sub_cmd_description="Contact support", - ) - @cooldown(bucket=Buckets.USER, rate=1, interval=30) - async def _contact(self, ctx: InteractionContext) -> None: - await ctx.send("Contact dbrand support here: " + self.base_url + "contact") - - @db.subcommand( - sub_cmd_name="support", - sub_cmd_description="Contact support", - ) - @cooldown(bucket=Buckets.USER, rate=1, interval=30) - async def _support(self, ctx: InteractionContext) -> None: - await ctx.send("Contact dbrand support here: " + self.base_url + "contact") - @db.subcommand( sub_cmd_name="ship", sub_cmd_description="Get shipping information for your country",