File size: 1,288 Bytes
603c53e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b9ba73
bb772f9
8b9ba73
 
 
 
 
bb772f9
603c53e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import logging

from aiogram import Bot, Dispatcher, executor, types

API_TOKEN = '6184585778:AAEwvLKXANtI-z7LeCmBlZ8PrNXBsf426W4'

# Configure logging
logging.basicConfig(level=logging.INFO)

# Initialize bot and dispatcher
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)


@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
    """
    This handler will be called when user sends `/start` or `/help` command
    """
    await message.reply("Привет!\nМеня зовут Сенкаро!\nБуду рад провести время с тобой.")

@dp.message_handler(is_reply=True, chat_type=types.ChatType.GROUP) 
async def echo(message: types.Message):
    await message.answer(message.text)  

@dp.message_handler(chat_type=types.ChatType.GROUP)
async def ignore_group_messages(message: types.Message):
    pass
    
@dp.message_handler(commands=['sen'])
async def send_message(message: types.Message):
    await message.reply("Сообщение отправлено!")


@dp.message_handler()
async def echo(message: types.Message):
    # old style:
    # await bot.send_message(message.chat.id, message.text)

    await message.answer(message.text)


if __name__ == '__main__':
    executor.start_polling(dp, skip_updates=True)