#Импортируем необходимые модули
import logging
from aiogram import Bot, Dispatcher, executor, types
import Artbotmarkup as nav
from Filters import IsAdminFilter
#Создаём токен
API_TOKEN = ''
#Настройка ведения
logging.basicConfig(level=logging.INFO)
#Инициализируем Bot и Dispatcher
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
#Activate filters
@dp.filters_factory.bind(IsAdminFilter)
#этот обработчик будет вызываться, когда пользователь отправляет `/Start` или `/помощь команды
@dp.message_handler(commands=['start'])
async def send_welcome(message: types.Message):
#Ожидание
await message.reply("Welcom!", reply_markup = nav.meinStartMenu)
@dp.message_handler()
async def echo(message: types.Message):
#Create the initial button
if message.text == 'Start AbM program':
await bot.send_message(message.from_user.id, 'Welcom! Please register or loging', reply_markup = nav.meinStart)
elif message.text == 'Main menu':
await bot.send_message(message.from_user.id, 'Main menu', reply_markup = nav.meinStartMenu)
else:
await message.reply('WARNING: Comand not found')
#Admins commands
@dp.message_handler(is_admin=True, commands=["ban"], commands_prefix="!/")
async def cmd_ban(message: types.Message):
if not message.reply_to_message:
await message_reply("Dangerous word!")
return
await message.bot.delete_message(config.GROUP_ID, message.message_id)
await message.bot.kick_chat_member(chat_id=config.GROUP_ID, user_id=message.reply_to_message)
await message.reply_to_message.reply('Account is blocked!\nYou were too bad boy')
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)