Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skype mentions showing "未知用户" #6631

Closed
chenjunhua8080 opened this issue Jan 17, 2024 · 2 comments
Closed

Skype mentions showing "未知用户" #6631

chenjunhua8080 opened this issue Jan 17, 2024 · 2 comments
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.

Comments

@chenjunhua8080
Copy link

Version

      <dependency>
        <groupId>com.microsoft.bot</groupId>
        <artifactId>bot-integration-spring</artifactId>
        <version>4.14.1</version>
        <scope>compile</scope>
      </dependency>

Code

@Override
    protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
        // Extract the text from the message activity the user sent.
        String text = turnContext.getActivity().getText().toLowerCase();
        if (text.contains(" ")){
            // bot-allen-001 xxx -> xxx
            text = text.substring(text.indexOf(" ") + 1);
        }

        // Take the input from the user and create the appropriate response.
        List<Activity> list = processInput(text, turnContext);

        // Respond to the user.
        return turnContext
            .sendActivities(list)
//            .thenCompose(response -> sendSuggestedActions(turnContext))
            .thenApply(result -> null);
    }
    
     private List<Activity> processInput(String text, TurnContext turnContext) {
        ChannelAccount account = turnContext.getActivity().getFrom();
        ChannelAccount recipient = turnContext.getActivity().getRecipient();
//        String from = String.format("<at id=\"%s\">%s</at>", turnContext.getActivity().getConversation().getId(), account.getName());
        String from = String.format("<at id=\"%s\">%s</at>", account.getId(), account.getName());
//        String from = String.format("%s, ", account.getName());
//        String from = "";
        Mention mention = new Mention();
        mention.setMentioned(account);
        mention.setText(from);

        List<Activity>  list = Lists.newArrayList();
        String msg = "即将运行,一旦有结果我会通知你。ID: " + turnContext.getActivity().getId();
        switch (text) {
            case "eu19_001:pf":
            case "eu19_001:by":
            case "eu19_001:raptor":
                Activity activity1 = MessageFactory.text(from + text + msg);
                activity1.setReplyToId(turnContext.getActivity().getId());
//                activity1.setMentions(Lists.newArrayList(mention));
                list.add(activity1);

                addConversationReference(turnContext.getActivity());
                break;
            case "help":
                list.add(getHelpActivity(from));
                break;
            default:
                Activity activity = MessageFactory.text(from + "请从建议的选项中选择一个通道");
                BeanUtils.copyProperties(turnContext.getActivity(), activity,
                    "id", "timestamp", "from", "recipient", "entities", "text", "channelData");

//                activity.setChannelId(Channels.SKYPE);
//                HashMap<Object, Object> withChannelData = Maps.newHashMap();
//                withChannelData.put("text",activity.getText());
//                activity.setChannelData(withChannelData);

                activity.setMentions(Lists.newArrayList(mention));
//                SkypeMentionNormalizeMiddleware.normalizeSkypeMentionText(activity);

                activity.setFrom(recipient);
                activity.setRecipient(account);

                activity.setSuggestedActions(sendSuggestedActions());


                list.add(activity);
                break;
        }
        return list;
    }

message

image

Why is this happening?

@chenjunhua8080 chenjunhua8080 added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Jan 17, 2024
@dmvtech
Copy link
Collaborator

dmvtech commented Jan 22, 2024

Can you please clarify on the issue? Is the problem that it shows @Allen Chen in the message but when clicked on, it gives 未知用户 (unknown user)?

@dmvtech
Copy link
Collaborator

dmvtech commented Mar 14, 2024

Closing due to lack of response.

@dmvtech dmvtech closed this as completed Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.
Projects
None yet
Development

No branches or pull requests

2 participants