-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot_standalone.py
More file actions
73 lines (48 loc) · 1.97 KB
/
bot_standalone.py
File metadata and controls
73 lines (48 loc) · 1.97 KB
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
67
68
69
70
71
72
73
from aiogram import Bot, Dispatcher, executor, types
from aiogram.dispatcher.filters import Text
from aiogram.utils.markdown import hbold, hlink
from main import collect_data, find_wishes, GetSysytemTime
from time import time, sleep
import json
import os
import data_input as di
import asyncio
import aioschedule
bot = Bot(token = di.TOKEN, parse_mode = types.ParseMode.HTML)
dp = Dispatcher(bot)
@dp.message_handler(commands="start")
async def start(message: types.Message):
start_buttons = ["UP", "Staff", "Ping"]
keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
keyboard.add(*start_buttons)
await message.answer("🔥GO!🔥", reply_markup=keyboard)
@dp.message_handler(Text(equals="UP"))
async def get_UP_data(message: types.Message):
await message.answer("Please waiting...")
UP_data = collect_data(di.UP_url_parks, di.UP_pagination_count)
UP_result = find_wishes(di.UP_wishes, UP_data)
card =''
if(UP_result):
for el in UP_result:
card = str( el['Info'] + "\n" +
'Size: ' + str(el['Size']).replace("[", "").replace("]", "").replace("'", "") +"\n" +
'Price: ' + el['Price'] + "\n")
if ("PriceDiscount" in el):
card += 'Price Discount: ' + el["PriceDiscount"] + "🔥🔥🔥" + '\n'
card += di.UP_url + el['id']
await message.answer(card)
else:
card = "Not found!"
await message.answer(card)
#PING time
@dp.message_handler(Text(equals="Ping"))
async def get_ping(message: types.Message):
_curTime = str(GetSysytemTime())
await message.answer(_curTime)
@dp.message_handler(Text(equals="Staff"))
async def my_func(message: types.Message):
await bot.send_message(message.chat.id, 'hi there')
def main():
executor.start_polling(dp, skip_updates = True, on_startup=on_startup)
if __name__ == "__main__":
main()