diff --git a/app.py b/app.py index ffb6f34..db2e83f 100644 --- a/app.py +++ b/app.py @@ -67,7 +67,12 @@ async def on_message(message): await message.channel.send(f"Sorry {message.author.mention}, that didn't work. Ping @lauralani") if messagearray[0] == "status": - await message.channel.send(BuildSingleGameStatus(messagearray[1])) + status = BuildSingleGameStatus(messagearray[1]) + if not status: + await message.add_reaction("❌") + await message.channel.send(f"Invalid game: {messagearray[1]}") + return + await message.channel.send(status) return diff --git a/lib.py b/lib.py index 7c1fbfa..784558d 100644 --- a/lib.py +++ b/lib.py @@ -11,8 +11,12 @@ def BuildGameList(): return retlist -def BuildSingleGameStatus(game): - return f"**{game['displayname']}**\n- Status: **{CheckSystemdService(game['systemd'])}**\n- Slug: `{game['slug']}`" +def BuildSingleGameStatus(slug: str): + game = GetGameByGameSlug(slug) + if game: + return f"**{game['displayname']}**\n- Status: **{CheckSystemdService(game['systemd'])}**\n- Slug: `{game['slug']}`" + else: + return False def CheckSystemdService(service : str): stat = subprocess.call(["systemctl", "is-active", "--quiet", service])