Fix netinfo one more time and add command to force refresh it
@@ -56,8 +56,12 @@ class Loop(DatabaseCog):
m_desc += '\nBegins: ' + begin.strftime('%A, %B %d, %Y %I:%M %p')
if end.year != 2099:
m_desc += '\nEnds: ' + end.strftime('%A, %B %d, %Y %I:%M %p')
+ if "services" in m:
embed.add_field(name=f'Current Status: {m["software_title"].replace(" <br /> ", ", ")}, {", ".join(m["services"])}',
value=m_desc, inline=False)
+ else:
+ embed.add_field(name=f'Current Status: {m["software_title"].replace(" <br /> ", ", ")}',
+ value=m_desc, inline=False)
for m in j["temporary_maintenances"]:
begin = self.netinfo_parse_time(m["begin"])
if "end" in m:
@@ -69,8 +73,12 @@ class Loop(DatabaseCog):
m_desc += '\nBegins: ' + begin.strftime('%A, %B %d, %Y %I:%M %p')
if end.year != 2099:
m_desc += '\nEnds: ' + end.strftime('%A, %B %d, %Y %I:%M %p')
+ if "services" in m:
embed.add_field(name='Current Maintenance: {}, {}'.format(m["software_title"].replace(' <br />\r\n', ', '), ', '.join(m["services"])),
value=m_desc, inline=False)
+ else:
+ embed.add_field(name=f'Current Status: {m["software_title"].replace(" <br /> ", ", ")}',
+ value=m_desc, inline=False)
self.netinfo_embed = embed
@commands.command()
@@ -78,6 +86,14 @@ class Loop(DatabaseCog):
async def netinfo(self, ctx):
await ctx.send(embed=self.netinfo_embed)
+ @commands.command()
+ @commands.cooldown(rate=1, per=60.0, type=commands.BucketType.channel)
+ async def netinfo_refresh(self, ctx):
+ await self.update_netinfo()
+ embed = discord.Embed(title="Netinfo Refresh", color=discord.Color.blue())
+ embed.description = "Refresh complete."
+ await ctx.send(embed=embed)
+
async def start_update_loop(self):
# thanks Luc#5653
await self.bot.wait_until_all_ready()
