Is there a way to retrieve the chat id from a CallbackQuery object?
In my case, I have made a InlineKeyboardButton and set a callbackQueryData.
I'm able to retrieve this callback query but without chance to retrieve the chat id. I know the answerInlineQuery method but I dont need in my case. I need only a way to retrieve the chat id.
CallbackQuery class provide the getChatInstance() method but return always null.
Anyone can help me?
Thank you
SOLUTION FOUND
CallbackQuery callbackQuery;
Long chatId = callbackQuery.getMessage().getChatId();
Related
I am currently taking a course in app development and I am trying to use Facebooks API for GET requests on certain events. My goal is the get a JSON file containing all comments made on a certain event.
However some events return only a an "id" key with an id number such as this:
{
"id": "116445769058883"
}
That happends with this event:
https://www.facebook.com/events/116445769058883/
However other events such as (https://www.facebook.com/events/1964003870536124/) : returns only the latest comment for some reason.
I am experementing with facebook explore API:
https://developers.facebook.com/tools/explorer/
This is the following GET requests that I have been using in the explorer:
GET -> /v.10/facebook-id/?fields=comments
Any ideas? It's really tricky to understand the response since both events have the privacy set to OPEN.
Starting from v2.4 of the API, the API is now declarative which means you'll need to specify what fields you want the API to return.
For example, if you want first name and second name of the user, then you make a GET request to /me?fields=first_name,last_name else you will only get back the default fields which are id and name.
If you want to see what fields are available for a given endpoint, use metadata field. e.g. GET /me?metadata=true
I am currently using the java-version of the Riot api, made by rithms,
(https://github.com/rithms/riot-api-java)
and I am trying to receive the name of a champion, as I am currently "just" able to get the id.
RankedStats rankedStats = api.getRankedStats(api.getSummonerByName("AscendedKitten").getId());
Now, when printing out the results of
rankedStats.getChampions();
it will (of course) return the Ids.
I noticed that
net.rithms.riot.dto.Champion.Champion
has a methode returning the name, but (because I am failing at reading the Documentation) I haven't found out how to cast / get an instance of the object yet.
I am sorry for the basic-question, and I hope you don't have too much trouble trying to help me :3
Thanks in advance!
Use the RiotApi class' getDataChampion(Region region, int id) method, then use the getName() method on the champion it returns.
I know i can use this method: GetActiveNotifications() to get the active notifications in my notifications bar but i don't know why.. What i want exactly is check if a package name is present or not so then i can make a condition to read the notifications of specify app. I can get the package name in this way:
Log.i(TAG,"Package Name" + sbn.getPackageName());
but the problem is create the right method with all informations. Can anyone help me? Thanks
I am a beginner in web programming and I need to create function to change password like in social network. I'm doing it first time and don't know how to do it. I don't know how to create architecture. I'm using backbone.js in user side, I will create userModel (this is backbone model). In server side I'm using Java. I have one idea that: add to UserClass (this is java class) new fields which named
#JsonIgnore
String oldPassword;
#JsonIgnore
String newPassword;
JsonIgnore make field invisible on user side. I will send the fields with userModel from user side,so I check in server side. I think, the idea is not good.
If You know any ways, please, tell me about it !
EDIT
I know how to make html-form. I don't know how to send the filds to server. If I do that:
var val1 // old_pass
var val2 // new_pass
this.model.save({password: val1,new_password: val2});
then model password change to val1, it is not correct, password do not set in user side, because user side haven't model password
I don't know how your server authentication process work but maybe you can try something like this. Create a new View with a user model inside to edit the user attributes. Inside that view render a form that displays the user attributes including the passwords. On the form the user will be able to change his information. Have a button called "Save" or something like that to store the changes. When the button is clicked create a function that grabs the values from the form and using the model save method. This method makes Backbone run a PUT command back to the server. On the server you should be able to handle this request and change the password. A very simple function you can write to save the changes in the view could be something like this:
changePassword = function() {
var attributes;
attributes = {
password: $('#password').val(),
confirm_password: $('#confirm_password').val()
};
this.model.save(attributes);
};
This functions will create an attributes object filled with the password fields and then it sends it back to the server. If you want to understand a little bit more about how the save method work you should check the Backbone documentation. Hope this helps!
I ran into an interesting case where it seems to indicate that the documentation for Google Contacts API is incorrect.
What I'm trying to do is getting the contact information of authenticated user who has already given permission to the app using this URL:
https://www.google.com/m8/feeds/contacts/default/full/contactId
The result of the call is always status 404. However, when I'm trying to get full address book, it seems to be working fine.
https://www.google.com/m8/feeds/contacts/default/full
Is it documented incorrect or I'm doing something wrong? It makes no sense that I can get the whole address book without being able to get contact information of the authenticated user.
The scope I'm using is:
https://www.google.com/m8/feeds
Thanks,
Jack
Additional information. The API documentation shows the following:
public static ContactEntry retrieveContact(ContactsService myService) {
ContactEntry contact =
myService.getEntry(new URL("https://www.google.com/m8/feeds/contacts/default/full/contactId"),
ContactEntry.class);
// Do something with the contact.
return contact;
}
This seems to mean that "contactId" keyword should used as part of URL. It just doesn't work for me.
To clarify this question. The goal is to get information on current authenticated user without having to go through workaround of fetching data multiple times. Even with the workaround of fetching all contact first, I didn't see any contactId of authenticated user coming back with it.
It depends on what you are trying to get. If you call https://www.google.com/m8/feeds/contacts/default/full, then you are looking for all the contacts. Now, when you get back the contacts, you can request the data for a single contact by using https://www.google.com/m8/feeds/contacts/default/full/{contactID} where {contactID} is the last part of the field from the full contact list. It will look like http://www.google.com/m8/feeds/contacts/{user email}/base/{contact id}.
So, if you get back the full contact list, a single contact will have an ID field that looks like: http://www.google.com/m8/feeds/contacts/{user email}/base/{contact id}. If you take that last {contact ID} and append it to the end of the call (https://www.google.com/m8/feeds/contacts/default/full/{contactID} ), you will get back the contact information for just that contact.