Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
修复
Browse files Browse the repository at this point in the history
  • Loading branch information
Yushu2606 committed Aug 23, 2023
1 parent a2cc0f5 commit 5e2e063
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/Functions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LiteDB;
using LiteDB;
using Telegram.Bot;
using Telegram.Bot.Exceptions;
using Telegram.Bot.Types;
Expand All @@ -18,16 +18,16 @@ public static async Task OnCallback(this CallbackQuery callbackQuery)
return;
}
Internationalization lang = Program.I18n.GetI18n(callbackQuery.From.LanguageCode);
if (!Program.GroupData.TryGetValue(callbackQuery.Message.Chat.Id, out Dictionary<long, int>? data)
|| !data.TryGetValue(callbackQuery.From.Id, out int historyMessageId)
|| historyMessageId != callbackQuery.Message.MessageId)
if (!Program.GroupData.TryGetValue(callbackQuery.Message.Chat.Id, out Dictionary<long, int>? data) ||
!data.TryGetValue(callbackQuery.From.Id, out int historyMessageId) ||
historyMessageId != callbackQuery.Message.MessageId)
{
await Program.BotClient.AnswerCallbackQueryAsync(callbackQuery.Id, lang["Failed"]);
return;
}
try
{
await Program.BotClient.ApproveChatJoinRequest(callbackQuery.Message.Chat.Id, data[callbackQuery.From.Id]);
await Program.BotClient.ApproveChatJoinRequest(callbackQuery.Message.Chat.Id, callbackQuery.From.Id);
}
catch (ApiRequestException)
{
Expand Down Expand Up @@ -94,13 +94,13 @@ public static async Task OnSet(this Message message)
}
public static async Task OnJoin(this User member, long chatId, Dictionary<long, int> data)
{
if (!data.ContainsKey(member.Id))
if (!data.TryGetValue(member.Id, out int value))
{
return;
}
try
{
await Program.BotClient.DeleteMessageAsync(chatId, data[member.Id]);
await Program.BotClient.DeleteMessageAsync(chatId, value);
}
catch (ApiRequestException)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ConfigHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text.Json;
using System.Text.Json;

namespace Yan.Utils;
public record ConfigHelper(string Token, string ProxyUrl, bool EnableAutoI18n)
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/MarkdownHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text;
using System.Text;

namespace Yan.Utils;

Expand Down

0 comments on commit 5e2e063

Please sign in to comment.