mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Last few misc fixes for !input
- Make it master-only, because of improvements we don't need owner permission anymore - Add case-insensitivty to Enum.TryParse() - Add missing strings
This commit is contained in:
@@ -2052,19 +2052,17 @@ namespace ArchiSteamFarm {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
if (!IsMaster(steamID)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Program.GlobalConfig.Headless) {
|
||||
//TODO: l10n
|
||||
return "Avaliable only in headless mode!";
|
||||
return FormatBotResponse(Strings.ErrorFunctionOnlyInHeadlessMode);
|
||||
}
|
||||
|
||||
ASF.EUserInputType inputType;
|
||||
if (!Enum.TryParse(propertyName, out inputType) || (inputType == ASF.EUserInputType.Unknown)) {
|
||||
// TODO: Proper response
|
||||
return ResponseUnknown(steamID);
|
||||
if (!Enum.TryParse(propertyName, true, out inputType) || (inputType == ASF.EUserInputType.Unknown)) {
|
||||
return FormatBotResponse(string.Format(Strings.ErrorIsInvalid, nameof(inputType)));
|
||||
}
|
||||
|
||||
SetUserInput(inputType, inputValue);
|
||||
@@ -3036,6 +3034,7 @@ namespace ArchiSteamFarm {
|
||||
ArchiLogger.LogNullError(nameof(inputValue) + " || " + nameof(inputValue));
|
||||
}
|
||||
|
||||
// This switch should cover ONLY bot properties
|
||||
switch (inputType) {
|
||||
case ASF.EUserInputType.DeviceID:
|
||||
DeviceID = inputValue;
|
||||
@@ -3065,7 +3064,7 @@ namespace ArchiSteamFarm {
|
||||
TwoFactorCode = inputValue;
|
||||
break;
|
||||
case ASF.EUserInputType.WCFHostname:
|
||||
// We don't handle ASF properties here
|
||||
// We don't handle global ASF properties here
|
||||
break;
|
||||
default:
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(inputType), inputType));
|
||||
|
||||
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
@@ -774,6 +774,15 @@ namespace ArchiSteamFarm.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This function is available only in headless mode!.
|
||||
/// </summary>
|
||||
internal static string ErrorFunctionOnlyInHeadlessMode {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorFunctionOnlyInHeadlessMode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Global config could not be loaded, please make sure that {0} exists and is valid! Follow setting up guide on the wiki if you're confused..
|
||||
/// </summary>
|
||||
|
||||
@@ -707,4 +707,7 @@ StackTrace:
|
||||
<data name="BotStatusLocked" xml:space="preserve">
|
||||
<value>Bot is locked and can't drop any cards through idling.</value>
|
||||
</data>
|
||||
<data name="ErrorFunctionOnlyInHeadlessMode" xml:space="preserve">
|
||||
<value>This function is available only in headless mode!</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user