Initial commit
This commit is contained in:
commit
31ef42b828
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
bin
|
||||
obj
|
25
Program.cs
Normal file
25
Program.cs
Normal 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}.");
|
||||
}
|
||||
}
|
||||
}
|
16
TeleTok.csproj
Normal file
16
TeleTok.csproj
Normal 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
6
config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"TeleTokConf": {
|
||||
"token": "INSERT TOKEN HERE",
|
||||
"port": 5000
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user