diff --git a/src/RgDevBot/NewsParser.cs b/src/RgDevBot/NewsParser.cs index f544462..095a1de 100644 --- a/src/RgDevBot/NewsParser.cs +++ b/src/RgDevBot/NewsParser.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; -using System.Text; -using System.Text.Json.Serialization; using Newtonsoft.Json; using RgDevBot.Config; using RgDevBot.ObjectModel; diff --git a/src/RgDevBot/TelegramBot.cs b/src/RgDevBot/TelegramBot.cs index 8094937..3c2cc38 100644 --- a/src/RgDevBot/TelegramBot.cs +++ b/src/RgDevBot/TelegramBot.cs @@ -6,13 +6,25 @@ namespace RgDevBot public class TelegramBot { private readonly TelegramBotClient _telegram; - public string Token => "1479535614:AAFqHdsUFikzOti0zknK_pN2sEONNAXecPY"; public long MainChatId; - public TelegramBot(long chatId = -1001448086132) + public TelegramBot() { + var token = Environment.GetEnvironmentVariable("TELEGRAM_TOKEN"); + if (string.IsNullOrEmpty(token)) + { + Console.WriteLine("Please define TELEGRAM_TOKEN variable."); + return; + } + int.TryParse(Environment.GetEnvironmentVariable("TELEGRAM_CHAT_ID"), out var chatId); + if (chatId == 0) + { + Console.WriteLine("Please define TELEGRAM_CHAT_ID variable."); + return; + } + MainChatId = chatId; - _telegram = new TelegramBotClient(Token); + _telegram = new TelegramBotClient(token); _telegram.OnMessage += Bot_OnMessage; _telegram.StartReceiving(); }