
31.01.2023, 23:46
|
|
Постоянный
Регистрация: 25.02.2021
Сообщений: 745
С нами:
2744398
Репутация:
68
|
|
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
|
|
|