From 268bbdf9b729c9f0ec229ba57da9b3bdd6d01a00 Mon Sep 17 00:00:00 2001 From: Chris Plaatjes Date: Wed, 15 Feb 2023 13:53:47 -0500 Subject: [PATCH] Added json field checks --- Program.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Program.cs b/Program.cs index 94eff1b..fefa332 100644 --- a/Program.cs +++ b/Program.cs @@ -15,12 +15,22 @@ namespace TeleTok static async Task Main(string[] args) { - - TelegramListener listener = new TelegramListener(); - Console.WriteLine("Now listening..."); + //Checks if the config json data is valid + if(token == "" || token == null || token == "INSERT TOKEN HERE") + { + LogMessage("Telegram bot token is invalid! Exiting..."); + } + else if(ptInstance == "" || ptInstance == null || ptInstance == "PROXITOK INSTANCE URL") + { + LogMessage("Proxitok instance is invalid! Exiting..."); + } + else + { + TelegramListener listener = new TelegramListener(); + Console.WriteLine("Now listening..."); - listener.RunListener(); - + listener.RunListener(); + } } public static void LogMessage(string text)