Skip to content

Commit

Permalink
gitignore personal app settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Jul 21, 2024
1 parent 1fef294 commit d7696bf
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 66 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ ModelManifest.xml
.idea/
*.*.iml

# Settings for different environments
appsettings.*.json
launchSettings.json

out.json
Expand Down
2 changes: 1 addition & 1 deletion Console.Advanced/Console.Advanced.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Telegram.Bot" Version="21.7.0" />
<PackageReference Include="Telegram.Bot" Version="21.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Console.Advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ template for hosting Bot application.

## Prerequisites

Please make sure you have .NET 6 or newer installed. You can download .NET runtime from the [official site.](https://dotnet.microsoft.com/download)
Please make sure you have .NET 8 or newer installed. You can download .NET runtime from the [official site.](https://dotnet.microsoft.com/download)

You have to add [Telegram.Bot](https://www.nuget.org/packages/Telegram.Bot/)
nuget package to your project to be able to use polling:
Expand All @@ -35,11 +35,11 @@ Make sure that your .csproj contains these items (versions may vary):

You should provide your Telegram Bot token with one of the available providers.
Read futher on [Configuration in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-6.0).
We provide plaecehoder for bot configuration in `appsettings*.json`. You have to replace {BOT_TOKEN} with actual Bot token:
We provide placeholder for bot configuration in `appsettings.json`. You have to replace YOUR_BOT_TOKEN with actual Bot token:

```json
"BotConfiguration": {
"BotToken": "{BOT_TOKEN}"
"BotToken": "YOUR_BOT_TOKEN"
}
```

Expand Down
11 changes: 0 additions & 11 deletions Console.Advanced/appsettings.Development.json

This file was deleted.

2 changes: 1 addition & 1 deletion Console.Advanced/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"BotConfiguration": {
"BotToken": "YOUR_BOT_TOKEN",
"BotToken": "YOUR_BOT_TOKEN"
}
}
2 changes: 1 addition & 1 deletion Console/Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Telegram.Bot" Version="21.7.0" />
<PackageReference Include="Telegram.Bot" Version="21.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;

var token = Environment.GetEnvironmentVariable("TOKEN");
token ??= "{YOUR_BOT_TOKEN}";
// replace YOUR_BOT_TOKEN below, or set your TOKEN in Project Properties > Debug > Launch profiles UI > Environment variables
var token = Environment.GetEnvironmentVariable("TOKEN") ?? "YOUR_BOT_TOKEN";

using var cts = new CancellationTokenSource();
var bot = new TelegramBotClient(token, cancellationToken: cts.Token);
Expand Down Expand Up @@ -115,7 +115,7 @@ async Task OnUpdate(Update update)
async Task OnCallbackQuery(CallbackQuery callbackQuery)
{
await bot.AnswerCallbackQueryAsync(callbackQuery.Id, $"You selected {callbackQuery.Data}");
await bot.SendTextMessageAsync(callbackQuery.Message!.Chat.Id, $"Received callback from inline button {callbackQuery.Data}");
await bot.SendTextMessageAsync(callbackQuery.Message!.Chat, $"Received callback from inline button {callbackQuery.Data}");
}

async Task OnPollAnswer(PollAnswer pollAnswer)
Expand Down
11 changes: 0 additions & 11 deletions FSharp.Example/appsettings.Development.json

This file was deleted.

2 changes: 1 addition & 1 deletion FSharp.Example/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"BotConfiguration": {
"BotToken": "{BOT_TOKEN}"
"BotToken": "YOUR_BOT_TOKEN"
}
}
3 changes: 2 additions & 1 deletion InlineQueries/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

const int MaxEntries = 20;

var token = Environment.GetEnvironmentVariable("TOKEN")!;
// replace YOUR_BOT_TOKEN below, or set your TOKEN in Project Properties > Debug > Launch profiles UI > Environment variables
var token = Environment.GetEnvironmentVariable("TOKEN") ?? "YOUR_BOT_TOKEN";

// load all articles, sorted alphabetically, in memory (not optimal if you have a huge base of articles)
var files = Directory.GetFiles("Articles", "*.html");
Expand Down
10 changes: 0 additions & 10 deletions InlineQueries/Properties/launchSettings.json

This file was deleted.

2 changes: 1 addition & 1 deletion Webhook.Controllers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can find useful information on setting up webhook for your bot in official d

## Setup

Please make sure you have .NET 6 or newer installed. You can download .NET runtime from the [official site.](https://dotnet.microsoft.com/download)
Please make sure you have .NET 8 or newer installed. You can download .NET runtime from the [official site.](https://dotnet.microsoft.com/download)
This is a short description how you can test your bot locally. The description presumes that you already have a bot and it’s token. If not, please create one. You’ll find several explanations on the internet how to do this.

### Bot configuration
Expand Down
8 changes: 4 additions & 4 deletions Webhook.Controllers/Services/UpdateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update,
{ ChosenInlineResult: { } chosenInlineResult } => OnChosenInlineResult(chosenInlineResult),
{ Poll: { } poll } => OnPoll(poll),
{ PollAnswer: { } pollAnswer } => OnPollAnswer(pollAnswer),
// UpdateType.ChannelPost:
// UpdateType.EditedChannelPost:
// UpdateType.ShippingQuery:
// UpdateType.PreCheckoutQuery:
// ChannelPost:
// EditedChannelPost:
// ShippingQuery:
// PreCheckoutQuery:
_ => UnknownUpdateHandlerAsync(update)
});
}
Expand Down
2 changes: 1 addition & 1 deletion Webhook.Controllers/Webhook.Controllers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Telegram.Bot" Version="21.7.0" />
<PackageReference Include="Telegram.Bot" Version="21.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 0 additions & 8 deletions Webhook.Controllers/appsettings.Development.json

This file was deleted.

2 changes: 1 addition & 1 deletion Webhook.MinimalAPIs/Webhook.MinimalAPIs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Telegram.Bot" Version="21.3.0" />
<PackageReference Include="Telegram.Bot" Version="21.7.1" />
</ItemGroup>

</Project>
8 changes: 0 additions & 8 deletions Webhook.MinimalAPIs/appsettings.Development.json

This file was deleted.

0 comments on commit d7696bf

Please sign in to comment.