Exemplo n.º 1
0
        public IActionResult TranslateRaw([FromRoute] string question, [FromQuery] string lang)
        {
            var result = _bingTranslator.CallTranslate(question, lang);

            return(Json(new
            {
                value = result
            }));
        }
Exemplo n.º 2
0
        public override async Task OnMessage(string inputMessage, NewMessageEvent eventContext)
        {
            if (eventContext.Muted)
            {
                return;
            }
            if (eventContext.Message.SenderId == Profile.Id)
            {
                return;
            }
            inputMessage = inputMessage.Replace($"@{Profile.NickName.Replace(" ", "")}", "");
            var translated = _bingTranslator.CallTranslate(inputMessage, "en");

            await SendMessage(translated, eventContext.Message.ConversationId, eventContext.AESKey);
        }
Exemplo n.º 3
0
        public override async Task OnMessage(string inputMessage, NewMessageEvent eventContext)
        {
            if (eventContext.Muted)
            {
                return;
            }
            if (eventContext.Message.SenderId == Profile.Id)
            {
                return;
            }
            inputMessage = RemoveMentionMe(inputMessage);
            var translated = _bingTranslator.CallTranslate(inputMessage, "en");

            if (eventContext.Mentioned)
            {
                translated += Mention(eventContext.Message.Sender);
            }
            await SendMessage(translated, eventContext.ConversationId);
        }