pull file
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Close Stale Issues / close_stale_issues (push) Has been cancelled
repo-sync / repo-sync (push) Has been cancelled
auto-deploy-tencent-scf / pre-check (push) Has been cancelled
auto-deploy-tencent-scf / deploy serverless (push) Has been cancelled

This commit is contained in:
2026-02-11 23:32:56 +08:00
commit e519cac94e
656 changed files with 45058 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Ray.BiliBiliTool.Console;
using Ray.BiliBiliTool.Infrastructure;
using Ray.Serilog.Sinks.TelegramBatched;
using Xunit;
namespace LogTest
{
public class TestTelegram
{
private string _botToken;
private string _chatId;
public TestTelegram()
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
Program.CreateHost(["ENVIRONMENT=Development"]);
_botToken = Global.ConfigurationRoot?["Serilog:WriteTo:3:Args:botToken"];
_chatId = Global.ConfigurationRoot?["Serilog:WriteTo:3:Args:chatId"];
}
[Fact]
public async Task Test2()
{
var client = new TelegramApiClient(_botToken, _chatId);
string msg = LogConstants.Msg2;
var result = await client.PushMessageAsync(msg, "标题");
Debug.WriteLine(result.Content.ReadAsStringAsync().Result);
/*
* 如果指定markdown星号会导致推送失败
*/
}
}
}