mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Add !stats command
This commit is contained in:
@@ -663,6 +663,8 @@ namespace ArchiSteamFarm {
|
||||
return ResponseRestart(steamID);
|
||||
case "!SA":
|
||||
return await ResponseStatus(steamID, SharedInfo.ASF).ConfigureAwait(false);
|
||||
case "!STATS":
|
||||
return ResponseStats(steamID);
|
||||
case "!STATUS":
|
||||
return ResponseStatus(steamID);
|
||||
case "!STOP":
|
||||
@@ -3300,6 +3302,20 @@ namespace ArchiSteamFarm {
|
||||
return responses.Count > 0 ? string.Join("", responses) : null;
|
||||
}
|
||||
|
||||
private string ResponseStats(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
ArchiLogger.LogNullError(nameof(steamID));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ushort memoryInMegabytes = (ushort) (GC.GetTotalMemory(true) / 1024 / 1024);
|
||||
return FormatBotResponse(string.Format(Strings.BotStats, memoryInMegabytes));
|
||||
}
|
||||
|
||||
private string ResponseStatus(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
ArchiLogger.LogNullError(nameof(steamID));
|
||||
|
||||
11
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
11
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
@@ -19,7 +19,7 @@ namespace ArchiSteamFarm.Localization {
|
||||
// przez narzędzie, takie jak ResGen lub Visual Studio.
|
||||
// Aby dodać lub usunąć członka, edytuj plik .ResX, a następnie ponownie uruchom ResGen
|
||||
// z opcją /str lub ponownie utwórz projekt VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Strings {
|
||||
@@ -537,6 +537,15 @@ namespace ArchiSteamFarm.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Current memory usage: {0} MB..
|
||||
/// </summary>
|
||||
internal static string BotStats {
|
||||
get {
|
||||
return ResourceManager.GetString("BotStats", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Bot is connecting to Steam network..
|
||||
/// </summary>
|
||||
|
||||
@@ -691,4 +691,8 @@ StackTrace:
|
||||
<data name="WarningPreReleaseVersion" xml:space="preserve">
|
||||
<value>You're using a version that is newer than latest released version for your update channel. Please note that pre-release versions are dedicated to users who know how to report bugs, deal with issues and give feedback - no technical support will be given.</value>
|
||||
</data>
|
||||
<data name="BotStats" xml:space="preserve">
|
||||
<value>Current memory usage: {0} MB.</value>
|
||||
<comment>{0} will be replaced by number (in megabytes) of memory being used</comment>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user