Skip to content

Commit

Permalink
logging without mention
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Apr 1, 2018
1 parent 95f3225 commit 3b2b81c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const pathToDb = path.join(__dirname, 'vbb-telegram.ldb')
const bot = new Bot(TOKEN)

bot.use(inGroupsOnlyMentions)
bot.use(logging)
bot.use(textWithoutMention)
bot.use(logging)
bot.use(session(pathToDb))
bot.use(command)
bot.use(storage)
Expand Down Expand Up @@ -80,3 +80,5 @@ if (process.env.NODE_ENV === 'dev') {
}))
bot.startWebhook(WEB_HOOK_PATH, null, WEB_HOOK_PORT)
}

bot.catch(console.error)
6 changes: 5 additions & 1 deletion lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const logging = async (ctx, next) => {
d + 'ms',
msg && msg.date || '[unknown date]',
msg && msg.chat && msg.chat.id || '[unknown chat]',
msg && msg.text && escape(msg.text.slice(0, 30)) || '[no message]',
(
msg && msg.textWithoutMention &&
escape(msg.textWithoutMention.slice(0, 30)) ||
'[no message]'
)
].join(' '))
}

Expand Down

0 comments on commit 3b2b81c

Please sign in to comment.