async def pin(msg): """ Untuk pin pesan, Gunakan .pin dan balas pesannya. """ # Admin or creator check chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: await msg.edit(NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await msg.edit("`Balas pesannya untuk di pin.`") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: await msg.edit(NO_PERM) return await msg.edit("`Sukses pin pesan!`") user = await get_user_from_id(msg.from_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}", )
async def pin(msg): """ For .pin command, pins the replied/tagged message on the top the chat. """ # Admin or creator check chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: await msg.edit(NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await msg.edit("`Reply to a message to pin it.`") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: await msg.edit(NO_PERM) return await msg.edit("`Pinned Successfully!`") user = await get_user_from_id(msg.from_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}", )
async def pin(event): await event.get_chat() to_pin = event.reply_to_msg_id if not to_pin: await event.reply("`Reply to a message to pin it.`") return options = event.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await event.client(UpdatePinnedMessageRequest(event.to_id, to_pin, is_silent)) except BadRequestError: await event.reply( "I Could't Pin That Message Probably Due To Less Permissions." ) return await event.reply("Pinned This Message Sucessfully.") await get_user_sender_id(event.sender_id, event)
async def pinMessage(event, strings): tagged_message = await event.get_reply_message() if not tagged_message: await event.reply(get_string('misc', 'no_reply_msg', event.chat_id)) return msg_2_pin = tagged_message.id chk = event.pattern_match.group(1) args = chk.lower() tru_txt = ['loud', 'notify'] if args in tru_txt: silence = False else: silence = True try: await bot(UpdatePinnedMessageRequest(event.to_id, msg_2_pin, silence)) except ChatNotModifiedError: await event.reply(strings['chat_not_modified_pin']) return await event.reply(get_string('misc', 'pinned_success', event.chat_id))
async def pin(event): if event.fwd_from: return """ For .pin command, pins the replied/tagged message on the top the chat. """ chat = await event.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: poppo = await edit_or_reply(event, NO_ADMIN) return to_pin = event.reply_to_msg_id if not to_pin: poppo = await edit_or_reply(event, "`Reply to a message to pin it.`") return options = event.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await event.client( UpdatePinnedMessageRequest(event.to_id, to_pin, is_silent)) except BadRequestError: poppo = await edit_or_reply(event, NO_PERM) return h = str(event.chat_id).replace("-100", "") poppo = await edit_or_reply( event, f"I Have Pinned This [Message](http://t.me/c/{h}/{to_pin})") user = await get_user_sender_id(event.sender_id, event) if BOTLOG: await event.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {event.chat.title}(`{event.chat_id}`)\n" f"LOUD: {not is_silent}", )
async def pin(msg): # Admin or creator check chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: return await msg.edit(NO_ADMIN) to_pin = msg.reply_to_msg_id if not to_pin: return await msg.edit("`Mohon Balas Ke Pesan Untuk Melakukan Pin.`") options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: return await msg.edit(NO_PERM) await msg.edit("`Sukses Melakukan Pin!`") await sleep(2) await msg.delete() user = await get_user_from_id(msg.from_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"GRUP: {msg.chat.title}(`{msg.chat_id}`)\n" f"NOTIF: {not is_silent}", )
async def pin(msg): """ .pin komutu verildiği grupta ki yazıyı & medyayı sabitler """ # Yönetici kontrolü chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # Yönetici değil ise geri dön if not admin and not creator: await msg.edit(NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await msg.edit("`Sabitlemek için herhangi bir mesaja yanıt verin`") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except: await msg.edit(NO_PERM) return await msg.edit("`CeteBot Mesajı Başarıyla sabitledi!`") user = await get_user_from_id(msg.from_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"GRUP: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}")
async def pin(msg): """ .pin """ # chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # if not admin and not creator: await msg.edit(NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await msg.edit(LANG['NEED_MSG']) return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except: await msg.edit(NO_PERM) return await msg.edit(LANG['PINNED']) user = await get_user_from_id(msg.from_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"QRUP: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}")
async def pin(msg): if not msg.text[0].isalpha() and msg.text[0] not in ("/", "#", "@", "!"): # Admin or creator check chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: await msg.edit(NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await msg.edit("`Rispondi al messaggio che vuoi fissare.`") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: await msg.edit(NO_PERM) return await msg.edit("`Fissato!`") user = await get_user_from_id(msg.from_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}")
async def pin(msg): """For .pin command, pins the replied/tagged message on the top the chat.""" # Admin or creator check chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: return await msg.edit(NO_ADMIN) to_pin = msg.reply_to_msg_id if not to_pin: return await msg.edit("`Balas pesan untuk menyematkan!`") options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: return await msg.edit(NO_PERM) await msg.edit("`Berhasil disematkan!`") user = await get_user_from_id(msg.sender_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN : [{user.first_name}](tg://user?id={user.id})\n" f"OBROLAN : {msg.chat.title}(`{msg.chat_id}`)\n" f"KERAS : {not is_silent}", )
async def pin(msg): if msg.fwd_from: return chat = await msg.get_chat() ms_l = await bot.get_entity(msg.chat_id) admin = chat.admin_rights creator = chat.creator if not admin and not creator: await eor(msg, NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await eor(msg, "🥴 Reply to a message to pin it.") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: await eor(msg, NO_PERM) return hmm = await eor( msg, f"📌 **Pinned [this message](https://t.me/c/{ms_l.id}/{to_pin}) Successfully!**" ) user = await get_user_from_id(msg.sender_id, msg) await msg.client.send_message( lg_id, "#PIN\n" f"\nADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}", ) await sleep(3) try: await hmm.delete() except: pass
async def pinmessage(eventPinMessage): if eventPinMessage.text[0].isalpha() or eventPinMessage.text[0] in ( "/", "#", "@", "!", ): return chat = await eventPinMessage.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await eventPinMessage.edit("`I am not an admin!`") return to_pin = eventPinMessage.reply_to_msg_id if not to_pin: await eventPinMessage.edit("`Reply to a message to pin it.`") return options = eventPinMessage.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await eventPinMessage.client( UpdatePinnedMessageRequest(eventPinMessage.to_id, to_pin, is_silent)) except BadRequestError: await eventPinMessage.edit("`I don't have sufficient permissions!`") return await eventPinMessage.edit("`Pinned Successfully!`") await sleep(2) await eventPinMessage.delete() user = await get_user_from_id(eventPinMessage.from_id, eventPinMessage) if ENABLE_LOG: await eventPinMessage.client.send_message( LOGGING_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {eventPinMessage.chat.title}(`{eventPinMessage.chat_id}`)\n" f"LOUD: {not is_silent}", )
async def handler(event): if event.fwd_from: return silent = True cmd = event.pattern_match.group(0) if "ping" in cmd: return input_str = event.pattern_match.group(1) if input_str == "loud": silent = False if event.message.reply_to_msg_id is not None: message_id = event.message.reply_to_msg_id try: await client( UpdatePinnedMessageRequest(event.chat_id, message_id, silent)) except Exception as e: await event.edit(str(e)) else: await event.delete() else: await event.edit("Reply to a message to pin it.")
async def pin(msg): try: if msg.is_group: if not msg.sender_id == OWNER_ID: if not await is_register_admin(msg.input_chat, msg.sender_id): await msg.reply("Only admins can execute this command!") return else: return if not await can_pin_msg(message=msg): await msg.reply( "You are missing the following rights to use this command:CanPinMessages" ) return to_pin = msg.reply_to_msg_id if not to_pin: await msg.reply("You need to reply to a message to pin it!") return k = await msg.get_reply_message() options = msg.pattern_match.group(1) chat = f'{msg.chat_id}' lik = chat.replace("-100", "") is_silent = True if options.lower() == "loud": is_silent = False try: await tbot(UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except Exception: await msg.reply("Failed to pin.") return try: await msg.reply( f"I have pinned [this message](http://t.me/{event.chat.username}/{k.id})." ) except: pass except Exception as e: await msg.reply(f'{e}')
async def pin(event): userids = [] noob = event.sender_id async for user in tgbot.iter_participants( event.chat_id, filter=ChannelParticipantsAdmins ): userids.append(user.id) if noob not in userids: await event.reply("You're not an admin!") return """ For .pin command, pins the replied/tagged message on the top the chat. """ # Admin or creator check chat = await event.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: await event.reply("I Need Administration Permission 🤔") return to_pin = event.reply_to_msg_id if not to_pin: await event.reply("`Reply to a message to pin it.`") return options = event.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await event.client(UpdatePinnedMessageRequest(event.to_id, to_pin, is_silent)) except BadRequestError: await event.reply("No Permission 🥺") return await event.reply("`Pinned Successfully!`") user = await get_user_from_id(msg.from_id, msg)
async def pin(msg): if msg.fwd_from: return chat = await msg.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await edit_or_reply(msg, NO_ADMIN) return to_pin = msg.reply_to_msg_id if not to_pin: await edit_or_reply(msg, "Reply to a message to pin it.") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await msg.client( UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except BadRequestError: await edit_or_reply(msg, NO_PERM) return hmm = await edit_or_reply(msg, "Pinned Successfully!") user = await get_user_from_id(msg.sender_id, msg) if BOTLOG: await msg.client.send_message( BOTLOG_CHATID, "#PIN\n" f"ADMIN: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {msg.chat.title}(`{msg.chat_id}`)\n" f"LOUD: {not is_silent}", ) await sleep(3) try: await hmm.delete() except: pass
async def pin(event): userids = [] noob = event.sender_id async for user in tgbot.iter_participants( event.chat_id, filter=ChannelParticipantsAdmins): userids.append(user.id) if noob not in userids: await event.reply("Non sei admin!") return """ Con il comando .pin fissa il messaggio indicato. """ # Admin or creator check chat = await event.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: await event.reply("Devo essere amministratore 🤔") return to_pin = event.reply_to_msg_id if not to_pin: await event.reply("`Rispondi a un messaggio per fissarlo.`") return options = event.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await event.client( UpdatePinnedMessageRequest(event.to_id, to_pin, is_silent)) except BadRequestError: await event.reply("Non ho i permessi giusti 🥺") return await event.reply("`Messaggio fissato!`") user = await get_user_from_id(msg.from_id, msg)
async def pincmd(self, pint): """Команда .pin закрепляет сообщение в чате.\nИспользование: .pin <реплай>.""" if pint.chat: to_pin = pint.reply_to_msg_id is_silent = True await utils.answer(pint, self.strings('pinning', pint)) await sleep(0.1) if not to_pin: await utils.answer(pint, self.strings('pin_none', pint)) return try: await pint.client( UpdatePinnedMessageRequest(pint.to_id, to_pin, is_silent)) except: await utils.answer(pint, self.strings('no_rights', pint)) return await utils.answer(pint, self.strings('pinned', pint)) else: await utils.answer(pint, self.strings('this_isn`t_a_chat', pint))
async def pin(msg): if msg.is_group: if not msg.sender_id == OWNER_ID: if not await can_pin_msg(message=msg): return else: return previous_message = await msg.get_reply_message() k = await tbot.send_message(msg.chat_id, previous_message) to_pin = k.id if not to_pin: await msg.reply("Reply to a message which you want to pin.") return options = msg.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await tbot(UpdatePinnedMessageRequest(msg.to_id, to_pin, is_silent)) except Exception: await msg.reply("Failed to pin.") return
async def pin(event): if event.is_group: if not await can_pin_msg(message=event): return else: return previous_message = await msg.get_reply_message() k = await xbot.send_message(msg.chat_id, previous_message) to_pin = k.id if not to_pin: await event.reply("`Reply to a message to pin it.`") return options = event.pattern_match.group(1) is_silent = True if options.lower() == "loud": is_silent = False try: await xbot(UpdatePinnedMessageRequest(event.to_id, to_pin, is_silent)) except BadRequestError: await event.reply( "I Could't Pin That Message Probably Due To Less Permissions.") return await event.reply("Pinned This Message Sucessfully.") await get_user_sender_id(event.sender_id, event)