config command now works fully
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
from bot.common import dp, bot
|
||||
from .start import *
|
||||
from .all_messages import *
|
||||
from bot.db import db, DBTables
|
||||
|
||||
|
||||
def register():
|
||||
dp.register_message_handler(all_messages.sync_db_filter, lambda *_: not hasattr(bot, 'cloudmeta_message_text'))
|
||||
dp.register_message_handler(all_messages.on_action_message,
|
||||
lambda message: str(message.from_id) in list(db[DBTables.actions].keys()))
|
||||
dp.register_message_handler(start.start_command, commands='start')
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from aiogram.types import Message
|
||||
from bot.db import db, DBTables
|
||||
from bot.modules.api.objects.action import Action
|
||||
|
||||
|
||||
async def sync_db_filter(message: Message):
|
||||
@@ -10,3 +12,16 @@ async def sync_db_filter(message: Message):
|
||||
f'If you tried to run a command, run it again')
|
||||
if not await ping():
|
||||
await message.reply('⚠️ Warning: StableDiffusion server is turned off or api endpoint is incorrect')
|
||||
|
||||
|
||||
async def on_action_message(message: Message):
|
||||
action: Action = db[DBTables.actions].get(message.from_id)
|
||||
if not action:
|
||||
return
|
||||
if action.chat_id != message.chat.id:
|
||||
return
|
||||
del db[DBTables.actions][message.from_id]
|
||||
|
||||
import bot.callbacks
|
||||
assert bot.callbacks
|
||||
await eval(f"bot.callbacks.{action.action_module}.{action.action}(message, '{action.overload}')")
|
||||
|
||||
Reference in New Issue
Block a user