Spaces:
Runtime error
Runtime error
Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
|
3 |
+
from aiogram import Bot, Dispatcher, executor, types
|
4 |
+
|
5 |
+
API_TOKEN = '6184585778:AAEwvLKXANtI-z7LeCmBlZ8PrNXBsf426W4'
|
6 |
+
|
7 |
+
# Configure logging
|
8 |
+
logging.basicConfig(level=logging.INFO)
|
9 |
+
|
10 |
+
# Initialize bot and dispatcher
|
11 |
+
bot = Bot(token=API_TOKEN)
|
12 |
+
dp = Dispatcher(bot)
|
13 |
+
|
14 |
+
|
15 |
+
@dp.message_handler(commands=['start', 'help'])
|
16 |
+
async def send_welcome(message: types.Message):
|
17 |
+
"""
|
18 |
+
This handler will be called when user sends `/start` or `/help` command
|
19 |
+
"""
|
20 |
+
await message.reply("Привет!\nМеня зовут Сенкаро!\nБуду рад провести время с тобой.")
|
21 |
+
|
22 |
+
@dp.message_handler(commands=['sen'])
|
23 |
+
async def send_message(message: types.Message):
|
24 |
+
await message.reply("Сообщение отправлено!")
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
@dp.message_handler()
|
29 |
+
async def echo(message: types.Message):
|
30 |
+
# old style:
|
31 |
+
# await bot.send_message(message.chat.id, message.text)
|
32 |
+
|
33 |
+
await message.answer(message.text)
|
34 |
+
|
35 |
+
|
36 |
+
if __name__ == '__main__':
|
37 |
+
executor.start_polling(dp, skip_updates=True)
|