Skip to content

Commit

Permalink
remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasholderness committed Jul 10, 2018
1 parent 6253920 commit 3800809
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/functions/receive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ export default async (event, context, callback) => {
const payload = await Joi.validate(event.body, _bodySchema);
// Reply to Telegram directly to stop duplicate messages
handleResponse(callback, 200, {});
console.log('response sent');
// Class
const telegram = new Telegram(config);
console.log('class made');
// Send reply message
await telegram.sendReply(payload.message);
console.log('Message sent');
} catch (err) {
if (err.isJoi) {
// tell Telegram to ingore errors, but stop process
Expand Down
9 changes: 2 additions & 7 deletions src/lib/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ export default class Telegram {
* @return {String} - URI for request
**/
_prepareLinkResponse(userId, message) {
const response = this.config.TELEGRAM_ENDPOINT +
return (this.config.TELEGRAM_ENDPOINT +
this.config.BOT_TOKEN +
'/sendmessage?text=' +
message.text +
message.link +
'&chat_id=' +
userId;
console.log(response);
return (response);
userId);
}

/**
Expand Down Expand Up @@ -84,7 +82,6 @@ export default class Telegram {
* @return {Promise} - Result of request
**/
_sendMessage(requestString) {
console.log(requestString);
return new Promise((resolve, reject) => {
console.log('Sending request to telegram: ' + requestString);
this.axios.post(requestString, {})
Expand Down Expand Up @@ -129,11 +126,9 @@ export default class Telegram {
network: 'telegram',
};
if (this._classify(telegramMessage.text) === 'flood') {
console.log('this is a flood message');
this.bot.card(properties)
.then((msg) => {
const response = this._prepareLinkResponse(properties.userId, msg);
console.log('response', response);
resolve(this._sendMessage(response));
}).catch((err) => reject(err));
} else {
Expand Down

0 comments on commit 3800809

Please sign in to comment.