All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pro.zackpollard.telegrambot.api.internal.updates.UpdateImpl Maven / Gradle / Ivy

There is a newer version: 1.6.5
Show newest version
package pro.zackpollard.telegrambot.api.internal.updates;

import org.json.JSONObject;
import pro.zackpollard.telegrambot.api.chat.message.Message;
import pro.zackpollard.telegrambot.api.internal.chat.message.MessageImpl;
import pro.zackpollard.telegrambot.api.updates.Update;

/**
 * @author Zack Pollard
 */
public class UpdateImpl implements Update {

	private final int update_id;
	private final Message message;

	private UpdateImpl(JSONObject jsonObject) {

		this.update_id = jsonObject.getInt("update_id");
		this.message = MessageImpl.createMessage(jsonObject.getJSONObject("message"));
	}

	public static Update createUpdate(JSONObject jsonObject) {

		return new UpdateImpl(jsonObject);
	}

	@Override
	public int getId() {

		return update_id;
	}

	@Override
	public Message getMessage() {

		return message;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy