fix: sending locations (#2339)
* added function to to modify module functions * fix for locations to be sent * changes for class Location - description property was splited into name and address - added url property - added ability to pass name, address and url as options while creating an instance * docs updated * usage example updated * added url checking * fixed url * updated location property in Message class * fixed url when http prefix is provided * injectToFunction updated to be more flexible * docs clarification * ESLint fix * fix: injectToFunction fixed to work properly * minor fix in injectToFunction * refactor: added usage of url validator * small change to improve performance for findImpl fix * window.compareWwebVersions fixed
This commit is contained in:
parent
1c059d3b3d
commit
ecf19eb9a5
6 changed files with 117 additions and 20 deletions
|
|
@ -151,7 +151,14 @@ client.on('message', async msg => {
|
|||
await client.sendMessage(msg.from, media, { isViewOnce: true });
|
||||
}
|
||||
} else if (msg.body === '!location') {
|
||||
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
|
||||
// only latitude and longitude
|
||||
await msg.reply(new Location(37.422, -122.084));
|
||||
// location with name only
|
||||
await msg.reply(new Location(37.422, -122.084, { name: 'Googleplex' }));
|
||||
// location with address only
|
||||
await msg.reply(new Location(37.422, -122.084, { address: '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA' }));
|
||||
// location with name, address and url
|
||||
await msg.reply(new Location(37.422, -122.084, { name: 'Googleplex', address: '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA', url: 'https://google.com' }));
|
||||
} else if (msg.location) {
|
||||
msg.reply(msg.location);
|
||||
} else if (msg.body.startsWith('!status ')) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue