Added a minimal GUI based on Avalonia UI library for C#

This commit is contained in:
2022-05-22 16:27:37 +03:00
parent 9f656d5f3f
commit 96b681bbda
24 changed files with 2099 additions and 21 deletions

View File

@@ -2,7 +2,7 @@ using PluginManager.Interfaces;
using Games.Objects;
namespace Games;
public class Free : DBCommand
public class Game : DBCommand
{
public string Command => "game";
public string Description => "Display info about the specified game";
@@ -17,6 +17,11 @@ public class Free : DBCommand
{
string game_name = PluginManager.Others.Functions.MergeStrings(message.Content.Split(' '), 1);
string game_url = await GameData.GetSteamLinkFromGame(game_name);
if (game_url is null || game_url == null)
{
await message.Channel.SendMessageAsync("Could not find the game. Try to be more specific or check for spelling errors.");
return;
}
await context.Channel.SendMessageAsync(game_url);
}

View File

@@ -12,10 +12,12 @@ public class GameData
from s in lines
where s.Contains(GameName.Replace(" ", "_"), StringComparison.OrdinalIgnoreCase)
select s).FirstOrDefault();
if (gameData is null || gameData.Length < 3)
throw new Exception("Unknown GAME");
if (gameData is null) return null;
string GameURL = gameData.Split('\"')[1].Split('?')[0];
if (GameURL == "menuitem")
return null;
return GameURL;
}