CHANGE
+ - Global Settings - added new discord bot setting for an All Profiles alias. To disable to All Profiles feature, just clear the alias field.
+ - Discord Bot - can now use the new All Profiles alias to send a command to all profiles associated with the channel.
- Changed the auto process message broadcast to use a config setting, not a hardcoded value.
diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml
index 9ced0d0a..6358b484 100644
--- a/src/ARKServerManager/VersionFeedBeta.xml
+++ b/src/ARKServerManager/VersionFeedBeta.xml
@@ -5,7 +5,31 @@
Ark Server Manager Version Feed
This is the Ark Server Manager beta version feed.
-
2022-03-23T00:00:00Z
+
2022-04-14T00:00:00Z
+
+
+ urn:uuid:B5B32577-54E7-49D3-9EDF-D623F54A47D9
+ 1.1.422 (1.1.422.2)
+ 1.1.422.2
+
+ 2022-04-14T00:00:00Z
+
+
+
+ CHANGE
+
+
+ - Global Settings - added new discord bot setting for an All Profiles alias. To disable to All Profiles feature, just clear the alias field.
+ - Discord Bot - can now use the new All Profiles alias to send a command to all profiles associated with the channel.
+
+
+
+
+
+ bletch
+ bletch1971@hotmail.com
+
+
urn:uuid:95C9671F-4AEC-4433-AD68-CF91854FEC1B
diff --git a/src/ConanServerManager/App.config b/src/ConanServerManager/App.config
index 3ce4670d..8d02cc0d 100644
--- a/src/ConanServerManager/App.config
+++ b/src/ConanServerManager/App.config
@@ -660,6 +660,9 @@
Broadcast
+
+ all
+
\ No newline at end of file
diff --git a/src/ConanServerManager/Config.Designer.cs b/src/ConanServerManager/Config.Designer.cs
index b9e02610..9e8787ec 100644
--- a/src/ConanServerManager/Config.Designer.cs
+++ b/src/ConanServerManager/Config.Designer.cs
@@ -2321,5 +2321,17 @@ namespace ServerManagerTool {
this["RCON_MessageCommand"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("all")]
+ public string DiscordBotAllServersKeyword {
+ get {
+ return ((string)(this["DiscordBotAllServersKeyword"]));
+ }
+ set {
+ this["DiscordBotAllServersKeyword"] = value;
+ }
+ }
}
}
diff --git a/src/ConanServerManager/Config.settings b/src/ConanServerManager/Config.settings
index f625c684..5f303707 100644
--- a/src/ConanServerManager/Config.settings
+++ b/src/ConanServerManager/Config.settings
@@ -638,5 +638,8 @@
Broadcast
+
+ all
+
\ No newline at end of file
diff --git a/src/ConanServerManager/Globalization/en-US/en-US.xaml b/src/ConanServerManager/Globalization/en-US/en-US.xaml
index f5ad33ba..7724541f 100644
--- a/src/ConanServerManager/Globalization/en-US/en-US.xaml
+++ b/src/ConanServerManager/Globalization/en-US/en-US.xaml
@@ -812,6 +812,8 @@
Log Level:
Get Token...
Help...
+ All Profiles Alias:
+ The alias to use when sending a command via discord to all profiles associated with a discord channel. Do not include spaces or special characters. To disable the All Profiles alias, clear the value.
Allow All Bots
If enabled, the server manager bot will respond to all other bots, otherwise they will be ignored unless they are in the whitelist.
Bot Whitelist
diff --git a/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml b/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml
index 3684dc34..21f014e9 100644
--- a/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml
+++ b/src/ConanServerManager/UserControls/GlobalSettingsControl.xaml
@@ -575,15 +575,18 @@
-
-
-
+
+
-
-
-
+
+
+
-
+
+
+
+
+
@@ -632,7 +635,7 @@
-
+
diff --git a/src/ConanServerManager/Utils/DiscordBotHelper.cs b/src/ConanServerManager/Utils/DiscordBotHelper.cs
index b5868596..bf1b691a 100644
--- a/src/ConanServerManager/Utils/DiscordBotHelper.cs
+++ b/src/ConanServerManager/Utils/DiscordBotHelper.cs
@@ -1,15 +1,15 @@
-using QueryMaster;
-using ServerManagerTool.Common.Extensions;
-using ServerManagerTool.Common.Utils;
-using ServerManagerTool.DiscordBot.Enums;
-using ServerManagerTool.Enums;
-using ServerManagerTool.Lib;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
+using QueryMaster;
+using ServerManagerTool.Common.Extensions;
+using ServerManagerTool.Common.Utils;
+using ServerManagerTool.DiscordBot.Enums;
+using ServerManagerTool.Enums;
+using ServerManagerTool.Lib;
using WPFSharp.Globalizer;
namespace ServerManagerTool.Utils
@@ -42,11 +42,11 @@ namespace ServerManagerTool.Utils
switch (commandType)
{
case CommandType.Info:
- return GetServerInfo(channelId, profileIdOrAlias);
+ return GetServerInfo(channelId, profileIdOrAlias, token);
case CommandType.List:
- return GetServerList(channelId);
+ return GetServerList(channelId, token);
case CommandType.Status:
- return GetServerStatus(channelId, profileIdOrAlias);
+ return GetServerStatus(channelId, profileIdOrAlias, token);
case CommandType.Backup:
if (Config.Default.AllowDiscordBackup)
@@ -93,81 +93,82 @@ namespace ServerManagerTool.Utils
return string.IsNullOrWhiteSpace(translationKey) ? string.Empty : _globalizer.GetResourceString(translationKey) ?? translationKey;
}
- private static IList GetServerInfo(string channelId, string profileIdOrAlias)
+ private static IList GetServerInfo(string channelId, string profileIdOrAlias, CancellationToken token)
{
if (string.IsNullOrWhiteSpace(profileIdOrAlias))
{
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Info) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- var serverName = string.Empty;
- var serverIp = IPAddress.Loopback;
- var queryPort = 0;
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
- TaskUtils.RunOnUIThreadAsync(() =>
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Stopped:
+ case ServerStatus.Uninstalled:
+ case ServerStatus.Unknown:
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Info);
+ profileList.Add(ServerProfileSnapshot.Create(server.Profile));
}
+ }
+ }).Wait(token);
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Info);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Stopped:
- case ServerStatus.Uninstalled:
- case ServerStatus.Unknown:
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
- }
-
- serverName = server.Profile.ServerName;
- if (!string.IsNullOrWhiteSpace(server.Profile.ServerIP))
- {
- IPAddress.TryParse(server.Profile.ServerIP, out serverIp);
- }
- queryPort = server.Profile.QueryPort;
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
try
{
- using (var gameServer = ServerQuery.GetServerInstance(EngineType.Source, new IPEndPoint(serverIp, queryPort)))
+ using (var gameServer = ServerQuery.GetServerInstance(EngineType.Source, new IPEndPoint(profile.ServerIPAddress, profile.QueryPort)))
{
var info = gameServer?.GetInfo();
if (info is null)
{
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_InfoFailed"), serverName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_InfoFailed"), profile.ServerName));
}
else
{
var mapName = _globalizer.GetResourceString($"Map_{info.Map}") ?? info.Map;
- response.Add($"```{info.Name}\n" +
+ responseList.Add($"```{info.Name}\n" +
$"{_globalizer.GetResourceString("DiscordBot_MapLabel")} {mapName}\n" +
$"{_globalizer.GetResourceString("ServerSettings_PlayersLabel")} {info.Players} / {info.MaxPlayers}```");
}
@@ -175,62 +176,92 @@ namespace ServerManagerTool.Utils
}
catch (Exception)
{
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_InfoFailed"), serverName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_InfoFailed"), profile.ServerName));
}
+ }
- return response;
- }
- finally
- {
- _currentProfileCommands.Remove(key);
- }
+ return responseList;
}
- private static IList GetServerList(string channelId)
+ private static IList GetServerList(string channelId, CancellationToken token)
{
- List response = new List();
+ var responseList = new List();
TaskUtils.RunOnUIThreadAsync(() =>
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase));
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ );
- response.Add($"**{_globalizer.GetResourceString("DiscordBot_CountLabel")}** {serverList.Count()}");
- foreach (var server in serverList)
+ if (serverList.IsEmpty())
{
- response.Add($"```{_globalizer.GetResourceString("ServerSettings_ProfileLabel")} {server.Profile.ProfileName}\n" +
- $"{_globalizer.GetResourceString("ServerSettings_ProfileIdLabel")} {server.Profile.ProfileID}\n" +
- (string.IsNullOrWhiteSpace(server.Profile.DiscordAlias) ? "" : $"{_globalizer.GetResourceString("ServerSettings_DiscordAliasLabel")} {server.Profile.DiscordAlias}\n") +
- $"{_globalizer.GetResourceString("ServerSettings_ServerNameLabel")} {server.Profile.ServerName}```");
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- }).Wait();
+ else
+ {
+ responseList.Add($"**{_globalizer.GetResourceString("DiscordBot_CountLabel")}** {serverList.Count()}");
- return response;
+ foreach (var server in serverList)
+ {
+ responseList.Add($"```{_globalizer.GetResourceString("ServerSettings_ProfileLabel")} {server.Profile.ProfileName}\n" +
+ $"{_globalizer.GetResourceString("ServerSettings_ProfileIdLabel")} {server.Profile.ProfileID}\n" +
+ (string.IsNullOrWhiteSpace(server.Profile.DiscordAlias) ? "" : $"{_globalizer.GetResourceString("ServerSettings_DiscordAliasLabel")} {server.Profile.DiscordAlias}\n") +
+ $"{_globalizer.GetResourceString("ServerSettings_ServerNameLabel")} {server.Profile.ServerName}```");
+ }
+ }
+ }).Wait(token);
+
+ return responseList;
}
- private static IList GetServerStatus(string channelId, string profileIdOrAlias)
+ private static IList GetServerStatus(string channelId, string profileIdOrAlias, CancellationToken token)
{
- List response = new List();
+ if (string.IsNullOrWhiteSpace(profileIdOrAlias))
+ {
+ return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Info) };
+ }
+
+ var responseList = new List();
TaskUtils.RunOnUIThreadAsync(() =>
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.IsNullOrWhiteSpace(profileIdOrAlias)
- || string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
- response.Add($"**{_globalizer.GetResourceString("DiscordBot_CountLabel")}** {serverList.Count()}");
- foreach (var server in serverList)
+ if (serverList.IsEmpty())
{
- response.Add($"```{_globalizer.GetResourceString("ServerSettings_ProfileLabel")} {server.Profile.ProfileName}\n" +
- $"{_globalizer.GetResourceString("ServerSettings_ProfileIdLabel")} {server.Profile.ProfileID}\n" +
- (string.IsNullOrWhiteSpace(server.Profile.DiscordAlias) ? "" : $"{_globalizer.GetResourceString("ServerSettings_DiscordAliasLabel")} {server.Profile.DiscordAlias}\n") +
- $"{_globalizer.GetResourceString("ServerSettings_ServerNameLabel")} {server.Profile.ServerName}\n" +
- $"{_globalizer.GetResourceString("ServerSettings_StatusLabel")} {server.Runtime.StatusString}\n" +
- $"{_globalizer.GetResourceString("ServerSettings_AvailabilityLabel")} {_globalizer.GetResourceString($"ServerSettings_Availability_{server.Runtime.Availability}")}```");
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
+ {
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
+ }
+ else
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ }
}
- }).Wait();
+ else
+ {
+ responseList.Add($"**{_globalizer.GetResourceString("DiscordBot_CountLabel")}** {serverList.Count()}");
- return response;
+ foreach (var server in serverList)
+ {
+ responseList.Add($"```{_globalizer.GetResourceString("ServerSettings_ProfileLabel")} {server.Profile.ProfileName}\n" +
+ $"{_globalizer.GetResourceString("ServerSettings_ProfileIdLabel")} {server.Profile.ProfileID}\n" +
+ (string.IsNullOrWhiteSpace(server.Profile.DiscordAlias) ? "" : $"{_globalizer.GetResourceString("ServerSettings_DiscordAliasLabel")} {server.Profile.DiscordAlias}\n") +
+ $"{_globalizer.GetResourceString("ServerSettings_ServerNameLabel")} {server.Profile.ServerName}\n" +
+ $"{_globalizer.GetResourceString("ServerSettings_StatusLabel")} {server.Runtime.StatusString}\n" +
+ $"{_globalizer.GetResourceString("ServerSettings_AvailabilityLabel")} {_globalizer.GetResourceString($"ServerSettings_Availability_{server.Runtime.Availability}")}```");
+ }
+ }
+ }).Wait(token);
+
+ return responseList;
}
private static IList BackupServer(string channelId, string profileIdOrAlias, CancellationToken token)
@@ -240,59 +271,67 @@ namespace ServerManagerTool.Utils
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Backup) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- ServerProfileSnapshot profile = null;
- Task task = null;
-
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- TaskUtils.RunOnUIThreadAsync(() =>
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
+
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- if (!server.Profile.AllowDiscordBackup)
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Backup, server.Profile.ProfileName));
+ if (!server.Profile.AllowDiscordBackup)
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Backup, server.Profile.ProfileName));
+ continue;
+ }
+
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Uninstalled:
+ case ServerStatus.Unknown:
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Backup);
+ profileList.Add(ServerProfileSnapshot.Create(server.Profile));
}
+ }
+ }).Wait(token);
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
- {
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
- }
-
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Backup);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Uninstalled:
- case ServerStatus.Unknown:
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
- }
-
- profile = ServerProfileSnapshot.Create(server.Profile);
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
var app = new ServerApp(true)
{
DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup,
@@ -304,31 +343,25 @@ namespace ServerManagerTool.Utils
{
TaskUtils.RunOnUIThreadAsync(() =>
{
- var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
- server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
- }).Wait();
+ var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase));
+ if (server != null)
+ {
+ server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
+ }
+ }).Wait(token);
}
};
- task = Task.Run(() =>
+ Task.Run(() =>
{
app.PerformProfileBackup(profile, token);
- _currentProfileCommands.Remove(key);
- });
+ _currentProfileCommands.Remove(profile.ProfileId);
+ }, token);
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_BackupRequested"), profile.ServerName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_BackupRequested"), profile.ServerName));
+ }
- return response;
- }
- finally
- {
- if (task is null)
- {
- _currentProfileCommands.Remove(key);
- }
- }
+ return responseList;
}
private static IList RestartServer(string channelId, string profileIdOrAlias, CancellationToken token)
@@ -338,62 +371,72 @@ namespace ServerManagerTool.Utils
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Restart) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- ServerProfileSnapshot profile = null;
- Task task = null;
-
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- TaskUtils.RunOnUIThreadAsync(() =>
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
+
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- if (!server.Profile.AllowDiscordRestart)
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Restart, server.Profile.ProfileName));
+ if (!server.Profile.AllowDiscordRestart)
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Restart, server.Profile.ProfileName));
+ continue;
+ }
+
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Uninstalled:
+ case ServerStatus.Unknown:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Restart);
+ var profile = ServerProfileSnapshot.Create(server.Profile);
+ profile.AutoRestartIfShutdown = true;
+ profileList.Add(profile);
}
+ }
+ }).Wait(token);
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
- {
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
- }
-
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Restart);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Uninstalled:
- case ServerStatus.Unknown:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
-
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
- }
-
- profile = ServerProfileSnapshot.Create(server.Profile);
- profile.AutoRestartIfShutdown = true;
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
var app = new ServerApp(true)
{
DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup,
@@ -405,31 +448,25 @@ namespace ServerManagerTool.Utils
{
TaskUtils.RunOnUIThreadAsync(() =>
{
- var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
- server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
- }).Wait();
+ var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase));
+ if (server != null)
+ {
+ server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
+ }
+ }).Wait(token);
}
};
- task = Task.Run(() =>
+ Task.Run(() =>
{
app.PerformProfileShutdown(profile, true, false, false, false, token);
- _currentProfileCommands.Remove(key);
- });
+ _currentProfileCommands.Remove(profile.ProfileId);
+ }, token);
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_RestartRequested"), profile.ServerName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_RestartRequested"), profile.ServerName));
+ }
- return response;
- }
- finally
- {
- if (task is null)
- {
- _currentProfileCommands.Remove(key);
- }
- }
+ return responseList;
}
private static IList ShutdownServer(string channelId, string profileIdOrAlias, CancellationToken token)
@@ -439,62 +476,71 @@ namespace ServerManagerTool.Utils
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Shutdown) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- ServerProfileSnapshot profile = null;
- Task task = null;
-
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- TaskUtils.RunOnUIThreadAsync(() =>
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
+
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- if (!server.Profile.AllowDiscordShutdown)
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Shutdown, server.Profile.ProfileName));
+ if (!server.Profile.AllowDiscordShutdown)
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Shutdown, server.Profile.ProfileName));
+ continue;
+ }
+
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Stopped:
+ case ServerStatus.Uninstalled:
+ case ServerStatus.Unknown:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Shutdown);
+ profileList.Add(ServerProfileSnapshot.Create(server.Profile));
}
+ }
+ }).Wait(token);
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
- {
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
- }
-
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Shutdown);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Stopped:
- case ServerStatus.Uninstalled:
- case ServerStatus.Unknown:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
-
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
- }
-
- profile = ServerProfileSnapshot.Create(server.Profile);
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
var app = new ServerApp(true)
{
DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup,
@@ -506,31 +552,25 @@ namespace ServerManagerTool.Utils
{
TaskUtils.RunOnUIThreadAsync(() =>
{
- var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
- server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
- }).Wait();
+ var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase));
+ if (server != null)
+ {
+ server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
+ }
+ }).Wait(token);
}
};
- task = Task.Run(() =>
+ Task.Run(() =>
{
app.PerformProfileShutdown(profile, false, false, false, false, token);
- _currentProfileCommands.Remove(key);
- });
+ _currentProfileCommands.Remove(profile.ProfileId);
+ }, token);
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName));
+ }
- return response;
- }
- finally
- {
- if (task is null)
- {
- _currentProfileCommands.Remove(key);
- }
- }
+ return responseList;
}
private static IList StopServer(string channelId, string profileIdOrAlias, CancellationToken token)
@@ -540,62 +580,71 @@ namespace ServerManagerTool.Utils
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Stop) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- ServerProfileSnapshot profile = null;
- Task task = null;
-
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- TaskUtils.RunOnUIThreadAsync(() =>
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
+
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- if (!server.Profile.AllowDiscordStop)
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Stop, server.Profile.ProfileName));
+ if (!server.Profile.AllowDiscordStop)
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Stop, server.Profile.ProfileName));
+ continue;
+ }
+
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Stopped:
+ case ServerStatus.Uninstalled:
+ case ServerStatus.Unknown:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Stop);
+ profileList.Add(ServerProfileSnapshot.Create(server.Profile));
}
+ }
+ }).Wait(token);
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
- {
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
- }
-
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Stop);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Stopped:
- case ServerStatus.Uninstalled:
- case ServerStatus.Unknown:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
-
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
- }
-
- profile = ServerProfileSnapshot.Create(server.Profile);
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
var app = new ServerApp(true)
{
DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup,
@@ -608,31 +657,25 @@ namespace ServerManagerTool.Utils
{
TaskUtils.RunOnUIThreadAsync(() =>
{
- var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
- server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
- }).Wait();
+ var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase));
+ if (server != null)
+ {
+ server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
+ }
+ }).Wait(token);
}
};
- task = Task.Run(() =>
+ Task.Run(() =>
{
app.PerformProfileShutdown(profile, false, false, false, false, token);
- _currentProfileCommands.Remove(key);
- });
+ _currentProfileCommands.Remove(profile.ProfileId);
+ }, token);
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_StopRequested"), profile.ServerName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_StopRequested"), profile.ServerName));
+ }
- return response;
- }
- finally
- {
- if (task is null)
- {
- _currentProfileCommands.Remove(key);
- }
- }
+ return responseList;
}
private static IList StartServer(string channelId, string profileIdOrAlias, CancellationToken token)
@@ -642,63 +685,73 @@ namespace ServerManagerTool.Utils
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Start) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- ServerProfileSnapshot profile = null;
- Task task = null;
-
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- TaskUtils.RunOnUIThreadAsync(() =>
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
+
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- if (!server.Profile.AllowDiscordStart)
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Start, server.Profile.ProfileName));
+ if (!server.Profile.AllowDiscordStart)
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Start, server.Profile.ProfileName));
+ continue;
+ }
+
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Running:
+ case ServerStatus.Uninstalled:
+ case ServerStatus.Unknown:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Start);
+ var profile = ServerProfileSnapshot.Create(server.Profile);
+ profile.AutoRestartIfShutdown = true;
+ profileList.Add(profile);
}
+ }
+ }).Wait(token);
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
- {
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
- }
-
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Start);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Running:
- case ServerStatus.Uninstalled:
- case ServerStatus.Unknown:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
-
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
- }
-
- profile = ServerProfileSnapshot.Create(server.Profile);
- profile.AutoRestartIfShutdown = true;
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
var app = new ServerApp(true)
{
DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup,
@@ -710,31 +763,25 @@ namespace ServerManagerTool.Utils
{
TaskUtils.RunOnUIThreadAsync(() =>
{
- var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
- server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
- }).Wait();
+ var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase));
+ if (server != null)
+ {
+ server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
+ }
+ }).Wait(token);
}
};
- task = Task.Run(() =>
+ Task.Run(() =>
{
app.PerformProfileShutdown(profile, true, false, false, false, token);
- _currentProfileCommands.Remove(key);
- });
+ _currentProfileCommands.Remove(profile.ProfileId);
+ }, token);
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_StartRequested"), profile.ServerName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_StartRequested"), profile.ServerName));
+ }
- return response;
- }
- finally
- {
- if (task is null)
- {
- _currentProfileCommands.Remove(key);
- }
- }
+ return responseList;
}
private static IList UpdateServer(string channelId, string profileIdOrAlias, CancellationToken token)
@@ -744,65 +791,77 @@ namespace ServerManagerTool.Utils
return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Update) };
}
- var key = string.Empty;
+ var profileList = new List();
+ var responseList = new List();
- ServerProfileSnapshot profile = null;
- bool performRestart = false;
- Task task = null;
-
- try
+ TaskUtils.RunOnUIThreadAsync(() =>
{
- TaskUtils.RunOnUIThreadAsync(() =>
+ var serverList = ServerManager.Instance.Servers.Where(s =>
+ string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
+ && (
+ string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)
+ || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)
+ )
+ );
+
+ if (serverList.IsEmpty())
{
- var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
-
- if (serverList.IsEmpty())
+ if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase))
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
+ responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles"));
}
- if (!serverList.HasOne())
+ else
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMultiples"), profileIdOrAlias));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias));
}
-
- var server = serverList.First();
-
- if (!server.Profile.AllowDiscordUpdate)
+ }
+ else
+ {
+ foreach (var server in serverList)
{
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Update, server.Profile.ProfileName));
+ var performRestart = false;
+
+ if (!server.Profile.AllowDiscordUpdate)
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Update, server.Profile.ProfileName));
+ continue;
+ }
+
+ // check if another command is being run against the profile
+ if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
+ {
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
+ continue;
+ }
+
+ switch (server.Runtime.Status)
+ {
+ case ServerStatus.Running:
+ performRestart = true;
+ break;
+
+ case ServerStatus.Initializing:
+ case ServerStatus.Stopping:
+ case ServerStatus.Unknown:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
+ continue;
+
+ case ServerStatus.Updating:
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
+ continue;
+ }
+
+ _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Update);
+ var profile = ServerProfileSnapshot.Create(server.Profile);
+ profile.RestartAfterShutdown1 = performRestart; // use this property to trigger a restart
+ profileList.Add(profile);
}
+ }
+ }).Wait(token);
- // check if another command is being run against the profile
- if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID))
- {
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName));
- }
-
- key = server.Profile.ProfileID;
- _currentProfileCommands.Add(key, CommandType.Update);
-
- switch (server.Runtime.Status)
- {
- case ServerStatus.Initializing:
- case ServerStatus.Stopping:
- case ServerStatus.Unknown:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString));
-
- case ServerStatus.Running:
- performRestart = true;
- break;
-
- case ServerStatus.Updating:
- throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName));
- }
-
- profile = ServerProfileSnapshot.Create(server.Profile);
- }).Wait();
-
- List response = new List();
-
+ foreach (var profile in profileList)
+ {
var app = new ServerApp(true)
{
DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup,
@@ -814,31 +873,25 @@ namespace ServerManagerTool.Utils
{
TaskUtils.RunOnUIThreadAsync(() =>
{
- var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
- && (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
- || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
- server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
- }).Wait();
+ var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase));
+ if (server != null)
+ {
+ server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
+ }
+ }).Wait(token);
}
};
- task = Task.Run(() =>
+ Task.Run(() =>
{
- app.PerformProfileShutdown(profile, performRestart, true, false, false, token);
- _currentProfileCommands.Remove(key);
- });
+ app.PerformProfileShutdown(profile, profile.RestartAfterShutdown1, true, false, false, token);
+ _currentProfileCommands.Remove(profile.ProfileId);
+ }, token);
- response.Add(string.Format(_globalizer.GetResourceString("DiscordBot_UpdateRequested"), profile.ServerName));
+ responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_UpdateRequested"), profile.ServerName));
+ }
- return response;
- }
- finally
- {
- if (task is null)
- {
- _currentProfileCommands.Remove(key);
- }
- }
+ return responseList;
}
}
}
diff --git a/src/ConanServerManager/VersionFeed.xml b/src/ConanServerManager/VersionFeed.xml
index 82429441..e9846c9a 100644
--- a/src/ConanServerManager/VersionFeed.xml
+++ b/src/ConanServerManager/VersionFeed.xml
@@ -5,7 +5,31 @@
Conan Server Manager Version Feed
This is the Conan Server Manager release version feed.
- 2022-03-22T00:00:00Z
+ 2022-04-14T00:00:00Z
+
+
+ urn:uuid:243F602B-CD67-4691-BE25-61646590A07A
+ 1.1.66 (1.1.66.1)
+ 1.1.66.1
+
+ 2022-04-14T00:00:00Z
+
+
+
+ CHANGE
+
+
+ - Global Settings - added new discord bot setting for an All Profiles alias. To disable to All Profiles feature, just clear the alias field.
+ - Discord Bot - can now use the new All Profiles alias to send a command to all profiles associated with the channel.
+
+
+
+
+
+ bletch
+ bletch1971@hotmail.com
+
+
urn:uuid:59A5E20B-D3B2-4FDB-8E03-F0C3022C344F
diff --git a/src/ConanServerManager/VersionFeedBeta.xml b/src/ConanServerManager/VersionFeedBeta.xml
index dd313b12..268f0960 100644
--- a/src/ConanServerManager/VersionFeedBeta.xml
+++ b/src/ConanServerManager/VersionFeedBeta.xml
@@ -5,23 +5,22 @@
Conan Server Manager Version Feed
This is the Conan Server Manager beta version feed.
- 2022-03-23T00:00:00Z
+ 2022-04-14T00:00:00Z
- urn:uuid:59A5E20B-D3B2-4FDB-8E03-F0C3022C344F
- 1.1.65 (1.1.65.1)
- 1.1.65.1
+ urn:uuid:243F602B-CD67-4691-BE25-61646590A07A
+ 1.1.66 (1.1.66.1)
+ 1.1.66.1
- 2022-03-23T00:00:00Z
+ 2022-04-14T00:00:00Z
CHANGE
- - RCON Window - added two addional RCON broadcast methods, both require Pippi mod - Alert and Server.
- - Global Settings - added RCON broadcast mode droplist, so auto processes can send messages via RCON using this mode.
- - Auto Processes - changed the message broadcast to use the new config setting, not a hardcoded value.
+ - Global Settings - added new discord bot setting for an All Profiles alias. To disable to All Profiles feature, just clear the alias field.
+ - Discord Bot - can now use the new All Profiles alias to send a command to all profiles associated with the channel.
diff --git a/src/ServerManager.Discord/Modules/ServerCommandModule.cs b/src/ServerManager.Discord/Modules/ServerCommandModule.cs
index a505c55b..76310a6f 100644
--- a/src/ServerManager.Discord/Modules/ServerCommandModule.cs
+++ b/src/ServerManager.Discord/Modules/ServerCommandModule.cs
@@ -1,26 +1,25 @@
-using Discord;
+using System;
+using System.Threading.Tasks;
+using Discord;
using Discord.Addons.Interactive;
using Discord.Commands;
-using Microsoft.Extensions.Configuration;
using ServerManagerTool.DiscordBot.Delegates;
using ServerManagerTool.DiscordBot.Enums;
using ServerManagerTool.DiscordBot.Interfaces;
-using System;
-using System.Threading.Tasks;
namespace ServerManagerTool.DiscordBot.Modules
{
[Name("Server Commands")]
public sealed class ServerCommandModule : InteractiveBase
{
+ private const int COMMAND_RESPONSE_DELAY = 500;
+
private readonly IServerManagerBot _serverManagerBot;
- private readonly CommandService _commands;
private readonly HandleCommandDelegate _handleCommandCallback;
- public ServerCommandModule(IServerManagerBot serverManagerBot, CommandService commands, HandleCommandDelegate handleCommandCallback)
+ public ServerCommandModule(IServerManagerBot serverManagerBot, HandleCommandDelegate handleCommandCallback)
{
_serverManagerBot = serverManagerBot;
- _commands = commands;
_handleCommandCallback = handleCommandCallback;
}
@@ -45,8 +44,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -76,8 +77,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -107,8 +110,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -138,8 +143,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -169,8 +176,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -200,8 +209,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
diff --git a/src/ServerManager.Discord/Modules/ServerQueryModule.cs b/src/ServerManager.Discord/Modules/ServerQueryModule.cs
index fa861f27..72c19bf7 100644
--- a/src/ServerManager.Discord/Modules/ServerQueryModule.cs
+++ b/src/ServerManager.Discord/Modules/ServerQueryModule.cs
@@ -1,37 +1,28 @@
-using Discord;
+using System;
+using System.Threading.Tasks;
+using Discord;
using Discord.Addons.Interactive;
using Discord.Commands;
using ServerManagerTool.DiscordBot.Delegates;
using ServerManagerTool.DiscordBot.Enums;
using ServerManagerTool.DiscordBot.Interfaces;
-using System;
-using System.Threading.Tasks;
namespace ServerManagerTool.DiscordBot.Modules
{
[Name("Server Query")]
public sealed class ServerQueryModule : InteractiveBase
{
+ private const int COMMAND_RESPONSE_DELAY = 500;
+
private readonly IServerManagerBot _serverManagerBot;
- private readonly CommandService _commands;
private readonly HandleCommandDelegate _handleCommandCallback;
- public ServerQueryModule(IServerManagerBot serverManagerBot, CommandService commands, HandleCommandDelegate handleCommandCallback)
+ public ServerQueryModule(IServerManagerBot serverManagerBot, HandleCommandDelegate handleCommandCallback)
{
_serverManagerBot = serverManagerBot;
- _commands = commands;
_handleCommandCallback = handleCommandCallback;
}
- [Command("info", RunMode = RunMode.Async)]
- [Summary("Poll server for information")]
- [Remarks("info")]
- [RequireBotPermission(ChannelPermission.ViewChannel | ChannelPermission.SendMessages)]
- public async Task ServerInfoAsync()
- {
- await ServerInfoAsync(null);
- }
-
[Command("info", RunMode = RunMode.Async)]
[Summary("Poll server for information")]
[Remarks("info profileId|alias")]
@@ -53,8 +44,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -84,8 +77,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)
@@ -94,15 +89,6 @@ namespace ServerManagerTool.DiscordBot.Modules
}
}
- [Command("status", RunMode = RunMode.Async)]
- [Summary("Poll server for status")]
- [Remarks("status")]
- [RequireBotPermission(ChannelPermission.ViewChannel | ChannelPermission.SendMessages)]
- public async Task ServerStatusAsync()
- {
- await ServerStatusAsync(null);
- }
-
[Command("status", RunMode = RunMode.Async)]
[Summary("Poll server for status")]
[Remarks("status profileId|alias")]
@@ -124,8 +110,10 @@ namespace ServerManagerTool.DiscordBot.Modules
foreach (var output in response)
{
await ReplyAsync(output.Replace("&", "_"));
- await Task.Delay(1000);
+ await Task.Delay(COMMAND_RESPONSE_DELAY);
}
+
+ await ReplyAsync($"'{Context.Message}' command complete.");
}
}
catch (Exception ex)