captcha_only_bot
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "captcha_only_bot", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Bot admin captcha", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -20,51 +20,50 @@ require('dotenv').config() | ||
const bot = new Telegraf(BOT_TOKEN, { username: BOT_NAME }) | ||
const init = async (bot, dbConfig) => { | ||
bot.context.database = knex(dbConfig) | ||
bot.context.database = knex(knexConfig) | ||
/** | ||
* Middlewares | ||
*/ | ||
bot.use(session()) | ||
bot.use(userMiddleware()) | ||
bot.use(debugMiddleware()) | ||
/** | ||
* Middlewares | ||
*/ | ||
bot.use(session()) | ||
bot.use(userMiddleware()) | ||
bot.use(debugMiddleware()) | ||
/** | ||
* Handlers | ||
*/ | ||
bot.hears(/[\S\s]*/, hearsHandler()) | ||
bot.on('new_chat_members', newChatMemberHandler()) | ||
bot.on('left_chat_member', leftChatMemberHandler()) | ||
/** | ||
* Handlers | ||
*/ | ||
bot.hears(/[\S\s]*/, hearsHandler()) | ||
bot.on('new_chat_members', newChatMemberHandler()) | ||
bot.on('left_chat_member', leftChatMemberHandler()) | ||
/** | ||
* Actions | ||
*/ | ||
bot.action(/^([.\d]{15,22})=(\d+)/, passAction()) | ||
bot.action(/^action=(\w+)/, actionsAction()) | ||
bot.action(/^settings=(\w+)&field=(\w+)/, editSettingAction()) | ||
/** | ||
* Actions | ||
*/ | ||
bot.action(/^([.\d]{15,22})=(\d+)/, passAction()) | ||
bot.action(/^action=(\w+)/, actionsAction()) | ||
bot.action(/^settings=(\w+)&field=(\w+)/, editSettingAction()) | ||
/** | ||
* Commands | ||
*/ | ||
bot.start(startCommand()) | ||
bot.command('settings', settingsCommand()) | ||
/** | ||
* Commands | ||
*/ | ||
bot.start(startCommand()) | ||
bot.command('settings', settingsCommand()) | ||
return bot | ||
} | ||
/** | ||
* Run | ||
* Init bot function. | ||
* | ||
* @param {Telegraf} bot The bot instance. | ||
* @param {Object} dbConfig The knex connection configuration. | ||
* @return {Promise<Telegraf>} Bot ready to launch. | ||
*/ | ||
bot.startPolling() | ||
init(new Telegraf(BOT_TOKEN, { username: BOT_NAME }), knexConfig) | ||
.then((bot) => { | ||
/** | ||
* Run | ||
*/ | ||
bot.startPolling() | ||
}) | ||
module.exports = { | ||
on: { | ||
new_chat_members: newChatMemberHandler, | ||
left_chat_member: leftChatMemberHandler, | ||
}, | ||
action: { | ||
'/^([.\\d]{15,22})=(\\d+)/': passAction, | ||
'/^action=(\\w+)/': actionsAction, | ||
'/^settings=(\\w+)&field=(\\w+)/': editSettingAction, | ||
}, | ||
hears: { | ||
'/[\\S\\s]*/': hearsHandler, | ||
}, | ||
} | ||
module.exports = init |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25147
709