OpenTl 自动更新电报消息抛出错误 CS0079 c#
OpenTl auto update on telegram messages throws error CS0079 c#
我最近尝试使用 OpenTL 快速启动页面上的自动更新示例,并且只使用了以下基本示例
await clientApi.UpdatesService.AutoReceiveUpdates += update =>
{
// Handle updates
switch (update)
{
case TUpdates updates:
break;
case TUpdatesCombined updatesCombined:
break;
case TUpdateShort updateShort:
break;
case TUpdateShortChatMessage updateShortChatMessage:
break;
case TUpdateShortMessage updateShortMessage:
break;
case TUpdateShortSentMessage updateShortSentMessage:
break;
case TUpdatesTooLong updatesTooLong:
break;
}
};
它不会编译抛出这个错误:
Error CS0079 The event 'IUpdatesService.AutoReceiveUpdates' can only appear to the left of += or -=
我将其放入异步任务函数中,但我认为这不是问题所在。我真的不知道如何使用这样的异步事件。
link to the example
你写的方式不对。应该是
clientApi.UpdatesService.AutoReceiveUpdates += async update =>
{
// Handle updates
switch (update)
{
我最近尝试使用 OpenTL 快速启动页面上的自动更新示例,并且只使用了以下基本示例
await clientApi.UpdatesService.AutoReceiveUpdates += update =>
{
// Handle updates
switch (update)
{
case TUpdates updates:
break;
case TUpdatesCombined updatesCombined:
break;
case TUpdateShort updateShort:
break;
case TUpdateShortChatMessage updateShortChatMessage:
break;
case TUpdateShortMessage updateShortMessage:
break;
case TUpdateShortSentMessage updateShortSentMessage:
break;
case TUpdatesTooLong updatesTooLong:
break;
}
};
它不会编译抛出这个错误:
Error CS0079 The event 'IUpdatesService.AutoReceiveUpdates' can only appear to the left of += or -=
我将其放入异步任务函数中,但我认为这不是问题所在。我真的不知道如何使用这样的异步事件。 link to the example
你写的方式不对。应该是
clientApi.UpdatesService.AutoReceiveUpdates += async update =>
{
// Handle updates
switch (update)
{