コード例 #1
0
        public async IAsyncEnumerable <MessageResponse> GroupHandler(Message message, long groupId)
        {
            yield return("查询中……");

            if (!await _groupService.IsGroupExistsAsync(groupId))
            {
                yield return("没有这样的群");

                yield break;
            }

            var chat = await _botClient.GetChatAsync(groupId);

            var inviteLink = chat.InviteLink ?? await _botClient.ExportChatInviteLinkAsync(groupId);

            yield return(Text("您可以进入该群")
                         .WithInlineButtons(InlineButton.WithUrl(chat.Title, inviteLink)));
        }