P
P
Pigeon12352019-07-25 21:35:43
API
Pigeon1235, 2019-07-25 21:35:43

How to make the bot send a specific emoji?

How to make the bot with the Online command send in response not only the names of the participants, but also the emoji corresponding to the platform with which the participant is currently online?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-07-25
@Pigeon1235

when getting the participants of the conversation using the messages.getConversationMembers method , pass the fields=last_seen parameter,
create an object in which the platform identifiers will be the keys (the full list can be found here , the last_seen field), and the desired emoticons will be the values

const smiles = {
  1: 'smile for mobile version', 
  2: 'smile for iPhone', 
  // ...
};

now you can get the desired emoji by simply accessing the object through the platform identifier
function getSmile(user) {
  return smiles[user.last_seen.platform];
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question