Closed matthewz0584 closed 6 years ago
hi @matthewz0584 - can you provide more details about your issue?
What the issue is, in broad strokes. Link to Stack Overflow post.
The code snippet or complete bot example (preferred) that demonstrates the issue.
Please provide the shortest amount of steps to reproduce your issue.
What you expected to happen.
What actually happened. Please give examples and support it with screenshots, copied output or error messages.
OS: Windows 7 x64 SDK: C#/.Net 4.6 Dev environment: Azure Web App
Issue Activity.GetMentions() for activity originated from Telegram channel group chat returns wrong Mentions array: mentioned users are not there, not mentioned bot is there.
Code
[BotAuthentication]
public class MessagesController : ApiController
{
[ResponseType(typeof(void))]
public virtual async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
if (activity != null)
{
var activityAsJson = JsonConvert.SerializeObject(activity);
var mentionsAsJson = JsonConvert.SerializeObject(activity.GetMentions());
}
return new HttpResponseMessage(HttpStatusCode.Accepted);
}
}
Steps to reproduce In order for the bot to receive the message at all in Telegram we use / symbol which denotes a command to bot. The message we send is (two users are mentioned, and in Telegram mentioned users are in bold font): /hi Андрей Матвей
Expected Behavior Given that, I expect Activity.GetMentions to return correctly filled Mention array, i.e array with two mentions for two mentioned users. Which is quite true for the similar fixture on the Skype channel (the dump of such Activity is given in original issue for reference).
Actual results The bot receives corresponding Activity, its dump is given in original issue, but the GetMentions() method returns only one mention for the bot, while the trully mentioned users could only be found as "text_mentions" in ChannelData property.
@matthewz0584 are you still experiencing the same issue?
Yep, I am. Recent Bot framework update has fixed some issues (Activity.GetMentions throwing StackOverflowException, for example), but, alas, not mine.
Fresh dump with no mentions in Entities property and two text_mention in ChannelData:
"entities": [ { "type": "mention", "mentioned": { "id": "egorbotbot", "name": "egorkabot" }, "text": "egorbotbot" } ], "channelData": { ... "entities": [ { "type": "text_mention", "offset": 1, "length": 6, "user": { "id": 354557895, "first_name": "Sergey", "last_name": "Knyazev" } }, { "type": "text_mention", "offset": 8, "length": 6, "user": { "id": 345018769, "first_name": "Andrey" } } ] }
For now, we parse ChannelData, but I have no idea, why it is not parsed by framework.
open a new issue if further questions
Just want to put on record that facing exactly the same issue even in Bot framework 4.0.
The activities from group chat on Telegram channel contain no mention objects (GetMentions method) although the users are mentioned. Here is the log from some message activity (command to bot - the way for the bot to receive the message). There are mentions (text_mentions?) in channelData, but not in the collection returned by GetMentions, which strangely returns only the bot instead:
/hi Андрей Матвей
Activity: