CampFirePlay/commands/admin/fastblock.js
Degradin baa0b5f3a9 global refactoring
Все переведено в модули
2023-10-08 23:43:12 +03:00

23 lines
934 B
JavaScript

const {
Telegraf
} = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN)
const {
UserModel,
BlockModel
} = require('/workspace/degradin/Dev/Telegram/CampFire Play/config')
module.exports = async (ctx) => {
let user = await UserModel.findByPk(ctx.from.id)
if(!ctx.message.reply_to_message) return await ctx.reply(`Только на пересланное сообщение.`)
let blocked = ctx.message.reply_to_message.from.id
if(user.status != 'admin') return await ctx.reply(`Admin Only.`)
await BlockModel.create({
telegram_id: blocked,
isBlocked: true,
reason: `|AutoFastBlock|`,
time: Math.trunc(Date.now() / 1000 + 3600)
})
await bot.telegram.sendMessage(blocked, `Вы были заблокированы администратором ${user.username}.`)
return await ctx.reply(`Пользователь заблокирован.`)
}