diff --git a/pmcenter/BotCommands/DetectPermissionCommand.cs b/pmcenter/BotCommands/DetectPermissionCommand.cs index 4c64f63..9dab011 100644 --- a/pmcenter/BotCommands/DetectPermissionCommand.cs +++ b/pmcenter/BotCommands/DetectPermissionCommand.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using System.Threading.Tasks; using Telegram.Bot; using Telegram.Bot.Types; @@ -15,13 +16,13 @@ internal class DetectPermissionCommand : IBotCommand public async Task ExecuteAsync(TelegramBotClient botClient, Update update) { - var confWritable = FlipBool((new FileInfo(Vars.ConfFile)).IsReadOnly); - var langWritable = FlipBool((new FileInfo(Vars.LangFile)).IsReadOnly); + var confWritable = !(new FileInfo(Vars.ConfFile)).IsReadOnly; + var langWritable = !(new FileInfo(Vars.LangFile)).IsReadOnly; _ = await botClient.SendTextMessageAsync( update.Message.From.Id, Vars.CurrentLang.Message_ConfAccess - .Replace("$1", BoolStr(confWritable)) - .Replace("$2", BoolStr(langWritable)) + .Replace("$1", confWritable.ToString()) + .Replace("$2", langWritable.ToString()) , ParseMode.Markdown, false, diff --git a/pmcenter/BotProcess/BotProcess.OwnerCommand.cs b/pmcenter/BotProcess/BotProcess.OwnerCommand.cs index 445f733..73e72ed 100644 --- a/pmcenter/BotProcess/BotProcess.OwnerCommand.cs +++ b/pmcenter/BotProcess/BotProcess.OwnerCommand.cs @@ -37,9 +37,9 @@ private static async Task OwnerCommand(Update update) // Process locale. if (Vars.CurrentConf.EnableRepliedConfirmation) { - var ReplyToMessage = Vars.CurrentLang.Message_ReplySuccessful; - ReplyToMessage = ReplyToMessage.Replace("$1", $"[{Vars.CurrentConf.ContChatTarget}](tg://user?id={Vars.CurrentConf.ContChatTarget})"); - _ = await Vars.Bot.SendTextMessageAsync(update.Message.From.Id, ReplyToMessage, ParseMode.Markdown, false, false, update.Message.MessageId).ConfigureAwait(false); + var replyToMessage = Vars.CurrentLang.Message_ReplySuccessful; + replyToMessage = replyToMessage.Replace("$1", $"[{Vars.CurrentConf.ContChatTarget}](tg://user?id={Vars.CurrentConf.ContChatTarget})"); + _ = await Vars.Bot.SendTextMessageAsync(update.Message.From.Id, replyToMessage, ParseMode.Markdown, false, false, update.Message.MessageId).ConfigureAwait(false); } Log($"Successfully passed owner's reply to UID: {Vars.CurrentConf.ContChatTarget}", "BOT"); return; diff --git a/pmcenter/Methods/Methods.BoolStr.cs b/pmcenter/Methods/Methods.BoolStr.cs deleted file mode 100644 index fbf0b95..0000000 --- a/pmcenter/Methods/Methods.BoolStr.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace pmcenter -{ - public static partial class Methods - { - public static string BoolStr(bool input) - { - return input ? "true" : "false"; - } - } -} diff --git a/pmcenter/Methods/Methods.FlipBool.cs b/pmcenter/Methods/Methods.FlipBool.cs deleted file mode 100644 index cc07831..0000000 --- a/pmcenter/Methods/Methods.FlipBool.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace pmcenter -{ - public static partial class Methods - { - public static bool FlipBool(bool input) - { - return input ? false : true; - } - } -}