From 2301bc2a1f7db15562e6c31a723f810ccb1a0a34 Mon Sep 17 00:00:00 2001 From: Chr_ Date: Mon, 27 Mar 2023 22:30:48 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XinjingdailyBot.Command/NormalCommand.cs | 2 +- .../Extensions/ChatExtension.cs | 5 ++--- .../Model/IpInfoResponse.cs | 18 +++++++++--------- .../Bot/Common/DispatcherService.cs | 5 ----- .../Bot/Common/PollingService.cs | 2 +- .../Bot/Handler/ChannelPostHandler.cs | 1 - 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/XinjingdailyBot.Command/NormalCommand.cs b/XinjingdailyBot.Command/NormalCommand.cs index 744f54d6..1a20b2f9 100644 --- a/XinjingdailyBot.Command/NormalCommand.cs +++ b/XinjingdailyBot.Command/NormalCommand.cs @@ -415,7 +415,7 @@ public async Task QGetRandomPost(Users dbUser, CallbackQuery callbackQuery, stri } [TextCmd("IP", UserRights.NormalCmd, Alias = "IPINFO", Description = "查询IP信息")] - public async Task GetIpInfo(Users dbUser, Message message, string[] args) + public async Task GetIpInfo(Message message, string[] args) { StringBuilder sb = new(); if (args.Length < 1) diff --git a/XinjingdailyBot.Infrastructure/Extensions/ChatExtension.cs b/XinjingdailyBot.Infrastructure/Extensions/ChatExtension.cs index 1c29da46..68e2dbdf 100644 --- a/XinjingdailyBot.Infrastructure/Extensions/ChatExtension.cs +++ b/XinjingdailyBot.Infrastructure/Extensions/ChatExtension.cs @@ -1,5 +1,4 @@ -using System.Threading.Channels; -using Telegram.Bot.Types; +using Telegram.Bot.Types; namespace XinjingdailyBot.Infrastructure.Extensions { @@ -35,7 +34,7 @@ public static string EscapedChatName(this Chat chat) return chat.Title?.EscapeHtml() ?? ""; } - public static string GetMessageLink (this Chat chat,long messageId) + public static string GetMessageLink(this Chat chat, long messageId) { string link = !string.IsNullOrEmpty(chat.Username) ? $"https://t.me/{chat.Username}/{messageId}" : $"https://t.me/c/{chat.Id}/{messageId}"; return link; diff --git a/XinjingdailyBot.Infrastructure/Model/IpInfoResponse.cs b/XinjingdailyBot.Infrastructure/Model/IpInfoResponse.cs index 8b7ed991..8145cd9c 100644 --- a/XinjingdailyBot.Infrastructure/Model/IpInfoResponse.cs +++ b/XinjingdailyBot.Infrastructure/Model/IpInfoResponse.cs @@ -6,31 +6,31 @@ public sealed record IpInfoResponse { [JsonPropertyName("ip")] public string? Ip { get; set; } - + [JsonPropertyName("hostname")] public string? Hostname { get; set; } - + [JsonPropertyName("anycast")] public bool AnyCast { get; set; } - + [JsonPropertyName("city")] public string? City { get; set; } - + [JsonPropertyName("region")] public string? Region { get; set; } - + [JsonPropertyName("country")] public string? Country { get; set; } - + [JsonPropertyName("loc")] public string? Loc { get; set; } - + [JsonPropertyName("org")] public string? Org { get; set; } - + [JsonPropertyName("postal")] public string? Postal { get; set; } - + [JsonPropertyName("timezone")] public string? Timezone { get; set; } } diff --git a/XinjingdailyBot.Service/Bot/Common/DispatcherService.cs b/XinjingdailyBot.Service/Bot/Common/DispatcherService.cs index 34ab59ed..9664f9b5 100644 --- a/XinjingdailyBot.Service/Bot/Common/DispatcherService.cs +++ b/XinjingdailyBot.Service/Bot/Common/DispatcherService.cs @@ -3,11 +3,9 @@ using Telegram.Bot.Types; using Telegram.Bot.Types.Enums; using XinjingdailyBot.Infrastructure.Attribute; -using XinjingdailyBot.Infrastructure.Localization; using XinjingdailyBot.Interface.Bot.Common; using XinjingdailyBot.Interface.Bot.Handler; using XinjingdailyBot.Interface.Data; -using XinjingdailyBot.Interface.Helper; using XinjingdailyBot.Model.Models; using XinjingdailyBot.Repository; @@ -21,7 +19,6 @@ internal class DispatcherService : IDispatcherService private readonly ICommandHandler _commandHandler; private readonly IChannelPostHandler _channelPostHandler; private readonly IChannelService _channelService; - private readonly ITextHelperService _textHelperService; private readonly ITelegramBotClient _botClient; private readonly IJoinRequestHandler _joinRequestHandler; private readonly IInlineQueryHandler _inlineQueryHandler; @@ -34,7 +31,6 @@ public DispatcherService( ICommandHandler commandHandler, IChannelPostHandler channelPostHandler, IChannelService channelService, - ITextHelperService textHelperService, ITelegramBotClient botClient, IJoinRequestHandler joinRequestHandler, IInlineQueryHandler inlineQueryHandler, @@ -46,7 +42,6 @@ public DispatcherService( _commandHandler = commandHandler; _channelPostHandler = channelPostHandler; _channelService = channelService; - _textHelperService = textHelperService; _botClient = botClient; _joinRequestHandler = joinRequestHandler; _inlineQueryHandler = inlineQueryHandler; diff --git a/XinjingdailyBot.Service/Bot/Common/PollingService.cs b/XinjingdailyBot.Service/Bot/Common/PollingService.cs index 3c611ccf..4ae43595 100644 --- a/XinjingdailyBot.Service/Bot/Common/PollingService.cs +++ b/XinjingdailyBot.Service/Bot/Common/PollingService.cs @@ -71,7 +71,7 @@ private async Task DoWork(CancellationToken stoppingToken) catch (Exception ex) { - _logger.LogError(ex,"接收服务运行出错"); + _logger.LogError(ex, "接收服务运行出错"); await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); } } diff --git a/XinjingdailyBot.Service/Bot/Handler/ChannelPostHandler.cs b/XinjingdailyBot.Service/Bot/Handler/ChannelPostHandler.cs index 02c89dc6..137450f0 100644 --- a/XinjingdailyBot.Service/Bot/Handler/ChannelPostHandler.cs +++ b/XinjingdailyBot.Service/Bot/Handler/ChannelPostHandler.cs @@ -1,5 +1,4 @@ using System.Collections.Concurrent; -using System.ComponentModel; using Microsoft.Extensions.Logging; using Telegram.Bot; using Telegram.Bot.Types;