-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
owner func dir separated & read description
- Added Audio/Video/Doc support on /send cmd - Minor updates and fixes
- Loading branch information
1 parent
19680e2
commit fea4554
Showing
18 changed files
with
96 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import asyncio | ||
from telegram import Update | ||
from telegram.ext import ContextTypes | ||
from telegram.error import Forbidden | ||
from bot.helper.telegram_helper import Message | ||
from bot.functions.power_users import _power_users | ||
|
||
|
||
async def func_send(update: Update, context: ContextTypes.DEFAULT_TYPE): | ||
user = update.effective_user | ||
chat = update.effective_chat | ||
e_msg = update.effective_message | ||
re_msg = update.message.reply_to_message | ||
text = " ".join(context.args) # contains something if forward is true and contains victim_id >> /send f chat_id | ||
|
||
power_users = await _power_users() | ||
if user.id not in power_users: | ||
await Message.reply_msg(update, "Access denied!") | ||
return | ||
|
||
if chat.type != "private": | ||
await Message.reply_msg(update, f"Boss you are in public chat!") | ||
await asyncio.sleep(3) | ||
await Message.del_msgs(chat.id, [e_msg.id, e_msg.id + 1]) | ||
return | ||
|
||
if not text or not re_msg: | ||
msg = ( | ||
"Use <code>/send chat_id</code> by replying a message!\n" | ||
"<code>/send f chat_id</code> to forward the replied message to chat_id!\n" | ||
"Returns reaction on message\n" | ||
"Sent - '👍'\n" | ||
"Forbidden - '👎'\n" | ||
"Something went wrong - '⚠️'" | ||
) | ||
await Message.reply_msg(update, msg) | ||
return | ||
|
||
forward_confirm, victim_id = None, text | ||
|
||
splited_text = text.split() | ||
if len(splited_text) == 2: | ||
forward_confirm, victim_id = splited_text | ||
|
||
if forward_confirm: | ||
sent_msg = await Message.forward_msg(victim_id, chat.id, re_msg.id) | ||
else: | ||
text = re_msg.text_html | ||
photo = re_msg.photo | ||
audio = re_msg.audio | ||
video = re_msg.video | ||
document = re_msg.document | ||
caption = re_msg.caption_html | ||
|
||
# in future update | ||
# voice = e_msg.voice | ||
# video_note = e_msg.video_note | ||
|
||
if text: | ||
sent_msg = await Message.send_msg(victim_id, text) | ||
elif photo: | ||
sent_msg = await Message.send_img(victim_id, photo[-1].file_id, caption) | ||
elif audio: | ||
sent_msg = await Message.send_audio(victim_id, audio.file_id, audio.file_name, caption) | ||
elif video: | ||
sent_msg = await Message.send_vid(victim_id, video.file_id, caption=caption) | ||
elif document: | ||
sent_msg = await Message.send_doc(victim_id, document.file_id, document.file_name, caption) | ||
|
||
if not sent_msg: | ||
reaction = "⚠️" | ||
elif sent_msg == Forbidden: | ||
reaction = "👎" | ||
else: | ||
reaction = "👍" | ||
|
||
await Message.react_msg(chat.id, e_msg.id, reaction) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters