Weather bot on Wire.com web-app
- Open Bot on heroku
- Add bot account
malos
to your wire - Start chatting
/weather [city]
the following code for an "echo bot" is provided:
Package Installation
npm i --save @wireapp/core@0.0.30
Demo Code (echo-bot.js)
const {Account} = require('@wireapp/core');
const account = new Account();
account.on(Account.INCOMING.TEXT_MESSAGE, ({conversation, content}) => {
account.service.conversation.sendTextMessage(conversation, `Echo: ${content}`);
});
account.listen({
email: 'yourbot@email.com',
password: 'top-secret',
persist: false,
});
To retrieve the weather data, you can use any external weather service you like, such as openweathermap.org and others.
Incorrect input
- Given Input:
/weather
- Expected Output: nothing
Correct input
- Given Input:
/weather [city]
- Expected Output:
The temperature in Berlin is [degrees]°C.