[英]OpenTl auto update on telegram messages throws error CS0079 c#
I recently tried to use the auto update example that is on the OpenTL quick start page, and just using the following basic example我最近尝试使用 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;
}
};
It won't compile throwing this error :它不会编译抛出此错误:
Error CS0079 The event 'IUpdatesService.AutoReceiveUpdates' can only appear to the left of += or -=错误 CS0079 事件“IUpdatesService.AutoReceiveUpdates”只能出现在 += 或 -= 的左侧
I put it into an async Task function, but I don't think thats the problem.我把它放到一个异步任务函数中,但我认为这不是问题所在。 I don't really know how to use an async event like that.我真的不知道如何使用这样的异步事件。 link to the example 链接到示例
The way you have written it is wrong.你写的方式不对。 It rather should be而是应该
clientApi.UpdatesService.AutoReceiveUpdates += async update =>
{
// Handle updates
switch (update)
{
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.