This repository has been archived on 2022-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
geiserpbot/src/elements/messages/PrivateMessage.java
vylion 9d2baf8531 Separated all Message types in classes.
Removed Pokemon Go server status json reading, because the web that provided it has gone down.
2016-10-09 02:15:56 +02:00

62 lines
1.2 KiB
Java

package elements.messages;
import elements.exceptions.NoChatNameMessageException;
import elements.exceptions.NoUsernameMessageException;
import org.json.JSONObject;
/**
* Created by Guillermo Serrahima on 10/9/16.
*/
public class PrivateMessage extends Message {
public PrivateMessage(JSONObject message) {
super(message);
}
@Override
public boolean hasAuthor() {
return true;
}
@Override
public int getUid() {
return uid;
}
@Override
public String getAuthor() {
return fullName;
}
@Override
public String getUsername() throws NoUsernameMessageException {
if(!hasUsername()) throw new NoUsernameMessageException();
return userName;
}
@Override
public boolean isBasicGroup() {
return false;
}
@Override
public boolean isSupergroup() {
return false;
}
@Override
public boolean isChannel() {
return false;
}
@Override
public boolean isPrivate() {
return true;
}
@Override
public String getChatName() throws NoChatNameMessageException {
if(!hasChatName()) throw new NoChatNameMessageException();
return chatName;
}
}