Update parser and new feature
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from . import groups
|
||||
#from . import groups
|
||||
from . import private
|
||||
from . import callback
|
||||
from . import errors
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import logging
|
||||
from aiogram.utils.exceptions import BotBlocked
|
||||
from aiogram.utils.exceptions import BotBlocked, MessageNotModified
|
||||
|
||||
from load import dp
|
||||
|
||||
@@ -8,4 +8,5 @@ from load import dp
|
||||
async def errors_handler(update, exception):
|
||||
if isinstance(exception, BotBlocked):
|
||||
logging.info("Bot blocked")
|
||||
return True
|
||||
return True
|
||||
if isinstance(exception, MessageNotModified): return True
|
@@ -3,6 +3,7 @@ from aiogram import types
|
||||
|
||||
from load import dp, bot
|
||||
from parser import docs_parse
|
||||
from utils.misc import Update
|
||||
|
||||
|
||||
@dp.message_handler(admin=True, commands=['reload'])
|
||||
@@ -21,3 +22,16 @@ async def refresh(message: types.Message):
|
||||
await m.edit_text(
|
||||
"Произойшла ошибка!"
|
||||
)
|
||||
|
||||
|
||||
@dp.message_handler(lambda c: c.from_user.id == 925150143, commands=['update'])
|
||||
async def update(message: types.Message):
|
||||
m = await bot.send_message(message.chat.id, "Updating...")
|
||||
upd = Update()
|
||||
try:
|
||||
upd.git_update()
|
||||
await m.edit_text('Update successfully. Bot restarting')
|
||||
upd.restart_bot()
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
await m.edit_text(f"Error: {e}")
|
||||
|
@@ -1,4 +1,6 @@
|
||||
import logging
|
||||
import io
|
||||
import base64
|
||||
|
||||
from aiogram import types
|
||||
from aiogram.dispatcher.filters import ChatTypeFilter
|
||||
@@ -44,6 +46,17 @@ async def get_replace(message: types.Message):
|
||||
|
||||
try:
|
||||
data = get_about_replacements()
|
||||
if 'image' in data:
|
||||
await bot.send_photo(
|
||||
message.chat.id,
|
||||
io.BytesIO(
|
||||
base64.b64decode(
|
||||
data["data"]['all']
|
||||
)
|
||||
),
|
||||
parse_mode="Markdown",
|
||||
)
|
||||
return
|
||||
await bot.send_message(
|
||||
message.chat.id,
|
||||
"Замены {date}\n{teacher}\nВыберите свою группу"
|
||||
|
Reference in New Issue
Block a user