Migrate to dotnet 9 and minor improvements

This commit is contained in:
2024-11-05 17:47:17 +03:30
parent 51747b3e3d
commit c2c7732552
3 changed files with 5 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ before_script:
build: build:
stage: build stage: build
image: mcr.microsoft.com/dotnet/sdk:8.0 image: mcr.microsoft.com/dotnet/sdk:9.0-bookworm-slim
script: script:
- dotnet nuget add source https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json -n Telegram.Bot - dotnet nuget add source https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json -n Telegram.Bot
- dotnet restore --no-cache - dotnet restore --no-cache

View File

@@ -59,7 +59,7 @@ namespace mstdnCats.Services
, replyMarkup: new InlineKeyboardMarkup(InlineKeyboardButton.WithUrl("View on Mastodon", post.Url))); , replyMarkup: new InlineKeyboardMarkup(InlineKeyboardButton.WithUrl("View on Mastodon", post.Url)));
await _bot.AnswerCallbackQuery(callbackQuery.Id, "Media attachment approved and sent to channel."); await _bot.AnswerCallbackQuery(callbackQuery.Id, "Media attachment approved and sent to channel.");
await _bot.DeleteMessage(callbackQuery.Message.Chat.Id, callbackQuery.Message.MessageId); await _bot.DeleteMessage(callbackQuery.Message.Chat.Id, callbackQuery.Message.Id);
logger?.LogTrace($"Media attachment {mediaId} approved."); logger?.LogTrace($"Media attachment {mediaId} approved.");
@@ -84,7 +84,7 @@ namespace mstdnCats.Services
if (post.MediaAttachments.Count == 1 && post.MediaAttachments.First().MediaId == mediaId) if (post.MediaAttachments.Count == 1 && post.MediaAttachments.First().MediaId == mediaId)
{ {
await _bot.AnswerCallbackQuery(callbackQuery.Id, "Post has only one attachment. No deletion performed."); await _bot.AnswerCallbackQuery(callbackQuery.Id, "Post has only one attachment. No deletion performed.");
await _bot.DeleteMessage(callbackQuery.Message.Chat.Id, callbackQuery.Message.MessageId); await _bot.DeleteMessage(callbackQuery.Message.Chat.Id, callbackQuery.Message.Id);
logger?.LogTrace($"Post {post.mstdnPostId} has only one attachment. No deletion performed."); logger?.LogTrace($"Post {post.mstdnPostId} has only one attachment. No deletion performed.");
} }
@@ -93,7 +93,7 @@ namespace mstdnCats.Services
post.MediaAttachments.RemoveAll(m => m.MediaId == mediaId); post.MediaAttachments.RemoveAll(m => m.MediaId == mediaId);
await _db.UpdateOneAsync(p => p.mstdnPostId == post.mstdnPostId, post); await _db.UpdateOneAsync(p => p.mstdnPostId == post.mstdnPostId, post);
await _bot.AnswerCallbackQuery(callbackQuery.Id, "Media attachment rejected."); await _bot.AnswerCallbackQuery(callbackQuery.Id, "Media attachment rejected.");
await _bot.DeleteMessage(callbackQuery.Message.Chat.Id, callbackQuery.Message.MessageId); await _bot.DeleteMessage(callbackQuery.Message.Chat.Id, callbackQuery.Message.Id);
logger?.LogTrace($"Media attachment {mediaId} removed from post {post.mstdnPostId}."); logger?.LogTrace($"Media attachment {mediaId} removed from post {post.mstdnPostId}.");
} }

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault> <JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>