Added support for Custom Activity

This commit is contained in:
2024-08-18 17:57:16 +03:00
parent c080074292
commit 0a64de2439
3 changed files with 44 additions and 54 deletions

View File

@@ -1,6 +1,8 @@
using System;
using DiscordBotCore;
using System.Threading.Tasks;
using DiscordBotCore;
using Spectre.Console;
namespace DiscordBot;
@@ -11,34 +13,36 @@ public static class Installer
{
var value = AnsiConsole.Ask<string>($"[green]{message}[/]");
if (string.IsNullOrWhiteSpace(value))
if (!string.IsNullOrWhiteSpace(value))
{
AnsiConsole.MarkupLine($"Invalid {key} !");
Environment.Exit(-20);
return value;
}
AnsiConsole.MarkupLine($"Invalid {key} !");
Environment.Exit(-20);
return value;
}
public static async Task GenerateStartupConfig()
{
if(!Application.CurrentApplication.ApplicationEnvironmentVariables.ContainsKey("token"))
if (!Application.CurrentApplication.ApplicationEnvironmentVariables.ContainsKey("token"))
{
string response = AskForConfig("token", "Token:");
var response = AskForConfig("token", "Token:");
Application.CurrentApplication.ApplicationEnvironmentVariables.Add("token", response);
}
if (!Application.CurrentApplication.ApplicationEnvironmentVariables.ContainsKey("prefix"))
{
string response = AskForConfig("prefix", "Prefix:");
var response = AskForConfig("prefix", "Prefix:");
Application.CurrentApplication.ApplicationEnvironmentVariables.Add("prefix", response);
}
if (!Application.CurrentApplication.ApplicationEnvironmentVariables.ContainsKey("ServerID"))
{
string response = AskForConfig("ServerID", "Please enter the server Ids where the bot will be used (separated by ;):");
var response = AskForConfig("ServerID", "Please enter the server Ids where the bot will be used (separated by ;):");
Application.CurrentApplication.ApplicationEnvironmentVariables.Add("ServerID", response);
}