-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
66 lines (48 loc) · 2.08 KB
/
main.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import logging
from asyncio import run_coroutine_threadsafe, get_event_loop, new_event_loop, sleep
from aiogram import Bot, types, executor
from aiogram.dispatcher import Dispatcher
from time import strftime, gmtime
from datetime import datetime
cc = datetime.today()
dd = cc.strftime('%d-%m-%Y_%H_%M')
papks = 'out'
name = "62163783649"
if not os.path.exists(papks):
os.mkdir(papks)
os.system(f"ffmpeg.exe -i https://s1.moidom-stream.ru/s/public/0000000103.m3u8 neyroset/{papks}/{dd}.jpg")
os.system(f'python neyroset/scripts3/label_image.py --image neyroset/{papks}/{dd}.jpg')
bot = Bot(token='1255862313:AAFWPZqLgPlHH-SXkfji79nLshUjp_SqwDk')
dp = Dispatcher(bot)
logging.basicConfig(level=logging.INFO)
@dp.message_handler(commands="start")
async def cmd_start(message: types.Message):
print(message.chat.id)
keyboard = types.ReplyKeyboardMarkup()
button_1 = types.KeyboardButton(text="узнать о состоянии Онежского озера ")
keyboard.add(button_1)
# button_2 = "когда встал лёд"
# keyboard.add(button_2)
await message.answer("я вас слушаю, хозяин", reply_markup=keyboard)
#user_id = message.from_user.id
def otvet(file):
f_read = open(file, "r")
return f_read.readlines()[-1]
@dp.message_handler(text=['узнать о состоянии Онежского озера'])
async def process_help_command(message: types.Message):
await message.reply(otvet("test.txt"))
#@dp.message_handler(text=['когда встал лёд'])
#async def process_help_command(message: types.Message):
# await message.reply("df")
async def otpravka(sleep1, sl2):
while True:
na_time = strftime('%M/%S', gmtime())
print(na_time)
if na_time == '59/59':
print('час')
await bot.send_message(1203720181, otvet("test.txt"))
await sleep(sleep1)
if __name__ == "__main__":
run_coroutine_threadsafe(otpravka(1, 1), get_event_loop())
executor.start_polling(dp, skip_updates=True)