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

Commit

Permalink
Merge 3b79737 into d86afac
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzodeinegri committed Mar 21, 2020
2 parents d86afac + 3b79737 commit 56e05a6
Show file tree
Hide file tree
Showing 5 changed files with 1,127 additions and 8 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"node": true,
"es6": true
},
"extends": [
"google",
"prettier",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error"
}
}
10 changes: 5 additions & 5 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const tokenBot = "1120382460:AAG2TTBT-GqHcIfGzH_TYOvCZFI0pMEu88c";
const bot = new Telegraf(tokenBot);
// Richiesta per creazione server
const http = require("http");
const { parse } = require("querystring");
// const { parse } = require("querystring");

const server = http.createServer((req, res) => {
// Request and response object
Expand All @@ -16,9 +16,9 @@ const server = http.createServer((req, res) => {
req.on("data", (data) => {
jsonRes += data.toString();
console.log(JSON.parse(jsonRes));
let response = JSON.parse(jsonRes);
let chatId = response.chat_id;
let authCode = response.auth_code;
const response = JSON.parse(jsonRes);
const chatId = response.chat_id;
const authCode = response.auth_code;
axios
.post(
`https://api.telegram.org/bot${tokenBot}/sendMessage?chat_id=${chatId}&text=Ecco il tuo codice di autenticazione: ${authCode}`
Expand Down Expand Up @@ -83,7 +83,7 @@ bot.command("login", (message) => {
})
.catch((err) => {
console.log(err);
//console.log(err.status);
// console.log(err.status);
if (err.response.status === 403) {
return message.reply(
"Rieffettua l'autenticazione usando il comando /login"
Expand Down
4 changes: 2 additions & 2 deletions bot.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// NON RIMUOVERE LA RIGA REGUENTE //
const jsonTest = require("./bot");
require("./bot");

test("Extracts value from JSON formatted string", () => {
let num = 4;
const num = 4;
expect(num).toBe(4);
});
Loading

0 comments on commit 56e05a6

Please sign in to comment.