From 3fbef29303491a39c4b7e6d8a43ef8763ac1edf6 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 22 Apr 2025 18:49:58 +0100 Subject: Ensure King Arthur doesn't deminish our 99.999999% uptime --- arthur/exts/fun/numbers.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arthur/exts/fun/numbers.py b/arthur/exts/fun/numbers.py index 906aaf7..5034718 100644 --- a/arthur/exts/fun/numbers.py +++ b/arthur/exts/fun/numbers.py @@ -1,5 +1,5 @@ import discord -from discord.ext import commands +from discord.ext import commands, tasks from arthur.apis.netcup.ssh import rce_as_a_service from arthur.config import CONFIG @@ -27,6 +27,18 @@ class Numbers(commands.GroupCog): if self.devops_vc and (vc := self.devops_vc.guild.voice_client): await vc.disconnect(force=True) + @tasks.loop(hours=1) + async def devops_vc_check(self) -> None: + """Ensure the uptime of the numbers relay.""" + if not self.devops_vc or not (vc := self.devops_vc.guild.voice_client): + return + if not isinstance(vc, discord.VoiceClient): + return + if vc.is_playing(): + return + + vc.play(discord.FFmpegOpusAudio(CONFIG.numbers_url)) + @commands.group(invoke_without_command=True) async def numbers( self, -- cgit v1.2.3