diff --git a/.github/workflows/build-test-pack-push-release.yml b/.github/workflows/build-test-pack-push-release.yml
new file mode 100644
index 0000000..d5febb1
--- /dev/null
+++ b/.github/workflows/build-test-pack-push-release.yml
@@ -0,0 +1,38 @@
+name: Build Test Pack Push Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ release_notes:
+ description: "Release notes"
+ required: true
+ version:
+ description: "Release version (ex: 1.0.0)"
+ required: true
+
+permissions:
+ contents: write
+ id-token: write
+ packages: write
+
+jobs:
+ build-test-pack-push:
+ uses: ./.github/workflows/build-test-pack-push.yml
+ with:
+ release_notes: ${{ inputs.release_notes }}
+ version: ${{ inputs.version }}
+ secrets: inherit
+
+ release:
+ runs-on: ubuntu-latest
+ needs: [ build-test-pack-push ]
+ steps:
+ - name: Release
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: v${{ inputs.version }}
+ body: |
+ ## Release Notes
+ ${{ inputs.release_notes }}
+ prerelease: true
+ generate_release_notes: true
\ No newline at end of file
diff --git a/.github/workflows/build-test-pack-push.yml b/.github/workflows/build-test-pack-push.yml
new file mode 100644
index 0000000..a6399c7
--- /dev/null
+++ b/.github/workflows/build-test-pack-push.yml
@@ -0,0 +1,55 @@
+name: Build Test Pack Push
+
+on:
+ workflow_call:
+ inputs:
+ wfl_call:
+ description: 'is called from workflow'
+ type: boolean
+ required: false
+ default: true
+ release_notes:
+ description: 'Release notes'
+ type: string
+ required: true
+ version:
+ description: 'Release version'
+ type: string
+ required: true
+ workflow_dispatch:
+ pull_request:
+ branches:
+ - main
+
+env:
+ PROJECT_PATH: ./src/TgBotPlay.WebAPI
+ UNITTEST_PATH:
+ CONFIGURATION: Release
+ RELEASE_NOTES: ${{ inputs.release_notes }}
+ VERSION: ${{ inputs.version || '0.0.1'}}
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup .NET Core
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.0.x
+ - name: Restore dependencies
+ run: dotnet restore $PROJECT_PATH
+ - name: Build
+ run: dotnet build $PROJECT_PATH --no-restore --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\""
+ # - name: Test
+ # run: dotnet test $UNITTEST_PATH --verbosity normal --configuration $CONFIGURATION
+ - name: Push Package to NuGet.org
+ if: ${{ inputs.wfl_call }}
+ run: dotnet nuget push **\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
+ - name: Tag and push
+ if: ${{ inputs.wfl_call }}
+ run: |
+ git tag v$VERSION
+ git push --tags
\ No newline at end of file
diff --git a/logo/logo.jpg b/logo/logo.jpg
new file mode 100644
index 0000000..fa018d8
Binary files /dev/null and b/logo/logo.jpg differ
diff --git a/src/TgBotPlay.WebAPI/TgBotPlay.WebAPI.csproj b/src/TgBotPlay.WebAPI/TgBotPlay.WebAPI.csproj
index f4d2245..20ffb25 100644
--- a/src/TgBotPlay.WebAPI/TgBotPlay.WebAPI.csproj
+++ b/src/TgBotPlay.WebAPI/TgBotPlay.WebAPI.csproj
@@ -1,7 +1,30 @@
- net8.0
+ net9.0;net8.0;net7.0;net6.0;
+ 12.0
+ true
+ TgBotPlay.WebAPI
+ Mohammad Mahdi Nazari
+ IPdotSetAF
+ A comprehensive WebAPI integration library for Telegram Bot development with support for both polling and webhook modes, health checks, and flexible configuration options.
+ https://github.com/IPdotSetAF/TgBotPlay.WebAPI
+ https://github.com/IPdotSetAF/TgBotPlay.WebAPI
+ git
+ LGPL-2.1-or-later
+ telegram;bot;webapi;aspnetcore;polling;webhook
+ README.md
+ logo.jpg
+ IPdotSetAF © 2025
+ true
+ true
+ snupkg
+ true
+ bin\$(Configuration)\$(TargetFramework)\$(PackageId).xml
+ $(NoWarn);1591
+
+
+
enable
enable
@@ -10,4 +33,9 @@
+
+
+
+
+
diff --git a/src/TgBotPlay.WebAPI/TgBotPlayExtensions.cs b/src/TgBotPlay.WebAPI/TgBotPlayExtensions.cs
index c260e93..ae541c0 100644
--- a/src/TgBotPlay.WebAPI/TgBotPlayExtensions.cs
+++ b/src/TgBotPlay.WebAPI/TgBotPlayExtensions.cs
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Http;
using Microsoft.Extensions.Options;
using Telegram.Bot;
using Telegram.Bot.AspNetCore;
@@ -24,8 +25,15 @@ public static IServiceCollection AddTgBotPlay(this IServiceColle
{
var settings = services.ConfigureSettings(options);
- services.AddHttpClient("TgBotPlayClient").RemoveAllLoggers().AddTypedClient(
- httpClient => new TelegramBotClient(settings.Token!, httpClient));
+ services.AddHttpClient("TgBotPlayClient")
+#if NET8_0_OR_GREATER
+ .RemoveAllLoggers()
+#endif
+ .AddTypedClient(
+ httpClient => new TelegramBotClient(new TelegramBotClientOptions(settings.Token!), httpClient));
+#if NET6_0 || NET7_0
+ services.RemoveAll();
+#endif
services.AddScoped();