# * _ __ __ _ _ # * / \ _ _ _ __ ___ _ __ __ _| \/ | ___ __| |_ _| | ___ ___ # * / _ \| | | | '__/ _ \| '__/ _` | |\/| |/ _ \ / _` | | | | |/ _ \/ __| # * / ___ \ |_| | | | (_) | | | (_| | | | | (_) | (_| | |_| | | __/\__ \ # * /_/ \_\__,_|_| \___/|_| \__,_|_| |_|\___/ \__,_|\__,_|_|\___||___/ # * # * © Copyright 2024 # * # * https://t.me/AuroraModules # * # * 🔒 Code is licensed under GNU AGPLv3 # * 🌐 https://www.gnu.org/licenses/agpl-3.0.html # * ⛔️ You CANNOT edit this file without direct permission from the author. # * ⛔️ You CANNOT distribute this file if you have modified it without the direct permission of the author. # Name: Send # Author: Felix? # Commands: # .send | .sendclosedtopic | .sendpm | .ibsend # scope: hikka_only # meta developer: @AuroraModules # meta pic: https://i.postimg.cc/Hx3Zm8rB/logo.png # meta banner: https://te.legra.ph/file/55fa6eebae860a359ac27.jpg __version__ = (1, 3, 3) from .. import loader, utils # type: ignore from telethon.tl import types # type: ignore from telethon.tl.types import Message, InputDocument # type: ignore @loader.tds class SendMod(loader.Module): """Assistant for sending messages""" strings = { "name": "Send", "successfully_send": "✔️ Message send successfully.", "error": "Error! An error occurred:", "error_send_1": " Error! Please enter the text to send.", "error_send_2": " Error! There was no replay or the sending text is missing.", "error_send_3": " Error! Invalid user, user does not exist, or some other error occurred.", "error_send_topic_closed":" Error! It is not possible to use this command in topics.", } strings_ru = { "successfully_send": "✔️ Сообщение успешно отправленно.", "error": "Error! Произошла ошибка:", "error_send_1": " Error! Пожалуйста, введите текст для отправки.", "error_send_2": " Error! Не было ответа или отсутствует текст отправки.", "error_send_3": " Error! Неверный пользователь, пользователь не существует или произошла другая ошибка.", "error_send_topic_closed": " Error! Эту команду невозможно использовать в теме.", } strings_uz = { "successfully_send": "✔️ Xabar muvaffaqiyatli yuborildi.", "error": "Xatolik! Xatolik yuz berdi:", "error_send_1": " Xatolik! Yuborish uchun matn kiriting.", "error_send_2": " Xatolik! Javob bermagan yoki yuboriladigan matn yo'q.", "error_send_3": " Xatolik! Noto'g'ri foydalanuvchi, foydalanuvchi mavjud emas yoki boshqa xatolik ro'y berdi.", "error_send_topic_closed": " Xatolik! Bu buyruq mavzuda ishlatilmasligi mumkin.", } strings_de = { "successfully_send": "✔️ Nachricht erfolgreich gesendet.", "error": "Fehler! Ein Fehler ist aufgetreten:", "error_send_1": " Fehler! Bitte geben Sie den Text für den Versand ein.", "error_send_2": " Fehler! Es wurde keine Antwort gemacht oder es fehlt der zu sendende Text.", "error_send_3": " Fehler! Ungültiger Benutzer, Benutzer existiert nicht oder es ist ein anderer Fehler aufgetreten.", "error_send_topic_closed": " Fehler! Diese Befehl kann nicht in einem Thema verwendet werden.", } strings_es = { "successfully_send": "✔️ Mensaje enviado con éxito.", "error": "¡Error! Se produjo un error:", "error_send_1": " Error! Por favor, ingrese el texto para enviar.", "error_send_2": " Error! No se hizo una respuesta o falta el texto a enviar.", "error_send_3": " Error! Usuario no válido, usuario no existe u ocurrió algún otro error.", "error_send_topic_closed": " Error! No se puede usar este comando en un tema cerrado.", } @loader.command( ru_doc="[text] - Написать сообщение", uz_doc="[text] - xabar yozing", de_doc="[text] - Nachricht schreiben", es_doc="[text] - escribe un mensaje", ) async def send(self, message: Message): """[text] - Write a message""" if not utils.get_args_raw(message): await utils.answer(message, self.strings["error_send_1"]) elif getattr(message.to_id, 'channel_id', None) and not message.is_channel: await utils.answer(message, self.strings["error_send_topic_closed"]) else: try: response = utils.get_args_raw(message) await message.respond(response) await message.delete() except Exception as e: if "TOPIC_CLOSED" in str(e): await message.edit(self.strings["error_send_topic_closed"]) else: await message.edit(f'{self.strings["error"]} {str(e)}') # telegram fixed bug # @loader.command( # ru_doc="[text or reply(media/file/sticker) or coordinates (, )] - Написать сообщение в закрытую тему", # uz_doc="[text or reply(media/file/sticker) or coordinates (, )] - Yopiq mavzuga xabar yozing", # de_doc="[text or reply(media/file/sticker) or coordinates (, )] - Schreiben Sie eine Nachricht zu einem geschlossenen Thema", # es_doc="[text or reply(media/file/sticker) or coordinates (, )] - Escribir un mensaje a un tema cerrado", # ) # async def sendclosedtopic(self, message: Message): # """[text or reply(media/file/sticker) or coordinates (, )] - Write a message to a closed topic""" # args = utils.get_args_raw(message) # message_text = args if args else "" # reply = await message.get_reply_message() # media = None # temp_file = None # if reply and reply.media: # doc = getattr(reply.media, "document", None) # if doc and any(a.__class__.__name__ == "DocumentAttributeSticker" for a in doc.attributes): # media = InputDocument( # id=doc.id, # access_hash=doc.access_hash, # file_reference=doc.file_reference # ) # message_text = "" # elif doc and doc.mime_type == "image/webp": # temp_file = await reply.download_media() # media = temp_file # else: # media = reply.media # else: # media = message.media # if message_text and "," in message_text: # lat_str, long_str = message_text.split(",", 1) # try: # gps_x = float(lat_str.strip()) # gps_y = float(long_str.strip()) # if -90 <= gps_x <= 90 and -180 <= gps_y <= 180: # geo_point = types.InputGeoPoint(lat=gps_x, long=gps_y) # media = types.InputMediaGeoPoint(geo_point) # message_text = "" # except ValueError: # pass # if not message_text and not media: # await utils.answer(message, self.strings["error_send_2"]) # return # await message.delete() # await message.reply( # message_text, # file=media if media else None, # parse_mode="html" # ) # if temp_file: # import os # try: # os.remove(temp_file) # except: # pass @loader.command( ru_doc="[@UserName] [text or replay] - Написать сообщение в личные сообщения", uz_doc="[@UserName] [text or replay] - Shaxsiy xabarlarga xabar yozing", de_doc="[@UserName] [text or replay] - Schreiben Sie eine Nachricht zu persönlichen Nachrichten", es_doc="[@UserName] [text or replay] - Escribir un mensaje a mensajes personales.", ) async def sendpm(self, message: Message): """[@UserName] [text or replay] - Write a message to personal messages""" try: reply = await message.get_reply_message() text = utils.get_args_raw(message) user_id = str(text.split(' ')[0]) check = [] for i in text.split(' '): check.append(i) if len(check) <= 1: send = reply else: send = str(text.split(' ', maxsplit=1)[1]) if send: await message.client.send_message(user_id, send) await message.edit(self.strings["successfully_send"]) else: await message.edit(self.strings["error_send_2"]) except: await message.edit(self.strings["error_send_3"]) @loader.command( ru_doc="[text] - Отправить сообщение через инлайн-форму", uz_doc="[text] - Inline shakl orqali xabar yuboradi", de_doc="[text] - Sendet eine Nachricht über das Inline-Formular", es_doc="[text] - Envía un mensaje a través del formulario en línea", ) async def ibsend(self, message): """[text] - Send a message via the inline form""" text = utils.get_args_raw(message) await self.inline.form( message=message, text=str(text), )