Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #39 from RedRoundRobin/develop
Browse files Browse the repository at this point in the history
Baseline 0.18
  • Loading branch information
Maxelweb committed May 13, 2020
2 parents 37f57bf + e31dc3f commit ca355df
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BOT_TOKEN=1120382460:AAGy8CdhjdMxaS99K3za1Jxoqp-ayPuVC1w
BOT_TOKEN=1082631669:AAGKRWKQ6zIrmJYwVfoH9BrErtJW_3XWvTc
URL_API=http://core.host.redroundrobin.site:9999
SERVER_PORT=3000
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Telegram Bot - ThiReMa

:fire: Versione componente: `v0.2.0-rc`
:fire: Versione componente: `v1.0.0-rc`

:pushpin: Main repo: [swe-thirema](https://github.com/Maxelweb/swe-thirema)

Expand All @@ -14,19 +14,19 @@

![Repository Checker](https://github.com/RedRoundRobin/swe-telegram/workflows/Repository%20Checker/badge.svg)

[![Coverage Status](https://coveralls.io/repos/github/RedRoundRobin/swe-telegram/badge.svg?branch=develop)](https://coveralls.io/github/RedRoundRobin/swe-telegram?branch=develop)
[Coverage Status](https://coveralls.io/github/RedRoundRobin/swe-telegram?branch=develop)


### Telegram link

- Link: [t.me/ThiReMaBot](t.me/ThiReMaBot)
- Link: [t.me/RIoT_RRR_Bot](t.me/RIoT_RRR_Bot)

### Comandi Bot

- info - Comandi supportati
- login - Autenticazione al sistema ThiReMa
- status - Controllo dello status dell'utente

- help - informazioni di supporto
- login - primo avvio e registrazione account
- info - informazioni utente corrente
- devices - dispositivi a cui e possibile inviare input

#### Istruzioni di avvio

Expand Down
2 changes: 1 addition & 1 deletion commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const botHelp = (bot) => {
replyWithMarkdown(`
*RIoT - Telegram Bot*
Ecco la lista dei comandi disponibili:
\u{2753} Ecco la lista dei comandi disponibili:
- /help - informazioni di supporto (corrente)
- /login - primo avvio e registrazione account
Expand Down
2 changes: 1 addition & 1 deletion commands/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const botInfo = (bot, auth) => {
}
return message.replyWithMarkdown(
`
Ecco i tuoi dati *${message.from.username}*
Ecco i tuoi dati *${message.from.username}* \u{1F4DD}
- *Nome:* ${name}
- *Cognome:* ${surname}
- *Email:* ${email}
Expand Down
2 changes: 1 addition & 1 deletion commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const botStart = (bot) => {
console.log("started:", message.from.id);
const username = message.from.username;
return message.replyWithMarkdown(`
Ciao *${username}*, benvenuto nel RIoT bot!
Ciao *${username}*, benvenuto nel RIoT bot! \u{1F47E}
Usa il comando /login per effettuare l'autenticazione.
Se hai bisogno di aiuto digita il comando /help`);
});
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions utils/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ const jwtAuth = (axiosInstance, message, displayReply = false) => {
}
if (displayReply) {
switch (code) {
case 0:
return message.reply(
"Username non trovato, registra il tuo username Telegram dalle impostazioni della web-app."
);
case 1:
return message.reply("Username trovato, registrazione riuscita!");
case 2:
return message.reply(
"Account già registrato, nessuna modifica apportata."
);
case 3:
return message.reply(
"Username non trovato, registra il tuo username Telegram dalle impostazioni della web-app."
);
default:
break;
}
Expand Down
7 changes: 3 additions & 4 deletions utils/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ const sendMessage = (message, chatId) => {
res.json("OK");
})
.catch((err) => {
console.log(
"Errore " + err.response.status + " nell'invio del messaggio"
);
console.log(err);
console.log("Errore " + err.response + " nell'invio del messaggio");
});
};

Expand Down Expand Up @@ -60,7 +59,7 @@ const botServer = http.createServer((req, res) => {
case 2:
valueType = "uguale";
}
const messagePart1 = `Attenzione: il sensore ${sensorId} del dispositivo ${deviceId} ha registrato un valore di `;
const messagePart1 = `Alert: il sensore S#${sensorId} del dispositivo D#${deviceId} ha registrato un valore di `;
const messagePart2 = `${sensorValue} ${valueType} alla soglia (${threshold})`;
const alertMessage = messagePart1 + messagePart2;
// eslint-disable-next-line guard-for-in
Expand Down

0 comments on commit ca355df

Please sign in to comment.