mirror of
https://github.com/Redume/StarBoard.git
synced 2025-04-07 04:05:28 +01:00
feat: forwarding a message to a channel
This commit is contained in:
parent
a442489647
commit
61c2f4c355
1 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
from aiogram import types, Router
|
from aiogram import types, Router
|
||||||
|
|
||||||
|
from bot import bot
|
||||||
from database.database import pg_con
|
from database.database import pg_con
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
@ -46,3 +48,14 @@ async def register_message_reaction(event: types.MessageReactionUpdated):
|
||||||
emoji = reaction.model_dump()['emoji']
|
emoji = reaction.model_dump()['emoji']
|
||||||
if emoji in valid_emojis:
|
if emoji in valid_emojis:
|
||||||
await update_reaction_count(conn, event.chat.id, event.message_id, -1)
|
await update_reaction_count(conn, event.chat.id, event.message_id, -1)
|
||||||
|
|
||||||
|
reaction_count_message = await conn.fetchrow('SELECT reaction_count FROM message WHERE chat_id = $1 AND message_id = $2',
|
||||||
|
event.chat.id, event.message_id
|
||||||
|
)
|
||||||
|
|
||||||
|
reaction_count_chat = await conn.fetchrow('SELECT min_reaction_count, channel_id FROM chat WHERE chat_id = $1',
|
||||||
|
event.chat.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if reaction_count_message[0] >= reaction_count_chat[0]:
|
||||||
|
await bot.copy_message(message_id=event.message_id, from_chat_id=event.chat.id, chat_id=reaction_count_chat[1])
|
||||||
|
|
Loading…
Add table
Reference in a new issue