From 31ef42b8288f1a403f8b5dd9eaa234da3acac7c9 Mon Sep 17 00:00:00 2001 From: Chris Plaatjes Date: Mon, 13 Feb 2023 16:34:22 -0500 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ Program.cs | 25 +++++++++++++++++++++++++ README.md | 0 TeleTok.csproj | 16 ++++++++++++++++ config.json | 6 ++++++ 5 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 Program.cs create mode 100644 README.md create mode 100644 TeleTok.csproj create mode 100644 config.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d4a6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin +obj \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..281553e --- /dev/null +++ b/Program.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.Configuration; +using System; +using Telegram.Bot; + +namespace TeleTok +{ + class TeleTok + { + static async Task Main(string[] args) + { + var config = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("config.json", true) + .Build(); + + var token = config.GetSection("TeleTokConf:token").Value; + + var botClient = new TelegramBotClient(token); + + var me = await botClient.GetMeAsync(); + + Console.WriteLine($"Hello world! I am user {me.Id} and my name is {me.FirstName}."); + } + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/TeleTok.csproj b/TeleTok.csproj new file mode 100644 index 0000000..42d88b4 --- /dev/null +++ b/TeleTok.csproj @@ -0,0 +1,16 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + diff --git a/config.json b/config.json new file mode 100644 index 0000000..846321e --- /dev/null +++ b/config.json @@ -0,0 +1,6 @@ +{ + "TeleTokConf": { + "token": "INSERT TOKEN HERE", + "port": 5000 + } +} \ No newline at end of file