pro.zackpollard.telegrambot.api.internal.chat.ChatMemberImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtelegram-botapi Show documentation
Show all versions of jtelegram-botapi Show documentation
The Java Telegram Bot API is a wrapper for the Telegram HTTP Bot API
package pro.zackpollard.telegrambot.api.internal.chat;
import org.json.JSONObject;
import pro.zackpollard.telegrambot.api.chat.ChatMember;
import pro.zackpollard.telegrambot.api.chat.ChatMemberStatus;
import pro.zackpollard.telegrambot.api.internal.user.UserImpl;
import pro.zackpollard.telegrambot.api.user.User;
/**
* @author Zack Pollard
*/
public class ChatMemberImpl implements ChatMember {
private final User user;
private final ChatMemberStatus status;
private ChatMemberImpl(JSONObject jsonObject) {
this.user = UserImpl.createUser(jsonObject.getJSONObject("user"));
this.status = ChatMemberStatus.getType(jsonObject.getString("status"));
}
public static ChatMember createChatMember(JSONObject jsonObject) {
return new ChatMemberImpl(jsonObject);
}
@Override
public User getUser() {
return user;
}
@Override
public ChatMemberStatus getStatus() {
return status;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy