diff --git a/actions/ban.js b/actions/ban.js index ba4b9a1..3835537 100644 --- a/actions/ban.js +++ b/actions/ban.js @@ -1,5 +1,3 @@ -'use strict'; - const dedent = require('dedent-js'); const { telegram } = require('../bot'); diff --git a/actions/warn.js b/actions/warn.js index 4fcf37c..717ca6d 100644 --- a/actions/warn.js +++ b/actions/warn.js @@ -1,5 +1,3 @@ -'use strict'; - const dedent = require('dedent-js'); const { context } = require('../bot'); @@ -26,10 +24,10 @@ module.exports = async ({ admin, userToWarn, reason }) => { reason: 'Reached max number of warnings', userToBan: userToWarn, }); - return warnMessage + - '\n\n' + - '🚫 The user was banned ' + - `for receiving ${numberOfWarnsToBan} warnings!`; + return warnMessage + + '\n\n' + + '🚫 The user was banned ' + + `for receiving ${numberOfWarnsToBan} warnings!`; } return warnMessage; diff --git a/bot/index.js b/bot/index.js index 2208825..5d17e04 100644 --- a/bot/index.js +++ b/bot/index.js @@ -1,5 +1,3 @@ -'use strict'; - const Telegraf = require('telegraf'); const config = require('../config'); diff --git a/bot/options.js b/bot/options.js index 2807efb..423e372 100644 --- a/bot/options.js +++ b/bot/options.js @@ -1,5 +1,3 @@ -'use strict'; - const replyOptions = { disable_web_page_preview: true, parse_mode: 'HTML', diff --git a/example.config.js b/example.config.js index 645f525..2ba500b 100644 --- a/example.config.js +++ b/example.config.js @@ -1,4 +1,4 @@ -'use strict'; + /* * Create `config.js` by running `cp example.config.js config.js` diff --git a/handlers/commands/addCommand.js b/handlers/commands/addCommand.js index a9a7951..bede5d5 100644 --- a/handlers/commands/addCommand.js +++ b/handlers/commands/addCommand.js @@ -1,5 +1,3 @@ -'use strict'; - // DB const { addCommand, getCommand } = require('../../stores/command'); @@ -27,15 +25,15 @@ const addCommandHandler = async (ctx, next) => { const isValidName = commandName && commandName.match(/^(?:[!])?(\w+)$/); if (!isValidName) { return reply( - 'Send a valid command.\n\nExample:\n' + - '/addcommand rules', + 'Send a valid command.\n\nExample:\n' + + '/addcommand rules', replyOptions ); } const newCommand = isValidName[1].toLowerCase(); if (preserved.includes(newCommand)) { - reply('❗️ Sorry you can\'t use this name, it\'s preserved.\n\n' + - 'Try another one.'); + reply('❗️ Sorry you can\'t use this name, it\'s preserved.\n\n' + + 'Try another one.'); return next(); } @@ -45,11 +43,11 @@ const addCommandHandler = async (ctx, next) => { if (!replaceCmd && cmdExists) { return ctx.replyWithHTML( - 'ℹ️ This command already exists.\n\n' + - '/commands - to see the list of commands.\n' + - '/addcommand <name> - to add a command.\n' + - '/removecommand <name>' + - ' - to remove a command.', + 'ℹ️ This command already exists.\n\n' + + '/commands - to see the list of commands.\n' + + '/addcommand <name> - to add a command.\n' + + '/removecommand <name>' + + ' - to remove a command.', Markup.keyboard([ [ `/replaceCommand ${newCommand}` ] ]) .oneTime() .resize() diff --git a/handlers/commands/admin.js b/handlers/commands/admin.js index 29cb95e..ed69dd4 100644 --- a/handlers/commands/admin.js +++ b/handlers/commands/admin.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link } = require('../../utils/tg'); const { logError } = require('../../utils/log'); @@ -40,14 +38,16 @@ const adminHandler = async ({ message, reply, state }) => { if (await getWarns(userToAdmin)) { try { await nowarns(userToAdmin); - } catch (err) { + } + catch (err) { logError(err); } } try { await admin(userToAdmin); - } catch (err) { + } + catch (err) { logError(err); } diff --git a/handlers/commands/ban.js b/handlers/commands/ban.js index 20a7c30..c5b4c2d 100644 --- a/handlers/commands/ban.js +++ b/handlers/commands/ban.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link, scheduleDeletion } = require('../../utils/tg'); diff --git a/handlers/commands/commands.js b/handlers/commands/commands.js index 1f11882..e8a7f66 100644 --- a/handlers/commands/commands.js +++ b/handlers/commands/commands.js @@ -1,5 +1,3 @@ -'use strict'; - // DB const { listCommands } = require('../../stores/command'); @@ -33,13 +31,13 @@ const commandReferenceHandler = async ({ chat, replyWithHTML }) => { const customCommands = await listCommands(); const customCommandsText = customCommands.length - ? '\nCustom commands:\n' + - customCommands + ? '\nCustom commands:\n' + + customCommands .filter(command => command.isActive) .sort((a, b) => a.role.toLowerCase() < b.role.toLowerCase()) .map(command => - `[${command.role.toLowerCase()}] ` + - `!${command.name}`) + `[${command.role.toLowerCase()}] ` + + `!${command.name}`) .join('\n') : ''; return replyWithHTML(commandReference + customCommandsText); diff --git a/handlers/commands/groups.js b/handlers/commands/groups.js index 695700c..ab20291 100644 --- a/handlers/commands/groups.js +++ b/handlers/commands/groups.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { escapeHtml, scheduleDeletion } = require('../../utils/tg'); diff --git a/handlers/commands/help.js b/handlers/commands/help.js index 501894d..8986d25 100644 --- a/handlers/commands/help.js +++ b/handlers/commands/help.js @@ -1,4 +1,3 @@ -'use strict'; const { Markup } = require('telegraf'); const { homepage } = require('../../package.json'); diff --git a/handlers/commands/hideGroup.js b/handlers/commands/hideGroup.js index f00271d..354958d 100644 --- a/handlers/commands/hideGroup.js +++ b/handlers/commands/hideGroup.js @@ -1,5 +1,3 @@ -'use strict'; - const { hideGroup } = require('../../stores/group'); const noop = Function.prototype; diff --git a/handlers/commands/index.js b/handlers/commands/index.js index ab515a4..3cb6759 100644 --- a/handlers/commands/index.js +++ b/handlers/commands/index.js @@ -1,5 +1,3 @@ -'use strict'; - const { Composer } = require('telegraf'); const composer = new Composer(); @@ -27,8 +25,8 @@ const helpHandler = require('./help'); const { deleteCommands = 'own' } = require('../../config'); if (![ 'all', 'own', 'none' ].includes(deleteCommands)) { - throw new Error('Invalid value for `deleteCommands` in `config.json`: ' + - deleteCommands); + throw new Error('Invalid value for `deleteCommands` in `config.json`: ' + + deleteCommands); } const deleteMessage = ({ chat, message, telegram }, next) => { diff --git a/handlers/commands/leave.js b/handlers/commands/leave.js index b4f1597..4d95785 100644 --- a/handlers/commands/leave.js +++ b/handlers/commands/leave.js @@ -1,5 +1,3 @@ -'use strict'; - const { managesGroup, removeGroup } = require('../../stores/group'); const leaveCommandHandler = async ctx => { diff --git a/handlers/commands/link.js b/handlers/commands/link.js index a92f74d..0b8367e 100644 --- a/handlers/commands/link.js +++ b/handlers/commands/link.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { scheduleDeletion } = require('../../utils/tg'); @@ -13,8 +11,8 @@ const linkHandler = async ({ chat, replyWithHTML }, next) => { const group = await managesGroup({ id: chat.id }); - return replyWithHTML('ℹ️ Group\'s link:\n\n' + - `${group.title}`).then(scheduleDeletion); + return replyWithHTML('ℹ️ Group\'s link:\n\n' + + `${group.title}`).then(scheduleDeletion); }; module.exports = linkHandler; diff --git a/handlers/commands/nowarns.js b/handlers/commands/nowarns.js index da55cdb..d6c9203 100644 --- a/handlers/commands/nowarns.js +++ b/handlers/commands/nowarns.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link, scheduleDeletion } = require('../../utils/tg'); const { logError } = require('../../utils/log'); @@ -53,7 +51,8 @@ const nowarnsHandler = async ({ message, reply, state, telegram }) => { try { await nowarns(userToUnwarn); - } catch (err) { + } + catch (err) { logError(err); } @@ -69,8 +68,8 @@ const nowarnsHandler = async ({ message, reply, state, telegram }) => { } return reply( - `♻️ ${link(user)} pardoned ${link(userToUnwarn)} ` + - 'for all of their warnings.', + `♻️ ${link(user)} pardoned ${link(userToUnwarn)} ` + + 'for all of their warnings.', replyOptions ); }; diff --git a/handlers/commands/removeCommand.js b/handlers/commands/removeCommand.js index 54adaf6..ec590ba 100644 --- a/handlers/commands/removeCommand.js +++ b/handlers/commands/removeCommand.js @@ -1,5 +1,3 @@ -'use strict'; - // DB const { getCommand, removeCommand } = require('../../stores/command'); @@ -20,8 +18,8 @@ const removeCommandHandler = async ({ chat, message, reply, state }) => { const [ , commandName ] = text.split(' '); if (!commandName) { return reply( - 'Send a valid command.\n\nExample:\n' + - '/removecommand rules', + 'Send a valid command.\n\nExample:\n' + + '/removecommand rules', replyOptions ); } @@ -44,8 +42,8 @@ const removeCommandHandler = async ({ chat, message, reply, state }) => { await removeCommand({ name: commandName.toLowerCase() }); return reply( - `✅ !${commandName} ` + - 'has been removed successfully.', + `✅ !${commandName} ` + + 'has been removed successfully.', replyOptions ); }; diff --git a/handlers/commands/report.js b/handlers/commands/report.js index e17c188..e8d051c 100644 --- a/handlers/commands/report.js +++ b/handlers/commands/report.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link, scheduleDeletion } = require('../../utils/tg'); @@ -16,9 +14,9 @@ const reportHandler = async ctx => { } const admins = (await ctx.getChatAdministrators()) .filter(member => - member.status === 'creator' || - member.can_delete_messages && - member.can_restrict_members + member.status === 'creator' + || member.can_delete_messages + && member.can_restrict_members // eslint-disable-next-line function-paren-newline ).map(member => member.user); const adminObjects = admins.map(user => ({ @@ -26,8 +24,8 @@ const reportHandler = async ctx => { id: user.id, })); const adminsMention = adminObjects.map(link).join(''); - const s = `❗️${link(ctx.from)} reported the message to the admins.` + - `${adminsMention}`; + const s = `❗️${link(ctx.from)} reported the message to the admins.` + + `${adminsMention}`; return ctx.replyWithHTML(s, { reply_to_message_id: msg.reply_to_message.message_id }); diff --git a/handlers/commands/showGroup.js b/handlers/commands/showGroup.js index 2e3a906..d6fffc2 100644 --- a/handlers/commands/showGroup.js +++ b/handlers/commands/showGroup.js @@ -1,5 +1,3 @@ -'use strict'; - const { updateGroup } = require('../../stores/group'); module.exports = async (ctx, next) => { @@ -13,7 +11,8 @@ module.exports = async (ctx, next) => { : await ctx.exportChatInviteLink(); return updateGroup({ id, link, title }); - } catch (err) { + } + catch (err) { return ctx.reply(String(err)); } }; diff --git a/handlers/commands/staff.js b/handlers/commands/staff.js index 1f5d96e..e842703 100644 --- a/handlers/commands/staff.js +++ b/handlers/commands/staff.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { quietLink, scheduleDeletion } = require('../../utils/tg'); diff --git a/handlers/commands/unadmin.js b/handlers/commands/unadmin.js index 397d657..e097aa4 100644 --- a/handlers/commands/unadmin.js +++ b/handlers/commands/unadmin.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link, scheduleDeletion } = require('../../utils/tg'); const { logError } = require('../../utils/log'); @@ -55,7 +53,8 @@ const unAdminHandler = async ({ message, reply, state }) => { try { await unadmin(userToUnadmin); - } catch (err) { + } + catch (err) { logError(err); } diff --git a/handlers/commands/unban.js b/handlers/commands/unban.js index ffbc265..328f6f5 100644 --- a/handlers/commands/unban.js +++ b/handlers/commands/unban.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link, scheduleDeletion } = require('../../utils/tg'); const { logError } = require('../../utils/log'); @@ -42,13 +40,15 @@ const unbanHandler = async ({ message, reply, telegram, state }) => { try { await Promise.all(unbans); - } catch (err) { + } + catch (err) { logError(err); } try { await unban(userToUnban); - } catch (err) { + } + catch (err) { logError(err); } @@ -62,13 +62,13 @@ const unbanHandler = async ({ message, reply, telegram, state }) => { // (it's an expected, non-critical failure) if (userToUnban.first_name === '') { - return reply(`♻️ ${link(user)} unbanned an user ` + - `with id ${userToUnban.id}.`, replyOptions); + return reply(`♻️ ${link(user)} unbanned an user ` + + `with id ${userToUnban.id}.`, replyOptions); } - return reply(`♻️ ${link(user)} unbanned ` + - `${link(userToUnban)}.`, replyOptions); + return reply(`♻️ ${link(user)} unbanned ` + + `${link(userToUnban)}.`, replyOptions); }; module.exports = unbanHandler; diff --git a/handlers/commands/unwarn.js b/handlers/commands/unwarn.js index ae9ff92..3de68bf 100644 --- a/handlers/commands/unwarn.js +++ b/handlers/commands/unwarn.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { link, scheduleDeletion } = require('../../utils/tg'); @@ -64,9 +62,9 @@ const unwarnHandler = async ({ message, reply, state, telegram }) => { } return reply( - `❎ ${link(user)} pardoned ${link(userToUnwarn)} ` + - `for:\n\n${allWarns[allWarns.length - 1]}` + - ` (${allWarns.length - 1}/${numberOfWarnsToBan})`, + `❎ ${link(user)} pardoned ${link(userToUnwarn)} ` + + `for:\n\n${allWarns[allWarns.length - 1]}` + + ` (${allWarns.length - 1}/${numberOfWarnsToBan})`, replyOptions ); }; diff --git a/handlers/commands/user.js b/handlers/commands/user.js index 5f14d67..067f2c2 100644 --- a/handlers/commands/user.js +++ b/handlers/commands/user.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { scheduleDeletion } = require('../../utils/tg'); @@ -39,12 +37,12 @@ const getWarnsHandler = async ({ message, reply, state }) => { : ''; return reply( - userName + - userStatus + - userId + - userUsername + - userWarns + - banReason, + userName + + userStatus + + userId + + userUsername + + userWarns + + banReason, replyOptions ).then(scheduleDeletion); }; diff --git a/handlers/commands/warn.js b/handlers/commands/warn.js index c4c7d8c..cd00e9d 100644 --- a/handlers/commands/warn.js +++ b/handlers/commands/warn.js @@ -1,8 +1,5 @@ -'use strict'; - // Utils -const { link, scheduleDeletion } = require('../../utils/tg'); -const { logError } = require('../../utils/log'); +const { scheduleDeletion } = require('../../utils/tg'); // Config const { diff --git a/handlers/messages/addCustomCmd.js b/handlers/messages/addCustomCmd.js index bcdd207..8752f18 100644 --- a/handlers/messages/addCustomCmd.js +++ b/handlers/messages/addCustomCmd.js @@ -1,5 +1,3 @@ -'use strict'; - const { Markup } = require('telegraf'); // Bot @@ -23,10 +21,10 @@ const addCustomCmdHandler = async ({ chat, message, reply, from }, next) => { } const command = await getCommand({ id, isActive: false }); - if (chat.type !== 'private' || - !isAdmin || - !command || - !command.state) { + if (chat.type !== 'private' + || !isAdmin + || !command + || !command.state) { return next(); } @@ -43,9 +41,9 @@ const addCustomCmdHandler = async ({ chat, message, reply, from }, next) => { } await updateCommand({ id, role, state: 'content' }); return reply( - 'Send the content you wish to be shown when the command is used.' + - '.\n\nSupported contents:\n- Text (HTML)\n- Photo' + - '\n- Video\n- Document\n- Audio', + 'Send the content you wish to be shown when the command is used.' + + '.\n\nSupported contents:\n- Text (HTML)\n- Photo' + + '\n- Video\n- Document\n- Audio', replyOptions ); } @@ -75,13 +73,13 @@ const addCustomCmdHandler = async ({ chat, message, reply, from }, next) => { } await updateCommand({ ...newCommand, id, isActive: true, state: null }); return reply( - '✅ New command has been created successfully.\n\n' + - 'Custom commands work with ! instead of /.\n\n' + - 'For example: !rules\n\n' + - 'Custom commands can reply other messages too.\n\n' + - '/commands - to see the list of commands.\n' + - '/addcommand - to add a new command.\n' + - '/removecomand <name> - to remove a command.', + '✅ New command has been created successfully.\n\n' + + 'Custom commands work with ! instead of /.\n\n' + + 'For example: !rules\n\n' + + 'Custom commands can reply other messages too.\n\n' + + '/commands - to see the list of commands.\n' + + '/addcommand - to add a new command.\n' + + '/removecomand <name> - to remove a command.', replyOptions ); } diff --git a/handlers/messages/checkUsername.js b/handlers/messages/checkUsername.js index 0f2bad5..9d3d5d5 100644 --- a/handlers/messages/checkUsername.js +++ b/handlers/messages/checkUsername.js @@ -1,5 +1,3 @@ -'use strict'; - // DB const { addUser, getUser } = require('../../stores/user'); diff --git a/handlers/messages/index.js b/handlers/messages/index.js index 5432651..5f9c617 100644 --- a/handlers/messages/index.js +++ b/handlers/messages/index.js @@ -1,5 +1,3 @@ -'use strict'; - const { Composer } = require('telegraf'); const composer = new Composer(); diff --git a/handlers/messages/removeLinks.js b/handlers/messages/removeLinks.js index 87453c8..affddbd 100644 --- a/handlers/messages/removeLinks.js +++ b/handlers/messages/removeLinks.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { logError } = require('../../utils/log'); @@ -20,17 +18,17 @@ const warn = require('../../actions/warn'); const removeLinks = async (ctx, next) => { const { message, state, update } = ctx; const { isAdmin: isStateAdmin, user: stateUser } = state; - const user = stateUser || - await getUser({ id: update.edited_message.from.id }); + const user = stateUser + || await getUser({ id: update.edited_message.from.id }); const isAdmin = isStateAdmin || user.status === 'admin'; const updateData = message || update.edited_message; const { entities, caption, forward_from_chat, text } = updateData; const managedGroups = await listGroups(); if ( - updateData.chat.type === 'private' || - isAdmin || - !excludeLinks) { + updateData.chat.type === 'private' + || isAdmin + || !excludeLinks) { return next(); } @@ -40,11 +38,11 @@ const removeLinks = async (ctx, next) => { ...excludeLinks ]; - const regexp = - /(@\w+)|(\?start=)|(((t.me)|(telegram.(me|dog)))\/\w+(\/[A-Za-z0-9_-]+)?)/gi; // eslint-disable-line max-len + const regexp + = /(@\w+)|(\?start=)|(((t.me)|(telegram.(me|dog)))\/\w+(\/[A-Za-z0-9_-]+)?)/gi; // eslint-disable-line max-len - const usernames = - text + const usernames + = text ? text.match(regexp) || [] : []; @@ -71,8 +69,8 @@ const removeLinks = async (ctx, next) => { // detect add if it's an invite link if ( - username.includes('/joinchat/') && - !knownLinks.some(knownLink => knownLink.includes(username)) + username.includes('/joinchat/') + && !knownLinks.some(knownLink => knownLink.includes(username)) ) { return true; } @@ -96,7 +94,8 @@ const removeLinks = async (ctx, next) => { ) { return true; } - } catch (err) { + } + catch (err) { logError(err); } return false; @@ -106,19 +105,19 @@ const removeLinks = async (ctx, next) => { if ( // check if is forwarded from channel - forward_from_chat && - forward_from_chat.type !== 'private' && - excludeLinks && - !excludeLinks.includes(forward_from_chat.username) || + forward_from_chat + && forward_from_chat.type !== 'private' + && excludeLinks + && !excludeLinks.includes(forward_from_chat.username) // check if text contains link/username of a channel or group - (caption || - text && - (domains.some(item => text.includes(item)) || - entities && entities.some(entity => - entity.type === 'mention' || - entity.url))) && - isAd && isAd.some(item => item) + || (caption + || text + && (domains.some(item => text.includes(item)) + || entities && entities.some(entity => + entity.type === 'mention' + || entity.url))) + && isAd && isAd.some(item => item) ) { const reason = 'Forwarded or linked channels/groups'; const admin = ctx.botInfo; diff --git a/handlers/middlewares/addedToGroup.js b/handlers/middlewares/addedToGroup.js index 0973b5d..a7f2d34 100644 --- a/handlers/middlewares/addedToGroup.js +++ b/handlers/middlewares/addedToGroup.js @@ -1,5 +1,3 @@ -'use strict'; - // Bot const { replyOptions } = require('../../bot/options'); @@ -9,10 +7,10 @@ const { master } = require('../../config'); const addedToGroupHandler = async (ctx, next) => { const msg = ctx.message; - const isMaster = ctx.from.id === Number(master) || - ctx.from.username && - ctx.from.username.toLowerCase() === - String(master).replace('@', '').toLowerCase(); + const isMaster = ctx.from.id === Number(master) + || ctx.from.username + && ctx.from.username.toLowerCase() + === String(master).replace('@', '').toLowerCase(); const wasAdded = msg.new_chat_members.some(user => user.username === ctx.me); @@ -24,12 +22,12 @@ const addedToGroupHandler = async (ctx, next) => { if (!link) { // eslint-disable-next-line function-paren-newline await ctx.replyWithHTML( - '⚠️ Failed to export chat invite link.\n' + - 'Group won\'t be visible in /groups list.\n' + - '\n' + - 'If this isn\'t your intention, ' + - 'make sure I am permitted to export chat invite link, ' + - 'and then run /showgroup.'); + '⚠️ Failed to export chat invite link.\n' + + 'Group won\'t be visible in /groups list.\n' + + '\n' + + 'If this isn\'t your intention, ' + + 'make sure I am permitted to export chat invite link, ' + + 'and then run /showgroup.'); } const { id, title, type } = ctx.chat; await addGroup({ id, link, title, type }); diff --git a/handlers/middlewares/antibot.js b/handlers/middlewares/antibot.js index f076d5c..3b00885 100644 --- a/handlers/middlewares/antibot.js +++ b/handlers/middlewares/antibot.js @@ -1,5 +1,3 @@ -'use strict'; - // Bot const { replyOptions } = require('../../bot/options'); diff --git a/handlers/middlewares/index.js b/handlers/middlewares/index.js index 729b926..9f57966 100644 --- a/handlers/middlewares/index.js +++ b/handlers/middlewares/index.js @@ -1,5 +1,3 @@ -'use strict'; - const millisecond = require('millisecond'); const { Composer } = require('telegraf'); diff --git a/handlers/middlewares/kickBanned.js b/handlers/middlewares/kickBanned.js index 6daeb0b..abbf074 100644 --- a/handlers/middlewares/kickBanned.js +++ b/handlers/middlewares/kickBanned.js @@ -1,5 +1,3 @@ -'use strict'; - const dedent = require('dedent-js'); // Utils diff --git a/handlers/middlewares/kickedFromGroup.js b/handlers/middlewares/kickedFromGroup.js index 9fcbf88..5450998 100644 --- a/handlers/middlewares/kickedFromGroup.js +++ b/handlers/middlewares/kickedFromGroup.js @@ -1,5 +1,3 @@ -'use strict'; - const { removeGroup } = require('../../stores/group'); const kickedFromGroupHandler = (ctx, next) => { diff --git a/handlers/middlewares/leaveUnmanaged.js b/handlers/middlewares/leaveUnmanaged.js index c047fe1..59737a2 100644 --- a/handlers/middlewares/leaveUnmanaged.js +++ b/handlers/middlewares/leaveUnmanaged.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { logError } = require('../../utils/log'); @@ -48,14 +46,15 @@ const randomChoice = arr => arr[Math.floor(Math.random() * arr.length)]; */ const leaveUnmanagedHandler = async (ctx, next) => { if ( - ctx.chat.type === 'private' || - await managesGroup({ id: ctx.chat.id })) { + ctx.chat.type === 'private' + || await managesGroup({ id: ctx.chat.id })) { return next(); } try { await ctx.replyWithVideo(randomChoice(gifs), { caption, reply_markup }); - } catch (err) { + } + catch (err) { logError(err); } await ctx.telegram.leaveChat(ctx.chat.id); diff --git a/handlers/middlewares/removeCommands.js b/handlers/middlewares/removeCommands.js index eca4b12..f77fbc2 100644 --- a/handlers/middlewares/removeCommands.js +++ b/handlers/middlewares/removeCommands.js @@ -1,19 +1,17 @@ -'use strict'; - const { deleteCommands } = require('../../config'); const noop = Function.prototype; const removeCommandsHandler = ({ chat, message, telegram }, next) => { if ( - deleteCommands === 'all' && - message && - message.text && - message.entities && - message.entities[0] && - message.entities[0].offset === 0 && - message.entities[0].type === 'bot_command' && - chat.type !== 'private' + deleteCommands === 'all' + && message + && message.text + && message.entities + && message.entities[0] + && message.entities[0].offset === 0 + && message.entities[0].type === 'bot_command' + && chat.type !== 'private' ) { telegram.deleteMessage(chat.id, message.message_id).catch(noop); } diff --git a/handlers/middlewares/syncStatus.js b/handlers/middlewares/syncStatus.js index 62a7599..fb12207 100644 --- a/handlers/middlewares/syncStatus.js +++ b/handlers/middlewares/syncStatus.js @@ -1,5 +1,3 @@ -'use strict'; - const { getUser } = require('../../stores/user'); const syncStatusHandler = (ctx, next) => { diff --git a/handlers/middlewares/updateGroupTitle.js b/handlers/middlewares/updateGroupTitle.js index e237024..790f97e 100644 --- a/handlers/middlewares/updateGroupTitle.js +++ b/handlers/middlewares/updateGroupTitle.js @@ -1,5 +1,3 @@ -'use strict'; - const { updateGroup } = require('../../stores/group'); module.exports = (ctx, next) => { diff --git a/handlers/middlewares/updateUserData.js b/handlers/middlewares/updateUserData.js index 886ecc2..20fd7be 100644 --- a/handlers/middlewares/updateUserData.js +++ b/handlers/middlewares/updateUserData.js @@ -1,5 +1,3 @@ -'use strict'; - // Config const { master } = require('../../config'); @@ -17,11 +15,11 @@ const updateUserDataHandler = async (ctx, next) => { ctx.state = { isAdmin: user && user.status === 'admin', - isMaster: user && - (user.id === Number(master) || - user.username && - user.username.toLowerCase() === - String(master).replace('@', '').toLowerCase()), + isMaster: user + && (user.id === Number(master) + || user.username + && user.username.toLowerCase() + === String(master).replace('@', '').toLowerCase()), user, }; diff --git a/handlers/regex/groupLinker.js b/handlers/regex/groupLinker.js index ed0bf27..15c4d8d 100644 --- a/handlers/regex/groupLinker.js +++ b/handlers/regex/groupLinker.js @@ -1,5 +1,3 @@ -'use strict'; - const { hears } = require('telegraf'); const XRegExp = require('xregexp'); diff --git a/handlers/regex/index.js b/handlers/regex/index.js index c30d623..ec624d9 100644 --- a/handlers/regex/index.js +++ b/handlers/regex/index.js @@ -1,5 +1,3 @@ -'use strict'; - const { compose } = require('telegraf'); /* eslint-disable global-require */ diff --git a/handlers/regex/runCustomCmd.js b/handlers/regex/runCustomCmd.js index b83d5af..0a8821e 100644 --- a/handlers/regex/runCustomCmd.js +++ b/handlers/regex/runCustomCmd.js @@ -1,5 +1,3 @@ -'use strict'; - const { hears } = require('telegraf'); const R = require('ramda'); @@ -29,10 +27,10 @@ const runCustomCmdHandler = async (ctx, next) => { const { caption, content, type } = command; const role = command.role.toLowerCase(); if ( - role === 'master' && - !isMaster || - role === 'admins' && - !isAdmin + role === 'master' + && !isMaster + || role === 'admins' + && !isAdmin ) { return next(); } diff --git a/handlers/unmatched.js b/handlers/unmatched.js index bfc597e..c69d5bf 100644 --- a/handlers/unmatched.js +++ b/handlers/unmatched.js @@ -1,5 +1,3 @@ -'use strict'; - const R = require('ramda'); const Tf = require('telegraf'); diff --git a/index.js b/index.js index cf1415b..12bcca8 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -'use strict'; + // Utils const { logError } = require('./utils/log'); diff --git a/package-lock.json b/package-lock.json index 1d49941..95e1f13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "dev": true, "requires": { - "acorn": "3.3.0" + "acorn": "^3.0.4" }, "dependencies": { "acorn": { @@ -32,10 +32,10 @@ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "ajv-keywords": { @@ -78,7 +78,7 @@ "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" } }, "array-union": { @@ -87,7 +87,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -118,9 +118,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" }, "dependencies": { "chalk": { @@ -129,11 +129,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "strip-ansi": { @@ -142,7 +142,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } } } @@ -163,7 +163,7 @@ "resolved": "https://registry.npmjs.org/binary-search-tree/-/binary-search-tree-0.2.5.tgz", "integrity": "sha1-fbs7IQ/coIJFDa0jNMMErzm9x4Q=", "requires": { - "underscore": "1.4.4" + "underscore": "~1.4.4" } }, "brace-expansion": { @@ -172,7 +172,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -182,7 +182,7 @@ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "dev": true, "requires": { - "callsites": "0.2.0" + "callsites": "^0.2.0" } }, "callsites": { @@ -197,9 +197,9 @@ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "ansi-styles": "^3.1.0", + "escape-string-regexp": "^1.0.5", + "supports-color": "^4.0.0" }, "dependencies": { "ansi-styles": { @@ -208,7 +208,7 @@ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "color-convert": "1.9.1" + "color-convert": "^1.9.0" } }, "supports-color": { @@ -217,7 +217,7 @@ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } } } @@ -240,7 +240,7 @@ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "restore-cursor": "2.0.0" + "restore-cursor": "^2.0.0" } }, "cli-width": { @@ -261,7 +261,7 @@ "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { - "color-name": "1.1.3" + "color-name": "^1.1.1" } }, "color-name": { @@ -282,9 +282,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.4", - "typedarray": "0.0.6" + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" }, "dependencies": { "isarray": { @@ -299,13 +299,13 @@ "integrity": "sha512-vuYxeWYM+fde14+rajzqgeohAI7YoJcHE7kXDAc4Nk0EbuKnJfqtY9YtRkLo/tqkuF7MsBQRhPnPeyjYITp3ZQ==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -314,7 +314,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } @@ -330,9 +330,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" } }, "debug": { @@ -360,13 +360,13 @@ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", "dev": true, "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.2" + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" } }, "doctrine": { @@ -375,7 +375,7 @@ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "2.0.2" + "esutils": "^2.0.2" } }, "encoding": { @@ -383,7 +383,7 @@ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "requires": { - "iconv-lite": "0.4.19" + "iconv-lite": "~0.4.13" } }, "es3ify": { @@ -391,9 +391,9 @@ "resolved": "https://registry.npmjs.org/es3ify/-/es3ify-0.1.4.tgz", "integrity": "sha1-rZ+l3xrjTz8x4SEbWBiy1RB439E=", "requires": { - "esprima-fb": "3001.1.0-dev-harmony-fb", - "jstransform": "3.0.0", - "through": "2.3.8" + "esprima-fb": "~3001.0001.0000-dev-harmony-fb", + "jstransform": "~3.0.0", + "through": "~2.3.4" } }, "escape-string-regexp": { @@ -408,43 +408,43 @@ "integrity": "sha512-AyxBUCANU/o/xC0ijGMKavo5Ls3oK6xykiOITlMdjFjrKOsqLrA7Nf5cnrDgcKrHzBirclAZt63XO7YZlVUPwA==", "dev": true, "requires": { - "ajv": "5.5.2", - "babel-code-frame": "6.26.0", - "chalk": "2.3.0", - "concat-stream": "1.6.0", - "cross-spawn": "5.1.0", - "debug": "3.1.0", - "doctrine": "2.1.0", - "eslint-scope": "3.7.1", - "eslint-visitor-keys": "1.0.0", - "espree": "3.5.3", - "esquery": "1.0.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "functional-red-black-tree": "1.0.1", - "glob": "7.1.2", - "globals": "11.3.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "3.3.0", - "is-resolvable": "1.1.0", - "js-yaml": "3.10.0", - "json-stable-stringify-without-jsonify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.5", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "7.0.0", - "progress": "2.0.0", - "require-uncached": "1.0.3", - "semver": "5.5.0", - "strip-ansi": "4.0.0", - "strip-json-comments": "2.0.1", - "table": "4.0.2", - "text-table": "0.2.0" + "ajv": "^5.3.0", + "babel-code-frame": "^6.22.0", + "chalk": "^2.1.0", + "concat-stream": "^1.6.0", + "cross-spawn": "^5.1.0", + "debug": "^3.1.0", + "doctrine": "^2.1.0", + "eslint-scope": "^3.7.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^3.5.2", + "esquery": "^1.0.0", + "esutils": "^2.0.2", + "file-entry-cache": "^2.0.0", + "functional-red-black-tree": "^1.0.1", + "glob": "^7.1.2", + "globals": "^11.0.1", + "ignore": "^3.3.3", + "imurmurhash": "^0.1.4", + "inquirer": "^3.0.6", + "is-resolvable": "^1.0.0", + "js-yaml": "^3.9.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.4", + "minimatch": "^3.0.2", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.2", + "pluralize": "^7.0.0", + "progress": "^2.0.0", + "require-uncached": "^1.0.3", + "semver": "^5.3.0", + "strip-ansi": "^4.0.0", + "strip-json-comments": "~2.0.1", + "table": "^4.0.1", + "text-table": "~0.2.0" } }, "eslint-scope": { @@ -453,8 +453,8 @@ "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", "dev": true, "requires": { - "esrecurse": "4.2.0", - "estraverse": "4.2.0" + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" } }, "eslint-visitor-keys": { @@ -474,8 +474,8 @@ "integrity": "sha512-Zy3tAJDORxQZLl2baguiRU1syPERAIg0L+JB2MWorORgTu/CplzvxS9WWA7Xh4+Q+eOQihNs/1o1Xep8cvCxWQ==", "dev": true, "requires": { - "acorn": "5.4.1", - "acorn-jsx": "3.0.1" + "acorn": "^5.4.0", + "acorn-jsx": "^3.0.0" }, "dependencies": { "acorn": { @@ -497,7 +497,7 @@ "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", "dev": true, "requires": { - "estraverse": "4.2.0" + "estraverse": "^4.0.0" } }, "esrecurse": { @@ -506,8 +506,8 @@ "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", "dev": true, "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" + "estraverse": "^4.1.0", + "object-assign": "^4.0.1" } }, "estraverse": { @@ -528,9 +528,9 @@ "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", "dev": true, "requires": { - "chardet": "0.4.2", - "iconv-lite": "0.4.19", - "tmp": "0.0.33" + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" } }, "falafel": { @@ -538,10 +538,10 @@ "resolved": "https://registry.npmjs.org/falafel/-/falafel-1.2.0.tgz", "integrity": "sha1-wY0k71CRF0pJfzGM0ksCaiXN2rQ=", "requires": { - "acorn": "1.2.2", - "foreach": "2.0.5", + "acorn": "^1.0.3", + "foreach": "^2.0.5", "isarray": "0.0.1", - "object-keys": "1.0.11" + "object-keys": "^1.0.6" } }, "fast-deep-equal": { @@ -568,7 +568,7 @@ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5" + "escape-string-regexp": "^1.0.5" } }, "file-entry-cache": { @@ -577,8 +577,8 @@ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "dev": true, "requires": { - "flat-cache": "1.3.0", - "object-assign": "4.1.1" + "flat-cache": "^1.2.1", + "object-assign": "^4.0.1" } }, "flat-cache": { @@ -587,10 +587,10 @@ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", "dev": true, "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" + "circular-json": "^0.3.1", + "del": "^2.0.2", + "graceful-fs": "^4.1.2", + "write": "^0.2.1" } }, "foreach": { @@ -616,12 +616,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "globals": { @@ -636,12 +636,12 @@ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "graceful-fs": { @@ -656,7 +656,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "has-flag": { @@ -693,8 +693,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -707,8 +707,8 @@ "resolved": "https://registry.npmjs.org/inline-process-browser/-/inline-process-browser-1.0.0.tgz", "integrity": "sha1-RqYbFT3TybFiSxoAYm7bT39BTyI=", "requires": { - "falafel": "1.2.0", - "through2": "0.6.5" + "falafel": "^1.0.1", + "through2": "^0.6.5" } }, "inquirer": { @@ -717,20 +717,20 @@ "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", "dev": true, "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.1.0", - "figures": "2.0.0", - "lodash": "4.17.5", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.0.4", + "figures": "^2.0.0", + "lodash": "^4.3.0", "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" + "run-async": "^2.2.0", + "rx-lite": "^4.0.8", + "rx-lite-aggregates": "^4.0.8", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" } }, "is-fullwidth-code-point": { @@ -751,7 +751,7 @@ "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", "dev": true, "requires": { - "is-path-inside": "1.0.1" + "is-path-inside": "^1.0.0" } }, "is-path-inside": { @@ -760,7 +760,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "1.0.2" + "path-is-inside": "^1.0.1" } }, "is-promise": { @@ -803,8 +803,8 @@ "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", "dev": true, "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" }, "dependencies": { "esprima": { @@ -833,7 +833,7 @@ "integrity": "sha1-olkats7o2XvzvoMNv6IxO4fNZAs=", "requires": { "base62": "0.1.1", - "esprima-fb": "3001.1.0-dev-harmony-fb", + "esprima-fb": "~3001.1.0-dev-harmony-fb", "source-map": "0.1.31" } }, @@ -843,8 +843,8 @@ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "lie": { @@ -852,10 +852,10 @@ "resolved": "https://registry.npmjs.org/lie/-/lie-3.0.2.tgz", "integrity": "sha1-/9oh17uibzd8rYZdNkmy/Izjn+o=", "requires": { - "es3ify": "0.1.4", - "immediate": "3.0.6", - "inline-process-browser": "1.0.0", - "unreachable-branch-transform": "0.3.0" + "es3ify": "^0.1.3", + "immediate": "~3.0.5", + "inline-process-browser": "^1.0.0", + "unreachable-branch-transform": "^0.3.0" } }, "localforage": { @@ -878,8 +878,8 @@ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, "millisecond": { @@ -899,7 +899,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -939,9 +939,9 @@ "requires": { "async": "0.2.10", "binary-search-tree": "0.2.5", - "localforage": "1.5.0", - "mkdirp": "0.5.1", - "underscore": "1.4.4" + "localforage": "^1.3.0", + "mkdirp": "~0.5.1", + "underscore": "~1.4.4" } }, "nedb-promise": { @@ -949,8 +949,8 @@ "resolved": "https://registry.npmjs.org/nedb-promise/-/nedb-promise-2.0.1.tgz", "integrity": "sha1-g5suSQlxb99pUAt/aLK4ciWCzWU=", "requires": { - "nedb": "1.8.0", - "thenify": "3.3.0" + "nedb": "^1.8.0", + "thenify": "^3.2.0" } }, "node-fetch": { @@ -958,8 +958,8 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" + "encoding": "^0.1.11", + "is-stream": "^1.0.1" } }, "object-assign": { @@ -979,7 +979,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "onetime": { @@ -988,7 +988,7 @@ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", "dev": true, "requires": { - "mimic-fn": "1.2.0" + "mimic-fn": "^1.0.0" } }, "optionator": { @@ -997,12 +997,12 @@ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" } }, "os-tmpdir": { @@ -1041,7 +1041,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" } }, "pluralize": { @@ -1089,10 +1089,10 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "recast": { @@ -1101,9 +1101,9 @@ "integrity": "sha1-uV1Q9tYHYaX2JS4V2AZ4FoSRzn8=", "requires": { "ast-types": "0.8.15", - "esprima-fb": "15001.1001.0-dev-harmony-fb", - "private": "0.1.7", - "source-map": "0.5.7" + "esprima-fb": "~15001.1001.0-dev-harmony-fb", + "private": "~0.1.5", + "source-map": "~0.5.0" }, "dependencies": { "esprima-fb": { @@ -1124,8 +1124,8 @@ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", "dev": true, "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" + "caller-path": "^0.1.0", + "resolve-from": "^1.0.0" } }, "resolve-from": { @@ -1140,8 +1140,8 @@ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", "dev": true, "requires": { - "onetime": "2.0.1", - "signal-exit": "3.0.2" + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" } }, "rimraf": { @@ -1150,7 +1150,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "run-async": { @@ -1159,7 +1159,7 @@ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, "requires": { - "is-promise": "2.1.0" + "is-promise": "^2.1.0" } }, "rx-lite": { @@ -1174,7 +1174,7 @@ "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", "dev": true, "requires": { - "rx-lite": "4.0.8" + "rx-lite": "*" } }, "safe-buffer": { @@ -1200,7 +1200,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "1.0.0" + "shebang-regex": "^1.0.0" } }, "shebang-regex": { @@ -1221,7 +1221,7 @@ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0" + "is-fullwidth-code-point": "^2.0.0" } }, "source-map": { @@ -1229,7 +1229,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.31.tgz", "integrity": "sha1-n3BNDWnZ4TioG63267T94z0VHGE=", "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } }, "sprintf-js": { @@ -1244,8 +1244,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "string_decoder": { @@ -1259,7 +1259,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" }, "dependencies": { "ansi-regex": { @@ -1288,12 +1288,12 @@ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", "dev": true, "requires": { - "ajv": "5.5.2", - "ajv-keywords": "2.1.1", - "chalk": "2.3.0", - "lodash": "4.17.5", + "ajv": "^5.2.3", + "ajv-keywords": "^2.1.0", + "chalk": "^2.1.0", + "lodash": "^4.17.4", "slice-ansi": "1.0.0", - "string-width": "2.1.1" + "string-width": "^2.1.1" } }, "telegraf": { @@ -1301,9 +1301,9 @@ "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-3.17.8.tgz", "integrity": "sha512-aKtL6sSsgZOE/NYUoBuvTVZAFcnUzYu//QoX1d6Nc4D7Q23AolJNFg2hs0BR+3WhvP+F1/dsp6YL1udvV9Ijnw==", "requires": { - "debug": "3.1.0", - "node-fetch": "1.7.3", - "sandwich-stream": "1.0.0" + "debug": "^3.0.0", + "node-fetch": "^1.6.3", + "sandwich-stream": "^1.0.0" } }, "text-table": { @@ -1317,7 +1317,7 @@ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", "requires": { - "any-promise": "1.3.0" + "any-promise": "^1.0.0" } }, "through": { @@ -1330,8 +1330,8 @@ "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" } }, "tmp": { @@ -1340,7 +1340,7 @@ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { - "os-tmpdir": "1.0.2" + "os-tmpdir": "~1.0.2" } }, "type-check": { @@ -1349,7 +1349,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "1.1.2" + "prelude-ls": "~1.1.2" } }, "typedarray": { @@ -1368,9 +1368,9 @@ "resolved": "https://registry.npmjs.org/unreachable-branch-transform/-/unreachable-branch-transform-0.3.0.tgz", "integrity": "sha1-2ZzExudG0mSSiEW2EdtUsPNHTKo=", "requires": { - "esmangle-evaluator": "1.0.1", - "recast": "0.10.43", - "through2": "0.6.5" + "esmangle-evaluator": "^1.0.0", + "recast": "^0.10.1", + "through2": "^0.6.2" } }, "util-deprecate": { @@ -1385,7 +1385,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "wordwrap": { @@ -1406,7 +1406,7 @@ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", "dev": true, "requires": { - "mkdirp": "0.5.1" + "mkdirp": "^0.5.1" } }, "xregexp": { diff --git a/plugins/README.md b/plugins/README.md index fecdf88..935b2fb 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -1,5 +1,4 @@ # Plugins # - Plugins let you extend the bot with new functionality without touching source code of the bot. diff --git a/plugins/index.js b/plugins/index.js index 2ded51d..5ad35b9 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -1,5 +1,3 @@ -'use strict'; - const { compose } = require('telegraf'); const config = require('../config'); diff --git a/stores/command.js b/stores/command.js index c66157b..30b2a1c 100644 --- a/stores/command.js +++ b/stores/command.js @@ -1,5 +1,3 @@ -'use strict'; - const Datastore = require('nedb-promise'); const Command = new Datastore({ diff --git a/stores/group.js b/stores/group.js index d9e6e71..634f16a 100644 --- a/stores/group.js +++ b/stores/group.js @@ -1,5 +1,3 @@ -'use strict'; - const Datastore = require('nedb-promise'); const Group = new Datastore({ diff --git a/stores/user.js b/stores/user.js index 263b39a..1faacb4 100644 --- a/stores/user.js +++ b/stores/user.js @@ -1,5 +1,3 @@ -'use strict'; - // Utils const { logError } = require('../utils/log'); diff --git a/utils/log.js b/utils/log.js index 1197591..3a02606 100644 --- a/utils/log.js +++ b/utils/log.js @@ -1,5 +1,3 @@ -'use strict'; - /* eslint-disable no-console */ const { inspect } = require('util'); diff --git a/utils/tg.js b/utils/tg.js index aa914e9..ead5c54 100644 --- a/utils/tg.js +++ b/utils/tg.js @@ -1,5 +1,3 @@ -'use strict'; - const { telegram } = require('../bot'); const escapeHtml = s => s