Initial commit

This commit is contained in:
Chris Plaatjes 2023-02-13 16:34:22 -05:00
commit 31ef42b828
5 changed files with 49 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
bin
obj

25
Program.cs Normal file
View File

@ -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}.");
}
}
}

0
README.md Normal file
View File

16
TeleTok.csproj Normal file
View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Telegram.Bot" Version="18.0.0" />
</ItemGroup>
</Project>

6
config.json Normal file
View File

@ -0,0 +1,6 @@
{
"TeleTokConf": {
"token": "INSERT TOKEN HERE",
"port": 5000
}
}