jSkype is a java skype API that allows you to easily create bots. This API will provide you with a thread-safe & reflectionless event bus and a command bus;
#Features (confirmed)
- Ping chats with images
- Get contact requests
- Get recent groups
- Get contacts
- Add and remove users from groups
- Send messages
- Format messages
- Accept contact requests
- Send contact requests
- Change a groups topic
- User information
- Search Skype's DB
- Change your profile picture
- Set your online status
- Get info about yourself
- Always online (Doesn't break after 2 days plus can survive internet shortage)
- Create and join groups
- Promote and demote users
#Events
- Edit message (UserChatEvent#isEdited)
- TopicChangedEvent (Cancellable)
- UserChatEvent
- UserImagePingEvent
- UserOtherFilesPingEvent
- UserJoinEvent
- UserLeaveEvent
- UserPendingContactRequestEvent
- UserTypingEvent
- ChatPictureChangedEvent
- UserNewMovieAdsPingEvent
- UserRoleChangedEvent
- UserStatusChangedEvent (online status)
- APILoadedEvent
#Downloads, Javadocs, etc JavaDocs: http://gghost.xyz/JavaDocs/jSkype
Maven: http://maven.gghost.xyz OR http://ghosted.me/maven
Repository:
<repository>
<id>xyz.gghost</id>
<url>http://gghost.xyz/maven/</url>
</repository>
Dependency:
<dependency>
<groupId>xyz.gghost</groupId>
<artifactId>jskype</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
#Creating a skype instance Before creating a Skype instance, you'll need to confirm whether or not you login with an email/pass or user/pass. If you login with a username and password, you can create a new instance of SkypeAPI with the arguments (username, password).
Example user/pass:
SkypeAPI skype = new SkypeAPI("Username", "Password").login();
#Sending chat messages Sending a message to all contacts example:
skype.getContacts().forEach(contact -> contact.sendMessage("Hi"));
Sending a message to all recent groups and contacts example:
skype.getGroups().forEach(group -> group.sendMessage("Hi"));
Editing a message:
Message message = group.sendMessage(skype, "Hi");
message.editMessage("");
MessageBuilder is the builder class for constructing string that is safe to pass to Group#sendMessage. In order to add text to the message builder, use #addText. Only use #addHtml with past outputs from #build and html code you know is safe. If you'd like to add two message builders together, simply builderA.build() + builderB.build() would work, however I recommend you to pass the old build output to the constructor of the new builder instance, if you want to make a clean message builder. Otherwise, you can use the FormatUtils class for small, quick jobs.
#Example command handler usage:
public class TestCommand extends Command
{
public TestCommand()
{
super("test");
}
@Override
public void execute()
{
getChat().sendMessage(getSender().getUsername() + " said Hi!");
}
}
public class Main
{
public static void main(String[] args) throws Exception
{
SkypeAPI skype = new SkypeAPI("username", "password").login();
skype.getCommandBus().register(new TestCommand());
}
}
#Example event handler usage:
skype.getEventBus().register(UserJoinEvent.class, event ->
{
System.out.println(event.getUser().getDisplayName() + " has joined " + event.getGroup().getChatId());
});
#TODO
- Handle calls (Windows only + semi compatible with wine)
#Dependencies
- commons-lang 3
- org.json (repo contains fork)
- jsoup
- lombok
#LICENSE See LICENSE file