This repository has been archived by the owner on Jan 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
66 lines (50 loc) · 2.07 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
from aiogram.client.default import DefaultBotProperties
from aiogram.types.callback_query import CallbackQuery
from aiogram import Bot, Dispatcher, types, Router, F
from aiogram.fsm.state import StatesGroup, State
from aiogram.enums.parse_mode import ParseMode
from aiogram.filters import Command
import asyncio, config, utils, kb, subprocess, os
bot = Bot(token=config.TOKEN)
dp = Dispatcher()
router = Router()
class Form(StatesGroup):
text_prompt = State()
img_prompt = State()
async def main():
for admin in config.ADMINS:
await bot.send_message(admin, "✅ *Бот успешно запущен*", parse_mode=ParseMode.MARKDOWN_V2, reply_markup=kb.kb)
await dp.start_polling(bot, default=DefaultBotProperties(parse_mode=ParseMode.MARKDOWN_V2))
@dp.message(F.text == "🏚 Главное меню")
@dp.message(Command("start"))
async def test(msg: types.Message):
if msg.from_user.id not in config.ADMINS:
return
greet = utils.getGreet(msg)
await bot.send_photo(
msg.chat.id,
photo=types.FSInputFile("wallpaper.jpg"),
caption=greet,
parse_mode=ParseMode.MARKDOWN_V2,
reply_markup=kb.menu
)
@dp.message(F.text == "❔ О боте")
async def about(msg: types.Message):
await msg.answer("👤 Создатель: *@pablusha*\n📔 GitHub: *[LinuxBridge](https://github.com/pablushaa/LinuxBridge)*", parse_mode=ParseMode.MARKDOWN_V2)
@dp.callback_query(F.data == "reboot")
async def reboot(call: CallbackQuery):
message = await call.message.answer("*🔄 Перезагружаюсь\\.\\.\\.*", parse_mode=ParseMode.MARKDOWN_V2, reply_markup=kb.kb)
subprocess.run(["reboot"])
await call.answer()
@dp.callback_query(F.data == "screen")
async def screen(call: CallbackQuery):
res = subprocess.run(["./maim", "screen.png"], capture_output=True, text=True)
await bot.send_photo(
call.message.chat.id,
photo=types.FSInputFile("screen.png"),
reply_markup=kb.kb
)
await call.answer()
os.remove("screen.png")
if __name__ == "__main__":
asyncio.run(main())