Send Skype messages in Java using taskan’s Java Skype API

My java project needs help I'm trying to send a message in a Skype conversation when a specific action occurs

For this purpose, I use the Java Skype API v1 4 by taskan.

This is my code:

try {
    for (Group group : Skype.getContactList().getAllGroups()) {
        if ((group.getDisplayName()).equals("Nameofthegroup")) { //Whatever the group name is
            String id = group.getId();
            Skype.chat(id).send(ep.getDisplayName() + " joins !");
            ep.sendMessage("Die ID: "+ id);
        }
    }
} catch (Exception e3) {
    e3.printStackTrace();
}

I also tried:

try {
    String id = Skype.getContactList().getGroup("Groupname").getId();
    Skype.chat(id).send(p + "joins!");
} catch (SkypeException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

My problem is that Skype registered an external program to try to do something, but nothing else happened after I allowed access to Java No messages were sent

Solution

Sorry for the late answer, but if you haven't selected the answer, the problem still exists

I'm trying to get your team in the same way, but unfortunately it won't work like this I don't know if this is an API problem or because some functions of Microsoft dropped support from third party APIs don't work properly

I try to solve this problem by searching for chat that is not a group It's also easier if you just want to bookmark (add favorites) the chat (Group) you're looking for

Chat group = null;

    for ( Chat c : Skype.getAllBookmarkedChats() ){
        group = c;
    }

I just do group chat in my favorites, so it's very easy to retrieve it! If you have more chats and you need a more general way to find a specific chat, there are several ways to do this

for (Chat c : Skype.getAllChats()){
        c.getAllMembers();
        c.getId();
        c.getWindowTitle();
    }
    group = c;

But it will be more difficult The getid () method might seem easier, but I didn't try to make it work I don't know if it's my problem or just API, but whether I try simple, it just doesn't work Don't forget to print your results on the console to relax yourself

Finally, if you try to have a group chat, sending a message is very simple:

group.send("Hi chat! This is java!!");

edit

This API is only applicable to P2P chat If you want to create a P2P chat, you need to use the / createmodeledchat command in any chat, which will create a new empty P2P chat Any other group will be cloud - based automation

See also this

Second edit

API is completely dead

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>