Показать сообщение отдельно

  #7  
Старый 01.02.2023, 01:48
дмитрий куст
Познающий
Регистрация: 02.06.2021
Сообщений: 79
С нами: 2605418

Репутация: 18
По умолчанию

Цитата:
Сообщение от xionerme  

12390:





Код:
from
aiogram
import
Bot
,
Dispatcher
,
executor
,
types

bot
=
Bot
(
token
=
'token'
)
dp
=
Dispatcher
(
bot
)
@dp.message_handler
(
commands
=
[
'start'
]
)
async
def
send_welcome
(
message
:
types
.
Message
)
:
if
message
.
chat
.
type
==
'private'
:
await
message
.
reply
(
'Привет! Введи номер фильма.'
)
@dp.message_handler
(
)
async
def
films
(
message
:
types
.
Message
)
:
if
message
.
chat
.
type
==
'private'
:
with
open
(
'films.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
lines
=
f
.
readlines
(
)
local
=
int
(
message
.
text
)
await
message
.
reply
(
lines
[
local
]
)
if
__name__
==
"__main__"
:
executor
.
start_polling
(
dp
,
skip_updates
=
True
)


aiogram > telebot
бля убедил) попробую себя в айограме, почитал что вроде как он пизже чем телебот, но и сложнее. новичок в питоне, смогу разобраться?
 
Ответить с цитированием