|
|
@@ -193,27 +193,21 @@ async def unban_globally(_, message):
|
|
|
@capture_err
|
|
|
async def broadcast_message(_, message):
|
|
|
sleep_time = 0.1
|
|
|
- text = message.reply_to_message.text.markdown
|
|
|
reply_message = message.reply_to_message
|
|
|
|
|
|
- reply_markup = None
|
|
|
- if reply_message.reply_markup:
|
|
|
- reply_markup = InlineKeyboardMarkup(
|
|
|
- reply_message.reply_markup.inline_keyboard
|
|
|
- )
|
|
|
sent = 0
|
|
|
schats = await get_served_chats()
|
|
|
chats = [int(chat["chat_id"]) for chat in schats]
|
|
|
m = await message.reply_text(
|
|
|
f"Broadcast in progress, will take {len(chats) * sleep_time} seconds."
|
|
|
)
|
|
|
+ to_copy = not reply_message.poll
|
|
|
for i in chats:
|
|
|
try:
|
|
|
- await app.send_message(
|
|
|
- i,
|
|
|
- text=text,
|
|
|
- reply_markup=reply_markup,
|
|
|
- )
|
|
|
+ if to_copy:
|
|
|
+ await reply_message.copy(i)
|
|
|
+ else:
|
|
|
+ await reply_message.forward(i)
|
|
|
sent += 1
|
|
|
await asyncio.sleep(sleep_time)
|
|
|
except FloodWait as e:
|
|
|
@@ -256,26 +250,19 @@ async def broadcast_message(_, message):
|
|
|
sent = 0
|
|
|
schats = await get_served_users()
|
|
|
chats = [int(chat["user_id"]) for chat in schats]
|
|
|
- text = message.reply_to_message.text.markdown
|
|
|
reply_message = message.reply_to_message
|
|
|
|
|
|
- reply_markup = None
|
|
|
- if reply_message.reply_markup:
|
|
|
- reply_markup = InlineKeyboardMarkup(
|
|
|
- reply_message.reply_markup.inline_keyboard
|
|
|
- )
|
|
|
-
|
|
|
m = await message.reply_text(
|
|
|
f"Broadcast in progress, will take {len(chats) * sleep_time} seconds."
|
|
|
)
|
|
|
|
|
|
+ to_copy = not reply_message.poll
|
|
|
for i in chats:
|
|
|
try:
|
|
|
- await app.send_message(
|
|
|
- i,
|
|
|
- text=text,
|
|
|
- reply_markup=reply_markup,
|
|
|
- )
|
|
|
+ if to_copy:
|
|
|
+ await reply_message.copy(i)
|
|
|
+ else:
|
|
|
+ await reply_message.forward(i)
|
|
|
sent += 1
|
|
|
await asyncio.sleep(sleep_time)
|
|
|
except FloodWait as e:
|