71 lines
1.5 KiB
Java
71 lines
1.5 KiB
Java
package objects;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
public class JSONBased {
|
|
|
|
private JSONObject base_json = null;
|
|
|
|
public JSONBased(JSONObject o) {
|
|
base_json = o;
|
|
}
|
|
|
|
public boolean has(Member mem) {
|
|
if(base_json == null)
|
|
return false;
|
|
return base_json.has(mem.name());
|
|
}
|
|
|
|
public Object get(Member mem) {
|
|
if(base_json == null)
|
|
return null;
|
|
return base_json.get(mem.name());
|
|
}
|
|
|
|
public enum Member {
|
|
|
|
// ===== MESSAGE ====
|
|
forward_from_message_id,//int
|
|
forward_signature,//String
|
|
forward_date,//long
|
|
reply_to_message,//Message
|
|
edit_date,//long
|
|
media_group_id,//String
|
|
author_signature, //String
|
|
audio, //Audio
|
|
document, //Document
|
|
game, //Game
|
|
photo, //Array of PhotoSize
|
|
sticker, //Sticker
|
|
video, //Video
|
|
voice, //voice
|
|
video_note, //videoNote
|
|
caption, // String
|
|
contact, //Contact
|
|
location, //Location
|
|
venue, //Venue
|
|
new_chat_members, // Array of TUser
|
|
left_chat_members, // Array of TUser
|
|
new_chat_title, //String
|
|
new_chat_photo, //Array of Photosize
|
|
delete_chat_photo, // true
|
|
group_chat_created, // true
|
|
supergroup_chat_created, // true
|
|
channel_chat_created, //true
|
|
migrate_to_chat_id, // int
|
|
migrate_from_chat_id, // int
|
|
pinned_message, //TMessage
|
|
invoice, //Invoice
|
|
successful_payment, //SuccessfulPayment
|
|
connected_website, // String
|
|
//==== END MESSAGE ====
|
|
|
|
//==== AUDIO ======
|
|
performer, //String
|
|
title,//String
|
|
mime_type, // String
|
|
file_size; // int
|
|
//===== END AUDIO ====
|
|
}
|
|
}
|