-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (31 loc) · 997 Bytes
/
Program.cs
File metadata and controls
39 lines (31 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using SNotefier.TelegramBot;
namespace SNotefier
{
internal static class Program
{
static void Main(string[] args)
{
Start(args);
}
internal static void Start(string[] args)
{
var bot = new Bot(GetBotToken(), GetBotUser());
bot.Start();
Task.Delay(-1).Wait();
}
private static string GetBotToken()
{
var token = Environment.GetEnvironmentVariable("TELEGRAM_BOT_TOKEN");
if (token == null)
throw new SystemException("Can't find Bot token in enviroment variables");
return token;
}
private static string GetBotUser()
{
var user = Environment.GetEnvironmentVariable("BOT_USER");
if (user == null)
throw new SystemException("Can't find Bot user in enviroment variables");
return user;
}
}
}