V17 - Testproject Update
This commit is contained in:
parent
31e52887ba
commit
1fc581b959
@ -21,6 +21,7 @@ namespace TelegramBotBaseTest
|
||||
var bb = BotBaseBuilder
|
||||
.Create()
|
||||
.WithAPIKey(APIKey)
|
||||
.DefaultMessageLoop()
|
||||
.WithStartForm<Start>()
|
||||
.NoProxy()
|
||||
.CustomCommands(a =>
|
||||
@ -37,6 +38,7 @@ namespace TelegramBotBaseTest
|
||||
|
||||
|
||||
|
||||
|
||||
bb.BotCommand += async (s, en) =>
|
||||
{
|
||||
switch (en.Command)
|
||||
@ -67,7 +69,7 @@ namespace TelegramBotBaseTest
|
||||
case "/params":
|
||||
|
||||
String m = en.Parameters.DefaultIfEmpty("").Aggregate((a, b) => a + " and " + b);
|
||||
|
||||
|
||||
await en.Device.Send("Your parameters are: " + m, replyTo: en.Device.LastMessageId);
|
||||
|
||||
en.Handled = true;
|
||||
@ -82,7 +84,7 @@ namespace TelegramBotBaseTest
|
||||
|
||||
bb.SetSetting(TelegramBotBase.Enums.eSettings.LogAllMessages, true);
|
||||
|
||||
bb.Message += (s,en) =>
|
||||
bb.Message += (s, en) =>
|
||||
{
|
||||
Console.WriteLine(en.DeviceId + " " + en.Message.MessageText + " " + (en.Message.RawData ?? ""));
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>netcoreapp3.1;net5</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5;net472;net6</TargetFrameworks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.InputFiles;
|
||||
using Telegram.Bot.Types.ReplyMarkups;
|
||||
|
||||
@ -16,16 +16,9 @@ namespace TelegramBotBaseTest.Tests.Navigation
|
||||
|
||||
public Start()
|
||||
{
|
||||
this.Closed += Start_Closed;
|
||||
|
||||
}
|
||||
|
||||
private async Task Start_Closed(object sender, EventArgs e)
|
||||
{
|
||||
if (msg == null)
|
||||
return;
|
||||
|
||||
await Device.DeleteMessage(msg);
|
||||
}
|
||||
|
||||
public override async Task Load(MessageResult message)
|
||||
{
|
||||
@ -49,12 +42,18 @@ namespace TelegramBotBaseTest.Tests.Navigation
|
||||
|
||||
//Create navigation controller and navigate to it, keep the current form as root form so we can get back to here later
|
||||
var nc = new CustomController(this);
|
||||
nc.ForceCleanupOnLastPop = true;
|
||||
|
||||
var f1 = new Form1();
|
||||
|
||||
await nc.PushAsync(f1);
|
||||
|
||||
await NavigateTo(nc);
|
||||
|
||||
await nc.PushAsync(f1);
|
||||
if (msg == null)
|
||||
return;
|
||||
|
||||
await Device.DeleteMessage(msg);
|
||||
|
||||
|
||||
break;
|
||||
@ -66,6 +65,10 @@ namespace TelegramBotBaseTest.Tests.Navigation
|
||||
|
||||
await NavigateTo(mn);
|
||||
|
||||
if (msg == null)
|
||||
return;
|
||||
|
||||
await Device.DeleteMessage(msg);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -51,10 +51,10 @@ namespace TelegramBotBaseTest.Tests
|
||||
|
||||
default:
|
||||
|
||||
if (message.RawMessageData == null)
|
||||
if (message.UpdateData == null)
|
||||
return;
|
||||
|
||||
this.LastMessage = message.RawMessageData.Message.Text;
|
||||
this.LastMessage = message.Message.Text;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user