├── .github └── workflows │ └── Pylint.yml ├── LICENSE ├── README.md ├── plugins ├── advice.py ├── approve.py ├── ban.py ├── bard.py ├── bots.py ├── cat.py ├── chatgpt.py ├── couple.py ├── dog.py ├── fake.py ├── figlet.py ├── filemanager.py ├── filter.py ├── font.py ├── fun.py ├── gemini.py ├── goodbye.py ├── google.py ├── group.py ├── hastag.py ├── hug.py ├── id.py ├── ig.py ├── image.py ├── info.py ├── joke.py ├── love.py ├── markdown.py ├── mongo.py ├── notes.py ├── pretender.py ├── pypi.py ├── q.py ├── qrgen.py ├── quiz.py ├── radio.py ├── slap.py ├── sticker.py ├── tagall.py ├── telegraph.py ├── thumb.py ├── truth.py ├── tts.py ├── upscale.py ├── wall.py ├── websource.py ├── welcome.py ├── whois.py ├── write.py └── zombies.py ├── requirements.txt └── utils ├── __init__.py ├── couple.py ├── error.py ├── permissions.py └── welcomedb.py /.github/workflows/Pylint.yml: -------------------------------------------------------------------------------- 1 | name: PyLint 2 | on: 3 | push: 4 | paths: 5 | - "**.py" 6 | workflow_dispatch: 7 | jobs: 8 | PEP8: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - name: Setup Python 13 | uses: actions/setup-python@v4 14 | with: 15 | python-version: "3.10.x" 16 | - name: Install libraries 17 | run: pip install autopep8 autoflake isort black 18 | - name: Check for showstoppers 19 | run: | 20 | find . -name "*.py" | xargs autopep8 --verbose --in-place --aggressive 21 | - name: Remove unused imports 22 | run: | 23 | find . -name "*.py" | xargs autoflake --in-place --remove-all-unused-imports --ignore-init-module-imports 24 | - name: Lint with black 25 | run: | 26 | black . 27 | - uses: stefanzweifel/git-auto-commit-action@v4 28 | with: 29 | commit_message: "Pylint: Auto Fixes" 30 | commit_options: "--no-verify" 31 | repository: . 32 | commit_user_name: VivekKumar-IN 33 | commit_user_email: 167422483+Vivekkumar-IN@users.noreply.github.com 34 | commit_author: VivekKumar-IN <167422483+Vivekkumar-IN@users.noreply.github.com> 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 TheTeamVivek 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Extra Plugins For [YukkiMusic](https://github.com/TheTeamVivek/YukkiMusic) 2 | 3 | 4 | ## Deployment for [YukkiMusic](https://github.com/TheTeamVivek/YukkiMusic) 5 | 6 | #### 🚀 Heroku Deployment 7 | 8 |

Click the button below to deploy Yukki Music Bot on Heroku!

9 |

If You show any error like failed to app Creation Then fork and deploy

10 | 11 | 12 | 13 | ### 🖇 VPS Deployment 14 | - Get your [Necessary Variables](https://github.com/TheTeamVivek/YukkiMusic/blob/master/sample.env) 15 | - clone repo : `git clone https://github.com/TheTeamVivek/YukkiMusic && cd YukkiMusic` 16 | - Setup by : `bash setup` 17 | - Install tmux to keep running your bot when you close the terminal by : 18 | `sudo apt install tmux && tmux` 19 | - Finally run the bot by : 20 | `python3 -m YukkiMusic` 21 | - For getting out from tmux session : Press `Ctrl+b` and then `d`
22 | 23 | 24 | # For more help checkout [YukkiMusic](https://github.com/TheTeamVivek/YukkiMusic) 25 | -------------------------------------------------------------------------------- /plugins/advice.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from TheApi import api 3 | 4 | from config import LOG_GROUP_ID 5 | from YukkiMusic import app 6 | from SafoneAPI import SafoneAPI 7 | 8 | 9 | @app.on_message(filters.command("advice")) 10 | async def advice(_, message): 11 | A = await message.reply_text("...") 12 | res = api.get_advice() 13 | await A.edit(res) 14 | 15 | 16 | @app.on_message(filters.command("astronomical")) 17 | async def advice(_, message): 18 | a = await SafoneAPI().astronomy() 19 | if a["success"]: 20 | c = a["date"] 21 | url = a["imageUrl"] 22 | b = a["explanation"] 23 | caption = f"Tᴏᴅᴀʏ's [{c}] ᴀsᴛʀᴏɴᴏᴍɪᴄᴀʟ ᴇᴠᴇɴᴛ:\n\n{b}" 24 | await message.reply_photo(url, caption=caption) 25 | else: 26 | await message.reply_photo("ᴛʀʏ ᴀғᴛᴇʀ sᴏᴍᴇ ᴛɪᴍᴇ") 27 | await app.send_message(LOG_GROUP_ID, "/astronomical not working") 28 | 29 | 30 | __MODULE__ = "Aᴅᴠɪᴄᴇ" 31 | __HELP__ = """ 32 | /advice - Gᴇᴛ ʀᴀɴᴅᴏᴍ ᴀᴅᴠɪᴄᴇ 33 | /astronomical - ᴛᴏ ɢᴇᴛ ᴛᴏᴅᴀʏ's ᴀsᴛʀᴏɴᴏᴍɪᴄᴀʟ ғᴀᴄᴛ""" 34 | -------------------------------------------------------------------------------- /plugins/approve.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2024 by TheTeamVivek@Github, < https://github.com/TheTeamVivek >. 3 | # 4 | # This file is part of < https://github.com/TheTeamVivek/YukkiMusic > project, 5 | # and is released under the "GNU v3.0 License Agreement". 6 | # Please see < https://github.com/TheTeamVivek/YukkiMusic/blob/master/LICENSE > 7 | # 8 | # All rights reserved. 9 | # 10 | 11 | from pyrogram import filters 12 | from pyrogram.enums import ChatMembersFilter 13 | from pyrogram.types import ChatJoinRequest 14 | from pyrogram.errors.exceptions.bad_request_400 import UserAlreadyParticipant 15 | from YukkiMusic import app 16 | from YukkiMusic.core.mongo import mongodb 17 | from YukkiMusic.misc import SUDOERS 18 | from YukkiMusic.utils.keyboard import ikb 19 | from utils.permissions import adminsOnly, member_permissions 20 | 21 | approvaldb = mongodb.autoapprove 22 | 23 | 24 | def smallcap(text): 25 | trans_table = str.maketrans( 26 | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 27 | "ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢABCDEFGHIJKLMNOPQRSTUVWXYZ0𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿", 28 | ) 29 | return text.translate(trans_table) 30 | 31 | 32 | @app.on_message(filters.command("autoapprove") & filters.group) 33 | @adminsOnly("can_change_info") 34 | async def approval_command(client, message): 35 | chat_id = message.chat.id 36 | chat = await approvaldb.find_one({"chat_id": chat_id}) 37 | if chat: 38 | mode = chat.get("mode", "") 39 | if not mode: 40 | mode = "manual" 41 | await approvaldb.update_one( 42 | {"chat_id": chat_id}, 43 | {"$set": {"mode": mode}}, 44 | upsert=True, 45 | ) 46 | if mode == "automatic": 47 | switch = "manual" 48 | mdbutton = "ᴀᴜᴛᴏᴍᴀᴛɪᴄ" 49 | else: 50 | switch = "automatic" 51 | mdbutton = "ᴍᴀɴɴᴜᴀʟ" 52 | buttons = { 53 | "Tᴜʀɴ ᴏғғ": "approval_off", 54 | f"{mdbutton}": f"approval_{switch}", 55 | } 56 | keyboard = ikb(buttons, 1) 57 | await message.reply( 58 | "**Aᴜᴛᴏᴀᴘᴘʀᴏᴠᴀʟ ғᴏʀ ᴛʜɪs ᴄʜᴀᴛ: Eɴᴀʙʟᴇᴅ.**", reply_markup=keyboard 59 | ) 60 | else: 61 | buttons = {"Tᴜʀɴ ᴏɴ ": "approval_on"} 62 | keyboard = ikb(buttons, 1) 63 | await message.reply( 64 | "**Aᴜᴛᴏᴀᴘᴘʀᴏᴠᴀʟ ғᴏʀ ᴛʜɪs ᴄʜᴀᴛ: Dɪsᴀʙʟᴇᴅ.**", reply_markup=keyboard 65 | ) 66 | 67 | 68 | @app.on_callback_query(filters.regex("approval(.*)")) 69 | async def approval_cb(client, cb): 70 | chat_id = cb.message.chat.id 71 | from_user = cb.from_user 72 | permissions = await member_permissions(chat_id, from_user.id) 73 | permission = "can_restrict_members" 74 | if permission not in permissions: 75 | if from_user.id not in SUDOERS: 76 | return await cb.answer( 77 | f"You don't have the required permission.\n Permission: {permission}", 78 | show_alert=True, 79 | ) 80 | command_parts = cb.data.split("_", 1) 81 | option = command_parts[1] 82 | if option == "off": 83 | if await approvaldb.count_documents({"chat_id": chat_id}) > 0: 84 | approvaldb.delete_one({"chat_id": chat_id}) 85 | buttons = {"ᴛᴜʀɴ ᴏɴ": "approval_on"} 86 | keyboard = ikb(buttons, 1) 87 | return await cb.edit_message_text( 88 | "**Aᴜᴛᴏᴀᴘᴘʀᴏᴠᴀʟ ғᴏʀ ᴛʜɪs ᴄʜᴀᴛ: Dɪsᴀʙʟᴇᴅ.**", 89 | reply_markup=keyboard, 90 | ) 91 | if option == "on": 92 | switch = "manual" 93 | mode = "automatic" 94 | if option == "automatic": 95 | switch = "manual" 96 | mode = option 97 | if option == "manual": 98 | switch = "automatic" 99 | mode = option 100 | await approvaldb.update_one( 101 | {"chat_id": chat_id}, 102 | {"$set": {"mode": mode}}, 103 | upsert=True, 104 | ) 105 | chat = await approvaldb.find_one({"chat_id": chat_id}) 106 | mode = smallcap(chat["mode"]) 107 | buttons = {"ᴛᴜʀɴ ᴏғғ": "approval_off", f"{mode}": f"approval_{switch}"} 108 | keyboard = ikb(buttons, 1) 109 | await cb.edit_message_text( 110 | "**Aᴜᴛᴏᴀᴘᴘʀᴏᴠᴀʟ ғᴏʀ ᴛʜɪs ᴄʜᴀᴛ: Eɴᴀʙʟᴇᴅ.**", reply_markup=keyboard 111 | ) 112 | 113 | 114 | @app.on_message(filters.command("approveall") & filters.group) 115 | @adminsOnly("can_restrict_members") 116 | async def clear_pending_command(client, message): 117 | if message.command[0] == approveall: 118 | a = await message.reply_text("ᴡᴀɪᴛ.....") 119 | chat_id = message.chat.id 120 | await app.approve_all_chat_join_requests(chat_id) 121 | await a.edit("ɪғ ᴀɴʏ ᴜsᴇʀ ᴀʀᴇ ᴡᴀɪᴛɪɴɢ ғᴏʀ ᴀᴘᴘʀᴏᴠᴇᴅ sᴏ ɪ ᴀᴍ ᴀᴘᴘʀᴏᴠᴇᴅ ʜɪᴍ") 122 | await approvaldb.update_one( 123 | {"chat_id": chat_id}, 124 | {"$set": {"pending_users": []}}, 125 | ) 126 | 127 | 128 | @app.on_message(filters.command("clearpending") & filters.group) 129 | @adminsOnly("can_restrict_members") 130 | async def clear_pending_command(client, message): 131 | chat_id = message.chat.id 132 | result = await approvaldb.update_one( 133 | {"chat_id": chat_id}, 134 | {"$set": {"pending_users": []}}, 135 | ) 136 | if result.modified_count > 0: 137 | await message.reply_text("Cleared pending users.") 138 | else: 139 | await message.reply_text("No pending users to clear.") 140 | 141 | 142 | @app.on_chat_join_request(filters.group) 143 | async def accept(client, message: ChatJoinRequest): 144 | chat = message.chat 145 | user = message.from_user 146 | chat_id = await approvaldb.find_one({"chat_id": chat.id}) 147 | if chat_id: 148 | mode = chat_id["mode"] 149 | if mode == "automatic": 150 | await app.approve_chat_join_request(chat_id=chat.id, user_id=user.id) 151 | return 152 | if mode == "manual": 153 | is_user_in_pending = await approvaldb.count_documents( 154 | {"chat_id": chat.id, "pending_users": int(user.id)} 155 | ) 156 | if is_user_in_pending == 0: 157 | await approvaldb.update_one( 158 | {"chat_id": chat.id}, 159 | {"$addToSet": {"pending_users": int(user.id)}}, 160 | upsert=True, 161 | ) 162 | buttons = { 163 | "ᴀᴄᴄᴇᴘᴛ": f"manual_approve_{user.id}", 164 | "ᴅᴇᴄʟɪɴᴇ": f"manual_decline_{user.id}", 165 | } 166 | keyboard = ikb(buttons, int(2)) 167 | text = f"**ᴜsᴇʀ: {user.mention} ʜᴀs sᴇɴᴅ ᴀ ʀᴇǫᴜᴇsᴛ ᴛᴏ ᴊᴏɪɴ ᴏᴜʀ ɢʀᴏᴜᴘ. Aɴʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴀᴄᴄᴇᴘᴛ ᴏʀ ᴅᴇᴄʟɪɴᴇ ɪᴛ.**" 168 | admin_data = [ 169 | i 170 | async for i in app.get_chat_members( 171 | chat_id=message.chat.id, 172 | filter=ChatMembersFilter.ADMINISTRATORS, 173 | ) 174 | ] 175 | for admin in admin_data: 176 | if admin.user.is_bot or admin.user.is_deleted: 177 | continue 178 | text += f"[\u2063](tg://user?id={admin.user.id})" 179 | return await app.send_message(chat.id, text, reply_markup=keyboard) 180 | 181 | 182 | @app.on_callback_query(filters.regex("manual_(.*)")) 183 | async def manual(app, cb): 184 | chat = cb.message.chat 185 | from_user = cb.from_user 186 | permissions = await member_permissions(chat.id, from_user.id) 187 | permission = "can_restrict_members" 188 | if permission not in permissions: 189 | if from_user.id not in SUDOERS: 190 | return await cb.answer( 191 | f"You don't have the required permission.\n Permission: {permission}", 192 | show_alert=True, 193 | ) 194 | datas = cb.data.split("_", 2) 195 | dis = datas[1] 196 | id = datas[2] 197 | if dis == "approve": 198 | try: 199 | await app.approve_chat_join_request(chat_id=chat.id, user_id=id) 200 | except UserAlreadyParticipant: 201 | await cb.answer( 202 | "Usᴇʀ Is Aᴘᴘʀᴏᴠᴇᴅ ɪɴ Yᴏᴜʀ Gʀᴏᴜᴘ Bʏ AɴʏOɴᴇ", 203 | show_alert=True, 204 | ) 205 | return await cb.message.delete() 206 | 207 | if dis == "decline": 208 | try: 209 | await app.decline_chat_join_request(chat_id=chat.id, user_id=id) 210 | except Exception as e: 211 | if "messages.HideChatJoinRequest" in str(e): 212 | await cb.answer( 213 | "Usᴇʀ Is Aᴘᴘʀᴏᴠᴇᴅ ɪɴ Yᴏᴜʀ Gʀᴏᴜᴘ Bʏ AɴʏOɴᴇ", 214 | show_alert=True, 215 | ) 216 | 217 | await approvaldb.update_one( 218 | {"chat_id": chat.id}, 219 | {"$pull": {"pending_users": int(id)}}, 220 | ) 221 | return await cb.message.delete() 222 | 223 | 224 | __MODULE__ = "Aᴘᴘʀᴏᴠᴇ" 225 | __HELP__ = """ 226 | command: /autoapprove 227 | 228 | Tʜɪs ᴍᴏᴅᴜʟᴇ ʜᴇʟᴘs ᴛᴏ ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ᴀᴄᴄᴇᴘᴛ ᴄʜᴀᴛ ɪᴏɪɴ ʀᴇǫᴜᴇsᴛ sᴇɴᴅ ʙʏ ᴀ ᴜsᴇʀ ᴛʜʀᴏᴜɢʜ ɪɴᴠɪᴛᴀᴛɪᴏɴ ʟɪɴᴋ ᴏғ ʏᴏᴜʀ ɢʀᴏᴜᴘ 229 | 230 | **Mᴏᴅᴇs:** 231 | ᴡʜᴇɴ ʏᴏᴜ sᴇɴᴅ /autoapprove ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ ʏᴏᴜ sᴇᴇ ᴛᴜʀɴ ᴏɴ ʙᴜᴛᴛᴏɴ ɪғ ᴀᴜᴛᴛᴏᴘʀᴏᴠᴇ ɴᴏᴛ ᴇɴᴀʙʟᴇᴅ ғᴏʀ ʏᴏᴜʀ ᴄʜᴀᴛ ɪғ ᴀʟʀᴇᴅʏ ᴛᴜʀɴᴇᴅ ᴏɴ ʏᴏᴜ ᴡɪʟʟ sᴇ ᴛᴡᴏ ᴍᴏᴅᴇs ᴛʜᴀᴛ's ᴀʀᴇ ʙᴇʟᴏᴡ ᴀɴᴅ ʜɪs ᴜsᴀsɢᴇ 232 | 233 | 234 | ¤ Automatic - ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ᴀᴄᴄᴇᴘᴛs ᴄʜᴀᴛ ᴊᴏɪɴ ʀᴇǫᴜᴇsᴛ. 235 | 236 | ¤ Manual - ᴀ ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ sᴇɴᴅ ᴛᴏ ᴛʜᴇ ᴄʜᴀᴛ ʙʏ ᴛᴀɢɢɪɴɢ ᴛʜᴇ ᴀᴅᴍɪɴs. ᴛʜᴇ ᴀᴅᴍɪɴs ᴄᴀɴ ᴀᴄᴄᴇᴘᴛ ᴏʀ ᴅᴇᴄʟɪɴᴇ ᴛʜᴇ ʀᴇǫᴜᴇsᴛs. 237 | 238 | Usᴇ: /clearpending ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ʀᴇᴍᴏᴠᴇ ᴀʟʟ ᴘᴇɴᴅɪɴɢ ᴜsᴇʀ ɪᴅ ғʀᴏᴍ ᴅʙ. ᴛʜɪs ᴡɪʟʟ ᴀʟʟᴏᴡ ᴛʜᴇ ᴜsᴇʀ ᴛᴏ sᴇɴᴅ ʀᴇǫᴜᴇsᴛ ᴀɢᴀɪɴ. 239 | """ 240 | -------------------------------------------------------------------------------- /plugins/bard.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | 4 | from YukkiMusic import app 5 | from SafoneAPI import SafoneAPI 6 | 7 | 8 | @app.on_message(filters.command(["bard"])) 9 | async def bard(bot, message): 10 | if len(message.command) < 2 and not message.reply_to_message: 11 | await message.reply_text( 12 | "Example:\n\n`/bard tell me about lord rama and sita in brief `" 13 | ) 14 | return 15 | 16 | if message.reply_to_message and message.reply_to_message.text: 17 | user_input = message.reply_to_message.text 18 | else: 19 | user_input = " ".join(message.command[1:]) 20 | 21 | try: 22 | Z = await SafoneAPI().bard(user_input) 23 | result = Z["candidates"][0]["content"]["parts"][0]["text"] 24 | await message.reply_text(result) 25 | except requests.exceptions.RequestException as e: 26 | pass 27 | -------------------------------------------------------------------------------- /plugins/bots.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import enums, filters 4 | from pyrogram.errors import FloodWait 5 | 6 | from YukkiMusic import app 7 | 8 | 9 | @app.on_message(filters.command("bots") & filters.group) 10 | async def bots(client, message): 11 | 12 | try: 13 | botList = [] 14 | async for bot in app.get_chat_members( 15 | message.chat.id, filter=enums.ChatMembersFilter.BOTS 16 | ): 17 | botList.append(bot.user) 18 | lenBotList = len(botList) 19 | text3 = f"**ʙᴏᴛ ʟɪsᴛ - {message.chat.title}**\n\n🤖 ʙᴏᴛs\n" 20 | while len(botList) > 1: 21 | bot = botList.pop(0) 22 | text3 += f"├ @{bot.username}\n" 23 | else: 24 | bot = botList.pop(0) 25 | text3 += f"└ @{bot.username}\n\n" 26 | text3 += f"**ᴛᴏᴛᴀʟ ɴᴜᴍʙᴇʀ ᴏғ ʙᴏᴛs**: {lenBotList}**" 27 | await app.send_message(message.chat.id, text3) 28 | except FloodWait as e: 29 | await asyncio.sleep(e.value) 30 | 31 | 32 | __MODULE__ = "Bᴏᴛs" 33 | __HELP__ = """ 34 | **ʙᴏᴛs** 35 | 36 | • /bots - ɢᴇᴛ ᴀ ʟɪsᴛ ᴏғ ʙᴏᴛs ɪɴ ᴛʜᴇ ɢʀᴏᴜᴘ. 37 | """ 38 | -------------------------------------------------------------------------------- /plugins/cat.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | from pyrogram.types import ( 4 | CallbackQuery, 5 | InlineKeyboardButton, 6 | InlineKeyboardMarkup, 7 | InputMediaPhoto, 8 | Message, 9 | ) 10 | 11 | from config import BANNED_USERS 12 | from YukkiMusic import app 13 | 14 | close_keyboard = InlineKeyboardMarkup( 15 | [ 16 | [InlineKeyboardButton(text="Rᴇғʀᴇsʜ", callback_data="refresh_cat")], 17 | [InlineKeyboardButton(text="〆 ᴄʟᴏsᴇ 〆", callback_data="close")], 18 | ] 19 | ) 20 | 21 | 22 | @app.on_message(filters.command("cat") & ~BANNED_USERS) 23 | async def cat(c, m: Message): 24 | r = requests.get("https://api.thecatapi.com/v1/images/search") 25 | if r.status_code == 200: 26 | data = r.json() 27 | cat_url = data[0]["url"] 28 | if cat_url.endswith(".gif"): 29 | await m.reply_animation( 30 | cat_url, caption="meow", reply_markup=close_keyboard 31 | ) 32 | else: 33 | await m.reply_photo(cat_url, caption="meow", reply_markup=close_keyboard) 34 | else: 35 | await m.reply_text("Failed to fetch cat picture 🙀") 36 | 37 | 38 | @app.on_callback_query(filters.regex("refresh_cat") & ~BANNED_USERS) 39 | async def refresh_cat(c, m: CallbackQuery): 40 | r = requests.get("https://api.thecatapi.com/v1/images/search") 41 | if r.status_code == 200: 42 | data = r.json() 43 | cat_url = data[0]["url"] 44 | if cat_url.endswith(".gif"): 45 | await m.edit_message_animation( 46 | cat_url, caption="meow", reply_markup=close_keyboard 47 | ) 48 | else: 49 | await m.edit_message_media( 50 | InputMediaPhoto(media=cat_url, caption="meow"), 51 | reply_markup=close_keyboard, 52 | ) 53 | else: 54 | await m.edit_message_text("Failed to refresh cat picture 🙀") 55 | -------------------------------------------------------------------------------- /plugins/chatgpt.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from pyrogram.enums import ChatAction 3 | from TheApi import api 4 | 5 | from YukkiMusic import app 6 | from config import BANNED_USERS 7 | 8 | 9 | @app.on_message(filters.command(["chatgpt", "ai", "ask"]) & ~BANNED_USERS) 10 | async def chatgpt_chat(bot, message): 11 | if len(message.command) < 2 and not message.reply_to_message: 12 | await message.reply_text( 13 | "Example:\n\n`/ai write simple website code using html css, js?`" 14 | ) 15 | return 16 | 17 | if message.reply_to_message and message.reply_to_message.text: 18 | user_input = message.reply_to_message.text 19 | else: 20 | user_input = " ".join(message.command[1:]) 21 | 22 | await bot.send_chat_action(message.chat.id, ChatAction.TYPING) 23 | results = api.chatgpt(user_input) 24 | await message.reply_text(results) 25 | 26 | 27 | __MODULE__ = "CʜᴀᴛGᴘᴛ" 28 | __HELP__ = """ 29 | /advice - ɢᴇᴛ ʀᴀɴᴅᴏᴍ ᴀᴅᴠɪᴄᴇ ʙʏ ʙᴏᴛ 30 | /ai [ǫᴜᴇʀʏ] - ᴀsᴋ ʏᴏᴜʀ ǫᴜᴇsᴛɪᴏɴ ᴡɪᴛʜ ᴄʜᴀᴛɢᴘᴛ's ᴀɪ 31 | /gemini [ǫᴜᴇʀʏ] - ᴀsᴋ ʏᴏᴜʀ ǫᴜᴇsᴛɪᴏɴ ᴡɪᴛʜ ɢᴏᴏɢʟᴇ's ɢᴇᴍɪɴɪ ᴀɪ 32 | /bard [ǫᴜᴇʀʏ] -ᴀsᴋ ʏᴏᴜʀ ǫᴜᴇsᴛɪᴏɴ ᴡɪᴛʜ ɢᴏᴏɢʟᴇ's ʙᴀʀᴅ ᴀɪ""" 33 | -------------------------------------------------------------------------------- /plugins/couple.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime, timedelta 2 | import pytz 3 | import os 4 | import random 5 | from pyrogram import filters 6 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 7 | from pyrogram.enums import ChatType 8 | from telegraph import upload_file 9 | from PIL import Image, ImageDraw 10 | import requests 11 | 12 | from utils import get_image, get_couple, save_couple 13 | from YukkiMusic import app 14 | 15 | 16 | # get current date in GMT+5:30 timezone 17 | def get_today_date(): 18 | timezone = pytz.timezone("Asia/Kolkata") 19 | now = datetime.now(timezone) 20 | return now.strftime("%d/%m/%Y") 21 | 22 | 23 | # get tomorrow's date in GMT+5:30 timezone 24 | 25 | 26 | def get_todmorrow_date(): 27 | timezone = pytz.timezone("Asia/Kolkata") 28 | tomorrow = datetime.now(timezone) + timedelta(days=1) 29 | return tomorrow.strftime("%d/%m/%Y") 30 | 31 | 32 | # Download image from URL 33 | 34 | 35 | def download_image(url, path): 36 | response = requests.get(url) 37 | if response.status_code == 200: 38 | with open(path, "wb") as f: 39 | f.write(response.content) 40 | return path 41 | 42 | 43 | # Dates 44 | tomorrow = get_todmorrow_date() 45 | today = get_today_date() 46 | 47 | 48 | @app.on_message(filters.command(["couple", "couples"])) 49 | async def ctest(_, message): 50 | cid = message.chat.id 51 | if message.chat.type == ChatType.PRIVATE: 52 | return await message.reply_text("Tʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ᴡᴏʀᴋs ɪɴ ɢʀᴏᴜᴘs.") 53 | 54 | p1_path = "downloads/pfp.png" 55 | p2_path = "downloads/pfp1.png" 56 | test_image_path = f"downloads/test_{cid}.png" 57 | cppic_path = "downloads/cppic.png" 58 | 59 | try: 60 | is_selected = await get_couple(cid, today) 61 | if not is_selected: 62 | msg = await message.reply_text("❣️") 63 | list_of_users = [] 64 | 65 | async for i in app.get_chat_members(message.chat.id, limit=50): 66 | if not i.user.is_bot and not i.user.is_deleted: 67 | list_of_users.append(i.user.id) 68 | 69 | c1_id = random.choice(list_of_users) 70 | c2_id = random.choice(list_of_users) 71 | while c1_id == c2_id: 72 | c1_id = random.choice(list_of_users) 73 | 74 | photo1 = (await app.get_chat(c1_id)).photo 75 | photo2 = (await app.get_chat(c2_id)).photo 76 | 77 | N1 = (await app.get_users(c1_id)).mention 78 | N2 = (await app.get_users(c2_id)).mention 79 | 80 | try: 81 | p1 = await app.download_media(photo1.big_file_id, file_name=p1_path) 82 | except Exception: 83 | p1 = download_image( 84 | "https://telegra.ph/file/05aa686cf52fc666184bf.jpg", p1_path 85 | ) 86 | try: 87 | p2 = await app.download_media(photo2.big_file_id, file_name=p2_path) 88 | except Exception: 89 | p2 = download_image( 90 | "https://telegra.ph/file/05aa686cf52fc666184bf.jpg", p2_path 91 | ) 92 | 93 | img1 = Image.open(p1) 94 | img2 = Image.open(p2) 95 | 96 | background_image_path = download_image( 97 | "https://telegra.ph/file/96f36504f149e5680741a.jpg", cppic_path 98 | ) 99 | img = Image.open(background_image_path) 100 | 101 | img1 = img1.resize((437, 437)) 102 | img2 = img2.resize((437, 437)) 103 | 104 | mask = Image.new("L", img1.size, 0) 105 | draw = ImageDraw.Draw(mask) 106 | draw.ellipse((0, 0) + img1.size, fill=255) 107 | 108 | mask1 = Image.new("L", img2.size, 0) 109 | draw = ImageDraw.Draw(mask1) 110 | draw.ellipse((0, 0) + img2.size, fill=255) 111 | 112 | img1.putalpha(mask) 113 | img2.putalpha(mask1) 114 | 115 | draw = ImageDraw.Draw(img) 116 | 117 | img.paste(img1, (116, 160), img1) 118 | img.paste(img2, (789, 160), img2) 119 | 120 | img.save(test_image_path) 121 | 122 | TXT = f""" 123 | **Tᴏᴅᴀʏ's ᴄᴏᴜᴘʟᴇ ᴏғ ᴛʜᴇ ᴅᴀʏ: 124 | 125 | {N1} + {N2} = 💚 126 | 127 | Nᴇxᴛ ᴄᴏᴜᴘʟᴇs ᴡɪʟʟ ʙᴇ sᴇʟᴇᴄᴛᴇᴅ ᴏɴ {tomorrow}!!** 128 | """ 129 | 130 | await message.reply_photo( 131 | test_image_path, 132 | caption=TXT, 133 | reply_markup=InlineKeyboardMarkup( 134 | [ 135 | [ 136 | InlineKeyboardButton( 137 | text="Aᴅᴅ ᴍᴇ 🌋", 138 | url=f"https://t.me/{app.username}?startgroup=true", 139 | ) 140 | ] 141 | ] 142 | ), 143 | ) 144 | 145 | await msg.delete() 146 | a = upload_file(test_image_path) 147 | for x in a: 148 | img_url = "https://graph.org/" + x 149 | couple = {"c1_id": c1_id, "c2_id": c2_id} 150 | await save_couple(cid, today, couple, img_url) 151 | 152 | else: 153 | msg = await message.reply_text("❣️") 154 | b = await get_image(cid) 155 | c1_id = int(is_selected["c1_id"]) 156 | c2_id = int(is_selected["c2_id"]) 157 | c1_name = (await app.get_users(c1_id)).first_name 158 | c2_name = (await app.get_users(c2_id)).first_name 159 | 160 | TXT = f""" 161 | **Tᴏᴅᴀʏ's ᴄᴏᴜᴘʟᴇ ᴏғ ᴛʜᴇ ᴅᴀʏ 🎉: 162 | 163 | [{c1_name}](tg://openmessage?user_id={c1_id}) + [{c2_name}](tg://openmessage?user_id={c2_id}) = ❣️ 164 | 165 | Nᴇxᴛ ᴄᴏᴜᴘʟᴇs ᴡɪʟʟ ʙᴇ sᴇʟᴇᴄᴛᴇᴅ ᴏɴ {tomorrow}!!** 166 | """ 167 | await message.reply_photo( 168 | b, 169 | caption=TXT, 170 | reply_markup=InlineKeyboardMarkup( 171 | [ 172 | [ 173 | InlineKeyboardButton( 174 | text="Aᴅᴅ ᴍᴇ🌋", 175 | url=f"https://t.me/{app.username}?startgroup=true", 176 | ) 177 | ] 178 | ] 179 | ), 180 | ) 181 | await msg.delete() 182 | 183 | except Exception as e: 184 | print(str(e)) 185 | finally: 186 | try: 187 | os.remove(p1_path) 188 | os.remove(p2_path) 189 | os.remove(test_image_path) 190 | os.remove(cppic_path) 191 | except Exception as cleanup_error: 192 | print(f"Error during cleanup: {cleanup_error}") 193 | -------------------------------------------------------------------------------- /plugins/dog.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | from pyrogram.types import ( 4 | CallbackQuery, 5 | InlineKeyboardButton, 6 | InlineKeyboardMarkup, 7 | InputMediaPhoto, 8 | Message, 9 | ) 10 | 11 | from config import BANNED_USERS 12 | from YukkiMusic import app 13 | 14 | close_keyboard = InlineKeyboardMarkup( 15 | [ 16 | [InlineKeyboardButton(text="Rᴇғʀᴇsʜ", callback_data="refresh_dog")], 17 | [InlineKeyboardButton(text="〆 ᴄʟᴏsᴇ 〆", callback_data="close")], 18 | ] 19 | ) 20 | 21 | 22 | @app.on_message(filters.command(["dogs", "dog"]) & ~BANNED_USERS) 23 | async def dog(c, m: Message): 24 | r = requests.get("https://random.dog/woof.json") 25 | if r.status_code == 200: 26 | data = r.json() 27 | dog_url = data["url"] 28 | if dog_url.endswith(".gif"): 29 | await m.reply_animation(dog_url, reply_markup=close_keyboard) 30 | else: 31 | await m.reply_photo(dog_url, reply_markup=close_keyboard) 32 | else: 33 | await m.reply_text("Failed to fetch dog picture 🐕") 34 | 35 | 36 | @app.on_callback_query(filters.regex("refresh_dog") & ~BANNED_USERS) 37 | async def refresh_dog(c, m: CallbackQuery): 38 | r = requests.get("https://random.dog/woof.json") 39 | if r.status_code == 200: 40 | data = r.json() 41 | dog_url = data["url"] 42 | if dog_url.endswith(".gif"): 43 | await m.edit_message_animation(dog_url, reply_markup=close_keyboard) 44 | else: 45 | await m.edit_message_media( 46 | InputMediaPhoto(media=dog_url), 47 | reply_markup=close_keyboard, 48 | ) 49 | else: 50 | await m.edit_message_text("Failed to refresh dog picture 🐕") 51 | -------------------------------------------------------------------------------- /plugins/fake.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | 4 | from YukkiMusic import app 5 | 6 | 7 | @app.on_message(filters.command(["FAKE", "fake"])) 8 | async def fkadress(_, message): 9 | query = message.text.split(maxsplit=1)[1].strip() 10 | url = f"https://randomuser.me/api/?nat={query}" 11 | response = requests.get(url) 12 | data = response.json() 13 | 14 | if "results" in data: 15 | fk = data["results"][0] 16 | 17 | name = f"{fk['name']['title']} {fk['name']['first']} {fk['name']['last']}" 18 | address = ( 19 | f"{fk['location']['street']['number']} {fk['location']['street']['name']}" 20 | ) 21 | city = fk["location"]["city"] 22 | state = fk["location"]["state"] 23 | country = fk["location"]["country"] 24 | postal = fk["location"]["postcode"] 25 | email = fk["email"] 26 | phone = fk["phone"] 27 | picture = fk["picture"]["large"] 28 | gender = fk["gender"] 29 | 30 | fkinfo = f""" 31 | **ɴᴀᴍᴇ** ⇢ `{name}` 32 | **ɢᴇɴᴅᴇʀ** ⇢ `{gender}` 33 | **ᴀᴅᴅʀᴇss** ⇢ `{address}` 34 | **ᴄᴏᴜɴᴛʀʏ** ⇢ `{country}` 35 | **ᴄɪᴛʏ** ⇢ `{city}` 36 | **ɢᴇɴᴅᴇʀ** ⇢ `{gender}` 37 | **sᴛᴀᴛᴇ** ⇢ `{state}` 38 | **ᴘᴏsᴛᴀʟ** ⇢ `{postal}` 39 | **ᴇᴍᴀɪʟ** ⇢ `{email}` 40 | **ᴘʜᴏɴᴇ** ⇢ `{phone}` 41 | 42 | """ 43 | 44 | await message.reply_photo(photo=picture, caption=fkinfo) 45 | else: 46 | await message.reply_text("ᴏᴏᴘs ɴᴏᴛ ғᴏᴜɴᴅ ᴀɴʏ ᴀᴅᴅʀᴇss.\nᴛʀʏ ᴀɢᴀɪɴ") 47 | 48 | 49 | __MODULE__ = "Fᴀᴋᴇ" 50 | __HELP__ = """ 51 | 52 | /fake [ᴄᴏᴜɴᴛʀʏ ɴᴀᴍᴇ ] - ᴛᴏ ɢᴇᴛ ʀᴀɴᴅᴏᴍ ᴀᴅᴅʀᴇss""" 53 | -------------------------------------------------------------------------------- /plugins/figlet.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from random import choice 3 | from pyrogram.errors import FloodWait 4 | 5 | import pyfiglet 6 | from pyrogram import filters 7 | from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup 8 | 9 | from YukkiMusic import app 10 | 11 | 12 | def figle(text): 13 | x = pyfiglet.FigletFont.getFonts() 14 | font = choice(x) 15 | figled = str(pyfiglet.figlet_format(text, font=font)) 16 | keyboard = InlineKeyboardMarkup( 17 | [ 18 | [ 19 | InlineKeyboardButton(text="ᴄʜᴀɴɢᴇ", callback_data="figlet"), 20 | InlineKeyboardButton(text="ᴄʟᴏsᴇ", callback_data="close_reply"), 21 | ] 22 | ] 23 | ) 24 | return figled, keyboard 25 | 26 | 27 | @app.on_message(filters.command("figlet")) 28 | async def echo(bot, message): 29 | global text 30 | try: 31 | text = message.text.split(" ", 1)[1] 32 | except IndexError: 33 | return await message.reply_text("Example:\n\n`/figlet Yukki `") 34 | kul_text, keyboard = figle(text) 35 | await message.reply_text( 36 | f"ʜᴇʀᴇ ɪs ʏᴏᴜʀ ғɪɢʟᴇᴛ :\n
{kul_text}
", 37 | quote=True, 38 | reply_markup=keyboard, 39 | ) 40 | 41 | 42 | @app.on_callback_query(filters.regex("figlet")) 43 | async def figlet_handler(Client, query: CallbackQuery): 44 | try: 45 | kul_text, keyboard = figle(text) 46 | await query.message.edit_text( 47 | f"ʜᴇʀᴇ ɪs ʏᴏᴜʀ ғɪɢʟᴇᴛ :\n
{kul_text}
", reply_markup=keyboard 48 | ) 49 | except FloodWait as e: 50 | await asyncio.sleep(e.value) 51 | 52 | except Exception as e: 53 | return await query.answer(e, show_alert=True) 54 | 55 | 56 | __MODULE__ = "Fɪɢʟᴇᴛ" 57 | __HELP__ = """ 58 | **ғɪɢʟᴇᴛ** 59 | 60 | • /figlet - ᴄʀᴇᴀᴛᴇs ᴀ ғɪɢʟᴇᴛ ᴏғ ᴛʜᴇ ɢɪᴠᴇɴ ᴛᴇxᴛ. 61 | """ 62 | -------------------------------------------------------------------------------- /plugins/filemanager.py: -------------------------------------------------------------------------------- 1 | import io 2 | import os 3 | import os.path 4 | import time 5 | from inspect import getfullargspec 6 | from os.path import exists, isdir 7 | 8 | from pyrogram import filters 9 | from pyrogram.types import Message 10 | 11 | from YukkiMusic import app 12 | from YukkiMusic.misc import SUDOERS 13 | from utils.error import capture_err 14 | 15 | MAX_MESSAGE_SIZE_LIMIT = 4095 16 | 17 | 18 | @app.on_message(filters.command("ls") & ~filters.forwarded & ~filters.via_bot & SUDOERS) 19 | @capture_err 20 | async def lst(_, message): 21 | prefix = message.text.split()[0][0] 22 | chat_id = message.chat.id 23 | path = os.getcwd() 24 | text = message.text.split(" ", 1) 25 | directory = None 26 | if len(text) > 1: 27 | directory = text[1].strip() 28 | path = directory 29 | if not exists(path): 30 | await eor( 31 | message, 32 | text=f"There is no such directory or file with the name `{directory}` check again!", 33 | ) 34 | return 35 | if isdir(path): 36 | if directory: 37 | msg = "Folders and Files in `{}` :\n\n".format(path) 38 | lists = os.listdir(path) 39 | else: 40 | msg = "Folders and Files in Current Directory :\n\n" 41 | lists = os.listdir(path) 42 | files = "" 43 | folders = "" 44 | for contents in sorted(lists): 45 | thepathoflight = path + "/" + contents 46 | if not isdir(thepathoflight): 47 | size = os.stat(thepathoflight).st_size 48 | if contents.endswith((".mp3", ".flac", ".wav", ".m4a")): 49 | files += "🎵 " + f"`{contents}`\n" 50 | if contents.endswith((".opus")): 51 | files += "🎙 " + f"`{contents}`\n" 52 | elif contents.endswith( 53 | (".mkv", ".mp4", ".webm", ".avi", ".mov", ".flv") 54 | ): 55 | files += "🎞 " + f"`{contents}`\n" 56 | elif contents.endswith( 57 | (".zip", ".tar", ".tar.gz", ".rar", ".7z", ".xz") 58 | ): 59 | files += "🗜 " + f"`{contents}`\n" 60 | elif contents.endswith( 61 | (".jpg", ".jpeg", ".png", ".gif", ".bmp", ".ico", ". webp") 62 | ): 63 | files += "🖼 " + f"`{contents}`\n" 64 | elif contents.endswith((".exe", ".deb")): 65 | files += "⚙️ " + f"`{contents}`\n" 66 | elif contents.endswith((".iso", ".img")): 67 | files += "💿 " + f"`{contents}`\n" 68 | elif contents.endswith((".apk", ".xapk")): 69 | files += "📱 " + f"`{contents}`\n" 70 | elif contents.endswith((".py")): 71 | files += "🐍 " + f"`{contents}`\n" 72 | else: 73 | files += "📄 " + f"`{contents}`\n" 74 | else: 75 | folders += f"📁 `{contents}`\n" 76 | if files or folders: 77 | msg = msg + folders + files 78 | else: 79 | msg = msg + "__empty path__" 80 | else: 81 | size = os.stat(path).st_size 82 | msg = "The details of given file :\n\n" 83 | if path.endswith((".mp3", ".flac", ".wav", ".m4a")): 84 | mode = "🎵 " 85 | if path.endswith((".opus")): 86 | mode = "🎙 " 87 | elif path.endswith((".mkv", ".mp4", ".webm", ".avi", ".mov", ".flv")): 88 | mode = "🎞 " 89 | elif path.endswith((".zip", ".tar", ".tar.gz", ".rar", ".7z", ".xz")): 90 | mode = "🗜 " 91 | elif path.endswith((".jpg", ".jpeg", ".png", ".gif", ".bmp", ".ico", ". webp")): 92 | mode = "🖼 " 93 | elif path.endswith((".exe", ".deb")): 94 | mode = "⚙️ " 95 | elif path.endswith((".iso", ".img")): 96 | mode = "💿 " 97 | elif path.endswith((".apk", ".xapk")): 98 | mode = "📱 " 99 | elif path.endswith((".py")): 100 | mode = "🐍 " 101 | else: 102 | mode = "📄 " 103 | time.ctime(os.path.getctime(path)) 104 | time2 = time.ctime(os.path.getmtime(path)) 105 | time3 = time.ctime(os.path.getatime(path)) 106 | msg += f"**Location :** `{path}`\n" 107 | msg += f"**Icon :** `{mode}`\n" 108 | msg += f"**Size :** `{humanbytes(size)}`\n" 109 | msg += f"**Last Modified Time:** `{time2}`\n" 110 | msg += f"**Last Accessed Time:** `{time3}`" 111 | 112 | if len(msg) > MAX_MESSAGE_SIZE_LIMIT: 113 | with io.BytesIO(str.encode(msg)) as out_file: 114 | out_file.name = "ls.txt" 115 | await app.send_document( 116 | chat_id, 117 | out_file, 118 | caption=path, 119 | ) 120 | await message.delete() 121 | else: 122 | await eor(message, text=msg) 123 | 124 | 125 | @app.on_message(filters.command("rm") & ~filters.forwarded & ~filters.via_bot & SUDOERS) 126 | @capture_err 127 | async def rm_file(client, message): 128 | if len(message.command) < 2: 129 | return await eor(message, text="Please provide a file name to delete.") 130 | file = message.text.split(" ", 1)[1] 131 | if exists(file): 132 | os.remove(file) 133 | await eor(message, text=f"{file} has been deleted.") 134 | else: 135 | await eor(message, text=f"{file} doesn't exist!") 136 | 137 | 138 | async def eor(msg: Message, **kwargs): 139 | func = ( 140 | (msg.edit_text if msg.from_user.is_self else msg.reply) 141 | if msg.from_user 142 | else msg.reply 143 | ) 144 | spec = getfullargspec(func.__wrapped__).args 145 | return await func(**{k: v for k, v in kwargs.items() if k in spec}) 146 | -------------------------------------------------------------------------------- /plugins/filter.py: -------------------------------------------------------------------------------- 1 | import re 2 | import datetime 3 | from pyrogram import filters 4 | from pyrogram.types import ( 5 | InlineKeyboardButton, 6 | InlineKeyboardMarkup, 7 | ) 8 | 9 | from YukkiMusic import app 10 | from utils.error import capture_err 11 | from utils.permissions import adminsOnly, member_permissions 12 | from YukkiMusic.utils.keyboard import ikb 13 | from .notes import extract_urls 14 | from YukkiMusic.utils.functions import ( 15 | check_format, 16 | extract_text_and_keyb, 17 | get_data_and_name, 18 | ) 19 | from YukkiMusic.utils.database import ( 20 | deleteall_filters, 21 | get_filter, 22 | get_filters_names, 23 | save_filter, 24 | ) 25 | 26 | from config import BANNED_USERS 27 | 28 | 29 | __MODULE__ = "Filters" 30 | __HELP__ = """/filters To Get All The Filters In The Chat. 31 | /filter [FILTER_NAME] To Save A Filter(reply to a message). 32 | 33 | Supported filter types are Text, Animation, Photo, Document, Video, video notes, Audio, Voice. 34 | 35 | To use more words in a filter use. 36 | `/filter Hey_there` To filter "Hey there". 37 | 38 | /stop [FILTER_NAME] To Stop A Filter. 39 | /stopall To delete all the filters in a chat (permanently). 40 | 41 | You can use markdown or html to save text too. 42 | 43 | Checkout /markdownhelp to know more about formattings and other syntax. 44 | """ 45 | 46 | 47 | @app.on_message(filters.command("filter") & ~filters.private & ~BANNED_USERS) 48 | @adminsOnly("can_change_info") 49 | async def save_filters(_, message): 50 | try: 51 | if len(message.command) < 2: 52 | return await message.reply_text( 53 | "**ᴜsᴀsɢᴇ:**\nʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴡɪᴛʜ /filter [FILTER_NAME] [CONTENT] ᴛᴏ sᴇᴛ ᴀ ɴᴇᴡ ғɪʟᴛᴇʀ." 54 | ) 55 | replied_message = message.reply_to_message 56 | if not replied_message: 57 | replied_message = message 58 | data, name = await get_data_and_name(replied_message, message) 59 | if len(name) < 2: 60 | return await message.reply_text( 61 | f"ᴛᴏ ғɪʟᴛᴇʀ ᴛʜᴇ {name} ᴍᴜsᴛ ʙᴇ ɢʀᴇᴀᴛᴇʀ ᴛʜᴇɴ 𝟸 ᴡᴏʀᴅs" 62 | ) 63 | if data == "error": 64 | return await message.reply_text( 65 | "**ᴜsᴀsɢᴇ:**\n__/filter [FILTER_NAME] [CONTENT]__\n`-----------OR-----------`\nʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴡɪᴛʜ. \n/filter [FILTER_NAME]." 66 | ) 67 | if replied_message.text: 68 | _type = "text" 69 | file_id = None 70 | if replied_message.sticker: 71 | _type = "sticker" 72 | file_id = replied_message.sticker.file_id 73 | if replied_message.animation: 74 | _type = "animation" 75 | file_id = replied_message.animation.file_id 76 | if replied_message.photo: 77 | _type = "photo" 78 | file_id = replied_message.photo.file_id 79 | if replied_message.document: 80 | _type = "document" 81 | file_id = replied_message.document.file_id 82 | if replied_message.video: 83 | _type = "video" 84 | file_id = replied_message.video.file_id 85 | if replied_message.video_note: 86 | _type = "video_note" 87 | file_id = replied_message.video_note.file_id 88 | if replied_message.audio: 89 | _type = "audio" 90 | file_id = replied_message.audio.file_id 91 | if replied_message.voice: 92 | _type = "voice" 93 | file_id = replied_message.voice.file_id 94 | if replied_message.reply_markup and not re.findall(r"\[.+\,.+\]", data): 95 | urls = extract_urls(replied_message.reply_markup) 96 | if urls: 97 | response = "\n".join( 98 | [f"{name}=[{text}, {url}]" for name, text, url in urls] 99 | ) 100 | data = data + response 101 | if data: 102 | data = await check_format(ikb, data) 103 | if not data: 104 | return await message.reply_text( 105 | "**ᴡʀᴏɴɢ ғᴏʀᴍᴀᴛᴛɪɴɢ, ᴄʜᴇᴄᴋ ᴛʜᴇ ʜᴇʟᴘ sᴇᴄᴛɪᴏɴ.**" 106 | ) 107 | name = name.replace("_", " ") 108 | _filter = { 109 | "type": _type, 110 | "data": data, 111 | "file_id": file_id, 112 | } 113 | 114 | chat_id = message.chat.id 115 | await save_filter(chat_id, name, _filter) 116 | return await message.reply_text(f"__**sᴀᴠᴇᴅ ғɪʟᴛᴇʀ {name}.**__") 117 | except UnboundLocalError: 118 | return await message.reply_text( 119 | "**ʀᴇᴘʟɪᴇᴅ ᴍᴇssᴀɢᴇ ɪs ɪɴᴀᴄᴇssᴀʙʟᴇ.\n`ғᴏʀᴡᴀʀᴅ ᴛʜᴇ ᴍᴇssᴀɢᴇ ᴀɴᴅ ᴛʀʏ ᴀɢᴀɪɴ.`**" 120 | ) 121 | 122 | 123 | @app.on_message(filters.command("filters") & ~filters.private & ~BANNED_USERS) 124 | @capture_err 125 | async def get_filterss(_, message): 126 | _filters = await get_filters_names(message.chat.id) 127 | if not _filters: 128 | return await message.reply_text("**ɴᴏ ғɪʟᴛᴇʀs ɪɴ ᴛʜᴇ ᴄʜᴀᴛ.**") 129 | _filters.sort() 130 | msg = f"ʟɪsᴛ ᴏғ ғɪʟᴛᴇʀs ɪɴ ᴛʜᴇ **{message.chat.title}** :\n" 131 | for _filter in _filters: 132 | msg += f"**-** `{_filter}`\n" 133 | await message.reply_text(msg) 134 | 135 | 136 | @app.on_message( 137 | filters.text 138 | & ~filters.private 139 | & ~filters.channel 140 | & ~filters.via_bot 141 | & ~filters.forwarded 142 | & ~BANNED_USERS, 143 | group=1, 144 | ) 145 | @capture_err 146 | async def filters_re(_, message): 147 | from_user = message.from_user if message.from_user else message.sender_chat 148 | user_id = from_user.id 149 | chat_id = message.chat.id 150 | text = message.text.lower().strip() 151 | if not text: 152 | return 153 | chat_id = message.chat.id 154 | list_of_filters = await get_filters_names(chat_id) 155 | for word in list_of_filters: 156 | pattern = r"( |^|[^\w])" + re.escape(word) + r"( |$|[^\w])" 157 | if re.search(pattern, text, flags=re.IGNORECASE): 158 | _filter = await get_filter(chat_id, word) 159 | data_type = _filter["type"] 160 | data = _filter["data"] 161 | file_id = _filter.get("file_id") 162 | keyb = None 163 | if data: 164 | if "{app.mention}" in data: 165 | data = data.replace("{app.mention}", app.mention) 166 | if "{GROUPNAME}" in data: 167 | data = data.replace("{GROUPNAME}", message.chat.title) 168 | if "{NAME}" in data: 169 | data = data.replace("{NAME}", message.from_user.mention) 170 | if "{ID}" in data: 171 | data = data.replace("{ID}", f"`message.from_user.id`") 172 | if "{FIRSTNAME}" in data: 173 | data = data.replace("{FIRSTNAME}", message.from_user.first_name) 174 | if "{SURNAME}" in data: 175 | sname = message.from_user.last_name or "None" 176 | data = data.replace("{SURNAME}", sname) 177 | if "{USERNAME}" in data: 178 | susername = message.from_user.username or "None" 179 | data = data.replace("{USERNAME}", susername) 180 | if "{DATE}" in data: 181 | DATE = datetime.datetime.now().strftime("%Y-%m-%d") 182 | data = data.replace("{DATE}", DATE) 183 | if "{WEEKDAY}" in data: 184 | WEEKDAY = datetime.datetime.now().strftime("%A") 185 | data = data.replace("{WEEKDAY}", WEEKDAY) 186 | if "{TIME}" in data: 187 | TIME = datetime.datetime.now().strftime("%H:%M:%S") 188 | data = data.replace("{TIME}", f"{TIME} UTC") 189 | 190 | if re.findall(r"\[.+\,.+\]", data): 191 | keyboard = extract_text_and_keyb(ikb, data) 192 | if keyboard: 193 | data, keyb = keyboard 194 | replied_message = message.reply_to_message 195 | if replied_message: 196 | replied_user = ( 197 | replied_message.from_user 198 | if replied_message.from_user 199 | else replied_message.sender_chat 200 | ) 201 | if text.startswith("~"): 202 | await message.delete() 203 | if replied_user.id != from_user.id: 204 | message = replied_message 205 | 206 | if data_type == "text": 207 | await message.reply_text( 208 | text=data, 209 | reply_markup=keyb, 210 | disable_web_page_preview=True, 211 | ) 212 | else: 213 | if not file_id: 214 | continue 215 | if data_type == "sticker": 216 | await message.reply_sticker( 217 | sticker=file_id, 218 | ) 219 | if data_type == "animation": 220 | await message.reply_animation( 221 | animation=file_id, 222 | caption=data, 223 | reply_markup=keyb, 224 | ) 225 | if data_type == "photo": 226 | await message.reply_photo( 227 | photo=file_id, 228 | caption=data, 229 | reply_markup=keyb, 230 | ) 231 | if data_type == "document": 232 | await message.reply_document( 233 | document=file_id, 234 | caption=data, 235 | reply_markup=keyb, 236 | ) 237 | if data_type == "video": 238 | await message.reply_video( 239 | video=file_id, 240 | caption=data, 241 | reply_markup=keyb, 242 | ) 243 | if data_type == "video_note": 244 | await message.reply_video_note( 245 | video_note=file_id, 246 | ) 247 | if data_type == "audio": 248 | await message.reply_audio( 249 | audio=file_id, 250 | caption=data, 251 | reply_markup=keyb, 252 | ) 253 | if data_type == "voice": 254 | await message.reply_voice( 255 | voice=file_id, 256 | caption=data, 257 | reply_markup=keyb, 258 | ) 259 | return # NOTE: Avoid filter spam 260 | 261 | 262 | @app.on_message(filters.command("stopall") & ~filters.private & ~BANNED_USERS) 263 | @adminsOnly("can_change_info") 264 | async def stop_all(_, message): 265 | _filters = await get_filters_names(message.chat.id) 266 | if not _filters: 267 | await message.reply_text("**ɴᴏ ғɪʟᴛᴇʀs ɪɴ ᴛʜɪs ᴄʜᴀᴛ.**") 268 | else: 269 | keyboard = InlineKeyboardMarkup( 270 | [ 271 | [ 272 | InlineKeyboardButton("ʏᴇs, ᴅᴏ ɪᴛ", callback_data="stop_yes"), 273 | InlineKeyboardButton("ɴᴏ, ᴅᴏɴ'ᴛ ᴅᴏ ɪᴛ", callback_data="stop_no"), 274 | ] 275 | ] 276 | ) 277 | await message.reply_text( 278 | "**ᴀʀᴇ ʏᴏᴜ sᴜʀᴇ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀʟʟ ᴛʜᴇ ғɪʟᴛᴇʀs ɪɴ ᴛʜɪs ᴄʜᴀᴛ ғᴏʀᴇᴠᴇʀ ?.**", 279 | reply_markup=keyboard, 280 | ) 281 | 282 | 283 | @app.on_callback_query(filters.regex("stop_(.*)") & ~BANNED_USERS) 284 | async def stop_all_cb(_, cb): 285 | chat_id = cb.message.chat.id 286 | from_user = cb.from_user 287 | permissions = await member_permissions(chat_id, from_user.id) 288 | permission = "can_change_info" 289 | if permission not in permissions: 290 | return await cb.answer( 291 | f"ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴛʜᴇ ʀᴇᴄǫᴜʀɪᴇᴅ ᴘᴇʀᴍɪssɪᴏɴ.\n ᴘᴇʀᴍɪssɪᴏɴ: {permission}", 292 | show_alert=True, 293 | ) 294 | input = cb.data.split("_", 1)[1] 295 | if input == "yes": 296 | stoped_all = await deleteall_filters(chat_id) 297 | if stoped_all: 298 | return await cb.message.edit( 299 | "**sᴜᴄᴇssғᴜʟʟʏ ᴅᴇʟᴇᴅᴇᴅ ᴀʟʟ ғɪʟᴛᴇʀ's ᴏɴ ᴛʜɪs ᴄʜᴀᴛ.**" 300 | ) 301 | if input == "no": 302 | await cb.message.reply_to_message.delete() 303 | await cb.message.delete() 304 | -------------------------------------------------------------------------------- /plugins/fun.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | from pyrogram.types import Message 4 | 5 | from YukkiMusic import app 6 | 7 | 8 | @app.on_message( 9 | filters.command( 10 | [ 11 | "dice", 12 | "ludo", 13 | "dart", 14 | "basket", 15 | "basketball", 16 | "football", 17 | "slot", 18 | "bowling", 19 | "jackpot", 20 | ] 21 | ) 22 | ) 23 | async def dice(c, m: Message): 24 | command = m.text.split()[0] 25 | if command == "/dice" or command == "/ludo": 26 | 27 | value = await c.send_dice(m.chat.id, reply_to_message_id=m.id) 28 | await value.reply_text("ʏᴏᴜʀ sᴄᴏʀᴇ ɪs {0}".format(value.dice.value)) 29 | 30 | elif command == "/dart": 31 | 32 | value = await c.send_dice(m.chat.id, emoji="🎯", reply_to_message_id=m.id) 33 | await value.reply_text("ʏᴏᴜʀ sᴄᴏʀᴇ ɪs {0}".format(value.dice.value)) 34 | 35 | elif command == "/basket" or command == "/basketball": 36 | basket = await c.send_dice(m.chat.id, emoji="🏀", reply_to_message_id=m.id) 37 | await basket.reply_text("ʏᴏᴜʀ sᴄᴏʀᴇ ɪs {0}".format(basket.dice.value)) 38 | 39 | elif command == "/football": 40 | value = await c.send_dice(m.chat.id, emoji="⚽", reply_to_message_id=m.id) 41 | await value.reply_text("ʏᴏᴜʀ sᴄᴏʀᴇ ɪs {0}".format(value.dice.value)) 42 | 43 | elif command == "/slot" or command == "/jackpot": 44 | value = await c.send_dice(m.chat.id, emoji="🎰", reply_to_message_id=m.id) 45 | await value.reply_text("ʏᴏᴜʀ sᴄᴏʀᴇ ɪs {0}".format(value.dice.value)) 46 | elif command == "/bowling": 47 | value = await c.send_dice(m.chat.id, emoji="🎳", reply_to_message_id=m.id) 48 | await value.reply_text("ʏᴏᴜʀ sᴄᴏʀᴇ ɪs {0}".format(value.dice.value)) 49 | 50 | 51 | bored_api_url = "https://apis.scrimba.com/bored/api/activity" 52 | 53 | 54 | @app.on_message(filters.command("bored", prefixes="/")) 55 | async def bored_command(client, message): 56 | response = requests.get(bored_api_url) 57 | if response.status_code == 200: 58 | data = response.json() 59 | activity = data.get("activity") 60 | if activity: 61 | await message.reply(f"𝗙𝗲𝗲𝗹𝗶𝗻𝗴 𝗯𝗼𝗿𝗲𝗱? 𝗛𝗼𝘄 𝗮𝗯𝗼𝘂𝘁:\n\n {activity}") 62 | else: 63 | await message.reply("Nᴏ ᴀᴄᴛɪᴠɪᴛʏ ғᴏᴜɴᴅ.") 64 | else: 65 | await message.reply("Fᴀɪʟᴇᴅ ᴛᴏ ғᴇᴛᴄʜ ᴀᴄᴛɪᴠɪᴛʏ.") 66 | 67 | 68 | __MODULE__ = "Fᴜɴ" 69 | __HELP__ = """ 70 | **ʜᴀᴠɪɴɢ ꜰᴜɴ:** 71 | 72 | • `/dice`: Rᴏʟʟs ᴀ ᴅɪᴄᴇ. 73 | • `/ludo`: Pʟᴀʏ Lᴜᴅᴏ. 74 | • `/dart`: Tʜʀᴏᴡs ᴀ ᴅᴀʀᴛ. 75 | • `/basket` ᴏʀ `/basketball`: Pʟᴀʏs ʙᴀsᴋᴇᴛʙᴀʟʟ. 76 | • `/football`: Pʟᴀʏs ғᴏᴏᴛʙᴀʟʟ. 77 | • `/slot` ᴏʀ `/jackpot`: Pʟᴀʏs ᴊᴀᴄᴋᴘᴏᴛ. 78 | • `/bowling`: Pʟᴀʏs ʙᴏᴡʟɪɴɢ. 79 | • `/bored`: Gᴇᴛs ʀᴀɴᴅᴏᴍ ᴀᴄᴛɪᴠɪᴛʏ ɪғ ʏᴏᴜ'ʀᴇ ʙᴏʀᴇᴅ. 80 | """ 81 | -------------------------------------------------------------------------------- /plugins/gemini.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from MukeshAPI import api 3 | from pyrogram import filters 4 | from pyrogram.enums import ChatAction 5 | from YukkiMusic import app 6 | 7 | 8 | @app.on_message(filters.command(["gemini"])) 9 | async def gemini_handler(client, message): 10 | await app.send_chat_action(message.chat.id, ChatAction.TYPING) 11 | if ( 12 | message.text.startswith(f"/gemini@{app.username}") 13 | and len(message.text.split(" ", 1)) > 1 14 | ): 15 | user_input = message.text.split(" ", 1)[1] 16 | elif message.reply_to_message and message.reply_to_message.text: 17 | user_input = message.reply_to_message.text 18 | else: 19 | if len(message.command) > 1: 20 | user_input = " ".join(message.command[1:]) 21 | else: 22 | await message.reply_text("ᴇxᴀᴍᴘʟᴇ :- `/gemini who is lord ram`") 23 | return 24 | 25 | try: 26 | response = api.gemini(user_input) 27 | await app.send_chat_action(message.chat.id, ChatAction.TYPING) 28 | x = response["results"] 29 | if x: 30 | await message.reply_text(x, quote=True) 31 | else: 32 | await message.reply_text("sᴏʀʀʏ sɪʀ! ᴘʟᴇᴀsᴇ Tʀʏ ᴀɢᴀɪɴ") 33 | except requests.exceptions.RequestException as e: 34 | pass 35 | -------------------------------------------------------------------------------- /plugins/goodbye.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from re import findall 3 | 4 | from pyrogram import filters 5 | from pyrogram.errors import ChatAdminRequired 6 | from pyrogram.types import ( 7 | Chat, 8 | InlineKeyboardButton, 9 | InlineKeyboardMarkup, 10 | Message, 11 | ) 12 | from YukkiMusic import app 13 | from YukkiMusic.misc import SUDOERS 14 | from .notes import extract_urls 15 | from YukkiMusic.utils.database import is_gbanned_user 16 | from utils import ( 17 | del_goodbye, 18 | get_goodbye, 19 | set_goodbye, 20 | is_greetings_on, 21 | set_greetings_on, 22 | set_greetings_off, 23 | ) 24 | from utils.error import capture_err 25 | from YukkiMusic.utils.functions import check_format, extract_text_and_keyb 26 | from YukkiMusic.utils.keyboard import ikb 27 | from utils.permissions import adminsOnly 28 | 29 | 30 | async def handle_left_member(member, chat): 31 | 32 | try: 33 | if member.id in SUDOERS: 34 | return 35 | if await is_gbanned_user(member.id): 36 | await chat.ban_member(member.id) 37 | await app.send_message( 38 | chat.id, 39 | f"{member.mention} ᴡᴀs ɢʟᴏʙᴀʟʟʏ ʙᴀɴɴᴇᴅ, ᴀɴᴅ ɢᴏᴛ ʀᴇᴍᴏᴠᴇᴅ," 40 | + " ɪғ ʏᴏᴜ ᴛʜɪɴᴋ ᴛʜɪs ɪs ᴀ ғᴀʟsᴇ ɢʙᴀɴ, ʏᴏᴜ ᴄᴀɴ ᴀᴘᴘᴇᴀʟ" 41 | + " ғᴏʀ ᴛʜɪs ʙᴀɴ ɪɴ sᴜᴘᴘᴏʀᴛ ᴄʜᴀᴛ", 42 | ) 43 | return 44 | if member.is_bot: 45 | return 46 | return await send_left_message(chat, member.id) 47 | 48 | except ChatAdminRequired: 49 | return 50 | 51 | 52 | @app.on_message(filters.left_chat_member & filters.group, group=6) 53 | @capture_err 54 | async def goodbye(_, m: Message): 55 | if m.from_user: 56 | member = await app.get_users(m.from_user.id) 57 | chat = m.chat 58 | return await handle_left_member(member, chat) 59 | 60 | 61 | async def send_left_message(chat: Chat, user_id: int, delete: bool = False): 62 | is_on = await is_greetings_on(chat.id, "goodbye") 63 | 64 | if not is_on: 65 | return 66 | 67 | goodbye, raw_text, file_id = await get_goodbye(chat.id) 68 | 69 | if not raw_text: 70 | return 71 | 72 | text = raw_text 73 | keyb = None 74 | 75 | if findall(r"\[.+\,.+\]", raw_text): 76 | text, keyb = extract_text_and_keyb(ikb, raw_text) 77 | 78 | u = await app.get_users(user_id) 79 | 80 | replacements = { 81 | "{NAME}": u.mention, 82 | "{ID}": f"`{user_id}`", 83 | "{FIRSTNAME}": u.first_name, 84 | "{GROUPNAME}": chat.title, 85 | "{SURNAME}": u.last_name or "None", 86 | "{USERNAME}": u.username or "None", 87 | "{DATE}": datetime.datetime.now().strftime("%Y-%m-%d"), 88 | "{WEEKDAY}": datetime.datetime.now().strftime("%A"), 89 | "{TIME}": datetime.datetime.now().strftime("%H:%M:%S") + " UTC", 90 | } 91 | 92 | for placeholder, value in replacements.items(): 93 | if placeholder in text: 94 | text = text.replace(placeholder, value) 95 | 96 | if goodbye == "Text": 97 | m = await app.send_message( 98 | chat.id, 99 | text=text, 100 | reply_markup=keyb, 101 | disable_web_page_preview=True, 102 | ) 103 | elif goodbye == "Photo": 104 | m = await app.send_photo( 105 | chat.id, 106 | photo=file_id, 107 | caption=text, 108 | reply_markup=keyb, 109 | ) 110 | else: 111 | m = await app.send_animation( 112 | chat.id, 113 | animation=file_id, 114 | caption=text, 115 | reply_markup=keyb, 116 | ) 117 | 118 | 119 | @app.on_message(filters.command("setgoodbye") & ~filters.private) 120 | @adminsOnly("can_change_info") 121 | async def set_goodbye_func(_, message): 122 | usage = "Yᴏᴜ ɴᴇᴇᴅ ᴛᴏ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴛᴇxᴛ, ɢɪғ ᴏʀ ᴘʜᴏᴛᴏ ᴛᴏ sᴇᴛ ɪᴛ ᴀs ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ.\n\nᴏᴛᴇs: ᴄᴀᴘᴛɪᴏɴ ʀᴇǫᴜɪʀᴇᴅ ғᴏʀ ɢɪғ ᴀɴᴅ ᴘʜᴏᴛᴏ." 123 | key = InlineKeyboardMarkup( 124 | [ 125 | [ 126 | InlineKeyboardButton( 127 | text="More Help", 128 | url=f"t.me/{app.username}?start=greetings", 129 | ) 130 | ], 131 | ] 132 | ) 133 | replied_message = message.reply_to_message 134 | chat_id = message.chat.id 135 | try: 136 | if not replied_message: 137 | await message.reply_text(usage, reply_markup=key) 138 | return 139 | if replied_message.animation: 140 | goodbye = "Animation" 141 | file_id = replied_message.animation.file_id 142 | text = replied_message.caption 143 | if not text: 144 | return await message.reply_text(usage, reply_markup=key) 145 | raw_text = text.markdown 146 | if replied_message.photo: 147 | goodbye = "Photo" 148 | file_id = replied_message.photo.file_id 149 | text = replied_message.caption 150 | if not text: 151 | return await message.reply_text(usage, reply_markup=key) 152 | raw_text = text.markdown 153 | if replied_message.text: 154 | goodbye = "Text" 155 | file_id = None 156 | text = replied_message.text 157 | raw_text = text.markdown 158 | if replied_message.reply_markup and not findall(r"\[.+\,.+\]", raw_text): 159 | urls = extract_urls(replied_message.reply_markup) 160 | if urls: 161 | response = "\n".join( 162 | [f"{name}=[{text}, {url}]" for name, text, url in urls] 163 | ) 164 | raw_text = raw_text + response 165 | raw_text = await check_format(ikb, raw_text) 166 | if raw_text: 167 | await set_goodbye(chat_id, goodbye, raw_text, file_id) 168 | return await message.reply_text( 169 | "ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ ʜᴀs ʙᴇᴇɴ sᴜᴄᴄᴇssғᴜʟʟʏ sᴇᴛ." 170 | ) 171 | else: 172 | return await message.reply_text( 173 | "Wʀᴏɴɢ ғᴏʀᴍᴀᴛᴛɪɴɢ, ᴄʜᴇᴄᴋ ᴛʜᴇ ʜᴇʟᴘ sᴇᴄᴛɪᴏɴ.\n\n**Usᴀsɢᴇ:**\nTᴛᴇxᴛ: `Text`\nᴛᴇxᴛ + ʙᴜᴛᴛᴏɴs: `Text ~ Buttons`", 174 | reply_markup=key, 175 | ) 176 | except UnboundLocalError: 177 | return await message.reply_text( 178 | "**Oɴʟʏ Tᴇxᴛ, Gɪғ ᴀɴᴅ Pʜᴏᴛᴏ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ ᴀʀᴇ sᴜᴘᴘᴏʀᴛᴇᴅ.**" 179 | ) 180 | 181 | 182 | @app.on_message(filters.command(["delgoodbye", "deletegoodbye"]) & ~filters.private) 183 | @adminsOnly("can_change_info") 184 | async def del_goodbye_func(_, message): 185 | chat_id = message.chat.id 186 | await del_goodbye(chat_id) 187 | await message.reply_text("Gᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ ʜᴀs ʙᴇᴇɴ Dᴇʟᴇᴛᴇᴅ Sᴜᴄᴄᴇssғᴜʟʟʏ") 188 | 189 | 190 | @app.on_message(filters.command("goodbye") & ~filters.private) 191 | @adminsOnly("can_change_info") 192 | async def goodbye(client, message: Message): 193 | command = message.text.split() 194 | 195 | if len(command) == 1: 196 | return await get_goodbye_func(client, message) 197 | 198 | if len(command) == 2: 199 | action = command[1].lower() 200 | if action in ["on", "enable", "y", "yes", "true", "t"]: 201 | success = await set_greetings_on(message.chat.id, "goodbye") 202 | if success: 203 | await message.reply_text( 204 | "I'ʟʟ ʙᴇ sᴀʏɪɴɢ ɢᴏᴏᴅʙʏᴇ ᴛᴏ ᴀɴʏ ʟᴇᴀᴠᴇʀs ғʀᴏᴍ ɴᴏᴡ ᴏɴ!" 205 | ) 206 | else: 207 | await message.reply_text("Fᴀɪʟᴇᴅ ᴛᴏ ᴇɴᴀʙʟᴇ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs.") 208 | 209 | elif action in ["off", "disable", "n", "no", "false", "f"]: 210 | success = await set_greetings_off(message.chat.id, "goodbye") 211 | if success: 212 | await message.reply_text("I'ʟʟ sᴛᴀʏ ǫᴜɪᴇᴛ ᴡʜᴇɴ ᴘᴇᴏᴘʟᴇ ʟᴇᴀᴠᴇ.") 213 | else: 214 | await message.reply_text("Fᴀɪʟᴇᴅ ᴛᴏ ᴅɪsᴀʙʟᴇ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs.") 215 | 216 | else: 217 | await message.reply_text( 218 | "Iɴᴠᴀʟɪᴅ ᴄᴏᴍᴍᴀɴᴅ. Pʟᴇᴀsᴇ ᴜsᴇ:\n" 219 | "/goodbye - Tᴏ ɢᴇᴛ ʏᴏᴜʀ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ\n" 220 | "/goodbye [on, y, true, enable, t] - ᴛᴏ ᴛᴜʀɴ ᴏɴ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs\n" 221 | "/goodbye [off, n, false, disable, f, no] - ᴛᴏ ᴛᴜʀɴ ᴏғғ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs\n" 222 | "/delgoodbye ᴏʀ /deletegoodbye ᴛᴏ ᴅᴇʟᴛᴇ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ ᴀɴᴅ ᴛᴜʀɴ ᴏғғ ɢᴏᴏᴅʙʏᴇ" 223 | ) 224 | else: 225 | await message.reply_text( 226 | "Iɴᴠᴀʟɪᴅ ᴄᴏᴍᴍᴀɴᴅ. Pʟᴇᴀsᴇ ᴜsᴇ:\n" 227 | "/goodbye - Tᴏ ɢᴇᴛ ʏᴏᴜʀ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ\n" 228 | "/goodbye [on, y, true, enable, t] - ᴛᴏ ᴛᴜʀɴ ᴏɴ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs\n" 229 | "/goodbye [off, n, false, disable, f, no] - ᴛᴏ ᴛᴜʀɴ ᴏғғ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs\n" 230 | "/delgoodbye ᴏʀ /deletegoodbye ᴛᴏ ᴅᴇʟᴛᴇ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ ᴀɴᴅ ᴛᴜʀɴ ᴏғғ ɢᴏᴏᴅʙʏᴇ" 231 | ) 232 | 233 | 234 | async def get_goodbye_func(_, message): 235 | chat = message.chat 236 | goodbye, raw_text, file_id = await get_goodbye(chat.id) 237 | if not raw_text: 238 | return await message.reply_text( 239 | "Dɪᴅ Yᴏᴜ ʀᴇᴍᴇᴍʙᴇʀ ᴛʜᴀᴛ ʏᴏᴜ ʜᴀᴠᴇ sᴇᴛ's ᴀɴᴛ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ" 240 | ) 241 | if not message.from_user: 242 | return await message.reply_text("Yᴏᴜ'ʀᴇ ᴀɴᴏɴ, ᴄᴀɴ'ᴛ sᴇɴᴅ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ.") 243 | 244 | await send_left_message(chat, message.from_user.id) 245 | is_grt = await is_greetings_on(chat.id, "goodbye") 246 | text = None 247 | if is_grt: 248 | text = "Tʀᴜᴇ" 249 | else: 250 | text = "Fᴀʟsᴇ" 251 | await message.reply_text( 252 | f'I ᴀᴍ ᴄᴜʀʀᴇɴᴛʟʏ sᴀʏɪɴɢ ɢᴏᴏᴅʙʏᴇ ᴛᴏ ᴜsᴇʀs :- {text}\nGᴏᴏᴅʙʏᴇ: {goodbye}\n\nғɪʟᴇ_ɪᴅ: `{file_id}`\n\n`{raw_text.replace("`", "")}`' 253 | ) 254 | 255 | 256 | __MODULE__ = "Gᴏᴏᴅʙʏᴇ" 257 | __HELP__ = """ 258 | ʜᴇʀᴇ ɪs ᴛʜᴇ ʜᴇʟᴘ ғᴏʀ ɢᴏᴏᴅʙʏᴇ: 259 | 260 | /setgoodbye - Rᴇᴘʟʏ ᴛʜɪs ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴄᴏɴᴛᴀɪɴɪɴɢ ᴄᴏʀʀᴇᴄᴛ 261 | ғᴏʀᴍᴀᴛ ғᴏʀ ᴀ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ, ᴄʜᴇᴄᴋ ᴇɴᴅ ᴏғ ᴛʜɪs ᴍᴇssᴀɢᴇ. 262 | 263 | /goodbye - Tᴏ ɢᴇᴛ ʏᴏᴜʀ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ 264 | 265 | /goodbye [ᴏɴ, ʏ, ᴛʀᴜᴇ, ᴇɴᴀʙʟᴇ, ᴛ] - ᴛᴏ ᴛᴜʀɴ ᴏɴ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs 266 | 267 | /goodbye [ᴏғғ, ɴ, ғᴀʟsᴇ, ᴅɪsᴀʙʟᴇ, ғ, ɴᴏ] - ᴛᴏ ᴛᴜʀɴ ᴏғғ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇs 268 | 269 | /delgoodbye ᴏʀ /deletegoodbye ᴛᴏ ᴅᴇʟᴛᴇ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ ᴀɴᴅ ᴛᴜʀɴ ᴏғғ ɢᴏᴏᴅʙʏᴇ 270 | **SetoodBye -> 271 | 272 | 273 | Tᴏ sᴇᴛ ᴀ ᴘʜᴏᴛᴏ ᴏʀ ɢɪғ ᴀs ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ. Aᴅᴅ ʏᴏᴜʀ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ ᴀs ᴄᴀᴘᴛɪᴏɴ ᴛᴏ ᴛʜᴇ ᴘʜᴏᴛᴏ ᴏʀ ɢɪғ. Tʜᴇ ᴄᴀᴘᴛɪᴏɴ ᴍᴜsᴇ ʙᴇ ɪɴ ᴛʜᴇ ғᴏʀᴍᴀᴛ ɢɪᴠᴇɴ ʙᴇʟᴏᴡ.** 274 | 275 | Fᴏʀ ᴛᴇxᴛ ɢᴏᴏᴅʙʏᴇ ᴍᴇssᴀɢᴇ Jᴜsᴛ sᴇɴᴅ ᴛʜᴇ ᴛᴇxᴛ. Tʜᴇɴ ʀᴇᴘʟʏ ᴡɪᴛʜ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ 276 | 277 | Tʜᴇ ғᴏʀᴍᴀᴛ sʜᴏᴜʟᴅ ʙᴇ sᴏᴍᴇᴛʜɪɴɢ ʟɪᴋᴇ ʙᴇʟᴏᴡ. 278 | 279 | Hɪ {NAME} [{ID}] Wᴇʟᴄᴏᴍᴇ ᴛᴏ {GROUPNAME} 280 | 281 | ~ #Tʜɪs sᴇᴘᴀʀᴀᴛᴇʀ (~) sʜᴏᴜʟᴅ ʙᴇ ᴛʜᴇʀᴇ ʙᴇᴛᴡᴇᴇɴ ᴛᴇxᴛ ᴀɴᴅ ʙᴜᴛᴛᴏɴs, ʀᴇᴍᴏᴠᴇ ᴛʜɪs ᴄᴏᴍᴍᴇɴᴛ ᴀʟsᴏ 282 | 283 | Button=[Dᴜᴄᴋ, ʜᴛᴛᴘs://ᴅᴜᴄᴋᴅᴜᴄᴋɢᴏ.ᴄᴏᴍ] 284 | Button2=[Gɪᴛʜᴜʙ, ʜᴛᴛᴘs://ɢɪᴛʜᴜʙ.ᴄᴏᴍ] 285 | **NOTES ->** 286 | 287 | Cʜᴇᴄᴋᴏᴜᴛ /markdownhelp ᴛᴏ ᴋɴᴏᴡ ᴍᴏʀᴇ ᴀʙᴏᴜᴛ ғᴏʀᴍᴀᴛᴛɪɴɢs ᴀɴᴅ ᴏᴛʜᴇʀ sʏɴᴛᴀx. 288 | """ 289 | -------------------------------------------------------------------------------- /plugins/google.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from googlesearch import search 4 | from pyrogram import filters 5 | 6 | from YukkiMusic import app 7 | from SafoneAPI import SafoneAPI 8 | 9 | 10 | @app.on_message(filters.command(["google", "gle"])) 11 | async def google(bot, message): 12 | if len(message.command) < 2 and not message.reply_to_message: 13 | await message.reply_text("Example:\n\n`/google lord ram`") 14 | return 15 | 16 | if message.reply_to_message and message.reply_to_message.text: 17 | user_input = message.reply_to_message.text 18 | else: 19 | user_input = " ".join(message.command[1:]) 20 | b = await message.reply_text("**Sᴇᴀʀᴄʜɪɴɢ ᴏɴ Gᴏᴏɢʟᴇ....**") 21 | try: 22 | a = search(user_input, advanced=True) 23 | txt = f"Search Query: {user_input}\n\nresults" 24 | for result in a: 25 | txt += f"\n\n[❍ {result.title}]({result.url})\n{result.description}" 26 | await b.edit( 27 | txt, 28 | disable_web_page_preview=True, 29 | ) 30 | except Exception as e: 31 | await b.edit(e) 32 | logging.exception(e) 33 | 34 | 35 | @app.on_message(filters.command(["app", "apps"])) 36 | async def app(bot, message): 37 | if len(message.command) < 2 and not message.reply_to_message: 38 | await message.reply_text("Example:\n\n`/app Free Fire`") 39 | return 40 | 41 | if message.reply_to_message and message.reply_to_message.text: 42 | user_input = message.reply_to_message.text 43 | else: 44 | user_input = " ".join(message.command[1:]) 45 | cbb = await message.reply_text("**Sᴇᴀʀᴄʜɪɴɢ ᴏɴ Pʟᴀʏ Sᴛᴏʀᴇ....**") 46 | a = await SafoneAPI().apps(user_input, 1) 47 | b = a["results"][0] 48 | icon = b["icon"] 49 | id = b["id"] 50 | link = b["link"] 51 | ca = b["description"] 52 | title = b["title"] 53 | dev = b["developer"] 54 | info = f"[ᴛɪᴛʟᴇ : {title}]({link})\nɪᴅ: {id}\nᴅᴇᴠᴇʟᴏᴘᴇʀ : {dev}\nᴅᴇsᴄʀɪᴘᴛɪᴏɴ : {ca}" 55 | try: 56 | await message.reply_photo(icon, caption=info) 57 | await cbb.delete() 58 | except Exception as e: 59 | await message.reply_text(e) 60 | 61 | 62 | __MODULE__ = "Gᴏᴏɢʟᴇ" 63 | __HELP__ = """/google [ǫᴜᴇʀʏ] - ᴛᴏ sᴇᴀʀᴄʜ ᴏɴ ɢᴏᴏɢʟᴇ ᴀɴᴅ ɢᴇᴛ ʀᴇsᴜʟᴛs 64 | /app | /apps [ᴀᴘᴘ ɴᴀᴍᴇ] - ᴛᴏ ɢᴇᴛ ᴀᴘᴘ ɪɴғᴏ ᴛʜᴀᴛ ᴀᴠᴀɪʟᴀʙʟᴇ ᴏɴ ᴘʟᴀʏsᴛᴏʀᴇ""" 65 | -------------------------------------------------------------------------------- /plugins/group.py: -------------------------------------------------------------------------------- 1 | from pyrogram import enums, filters 2 | 3 | from YukkiMusic import app 4 | from utils.permissions import adminsOnly 5 | 6 | 7 | @app.on_message(filters.command("removephoto")) 8 | @adminsOnly("can_change_info") 9 | async def deletechatphoto(_, message): 10 | 11 | chat_id = message.chat.id 12 | user_id = message.from_user.id 13 | msg = await message.reply_text("**ᴘʀᴏᴄᴇssɪɴɢ....**") 14 | admin_check = await app.get_chat_member(chat_id, user_id) 15 | if message.chat.type == enums.ChatType.PRIVATE: 16 | await msg.edit("**ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴡᴏʀᴋ ᴏɴ ɢʀᴏᴜᴘs !**") 17 | try: 18 | if admin_check.privileges.can_change_info: 19 | await app.delete_chat_photo(chat_id) 20 | await msg.edit( 21 | "**ɢʀᴏᴜᴘs ᴘʀᴏғɪʟᴇ ᴘʜᴏᴛᴏ ʀᴇᴍᴏᴠᴇᴅ !\nʙʏ** {}".format( 22 | message.from_user.mention 23 | ) 24 | ) 25 | except BaseException: 26 | await msg.edit( 27 | "**ᴛʜᴇ ᴜsᴇʀ ᴍᴏsᴛ ɴᴇᴇᴅ ᴄʜᴀɴɢᴇ ɪɴғᴏ ᴀᴅᴍɪɴ ʀɪɢʜᴛs ᴛᴏ ʀᴇᴍᴏᴠᴇ ɢʀᴏᴜᴘ ᴘʜᴏᴛᴏ !**" 28 | ) 29 | 30 | 31 | @app.on_message(filters.command("setphoto")) 32 | @adminsOnly("can_change_info") 33 | async def setchatphoto(_, message): 34 | reply = message.reply_to_message 35 | chat_id = message.chat.id 36 | user_id = message.from_user.id 37 | msg = await message.reply_text("ᴘʀᴏᴄᴇssɪɴɢ...") 38 | admin_check = await app.get_chat_member(chat_id, user_id) 39 | if message.chat.type == enums.ChatType.PRIVATE: 40 | await msg.edit("`ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴡᴏʀᴋ ᴏɴ ɢʀᴏᴜᴘs !`") 41 | elif not reply: 42 | await msg.edit("**ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴘʜᴏᴛᴏ ᴏʀ ᴅᴏᴄᴜᴍᴇɴᴛ.**") 43 | elif reply: 44 | try: 45 | if admin_check.privileges.can_change_info: 46 | photo = await reply.download() 47 | await message.chat.set_photo(photo=photo) 48 | await msg.edit_text( 49 | "**ɴᴇᴡ ɢʀᴏᴜᴘ ᴘʀᴏғɪʟᴇ ᴘʜᴏᴛᴏ ᴄʜᴀɴɢᴇᴅ !\nʙʏ** {}".format( 50 | message.from_user.mention 51 | ) 52 | ) 53 | else: 54 | await msg.edit("**sᴏᴍᴇᴛʜɪɴɢ ᴡʀᴏɴɢ ʜᴀᴘᴘᴇɴᴇᴅ ᴛʀʏ ᴀɴᴏᴛʜᴇʀ ᴘʜᴏᴛᴏ !**") 55 | 56 | except BaseException: 57 | await msg.edit( 58 | "**ᴛʜᴇ ᴜsᴇʀ ᴍᴏsᴛ ɴᴇᴇᴅ ᴄʜᴀɴɢᴇ ɪɴғᴏ ᴀᴅᴍɪɴ ʀɪɢʜᴛs ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴘʜᴏᴛᴏ !**" 59 | ) 60 | 61 | 62 | @app.on_message(filters.command("settitle")) 63 | @adminsOnly("can_change_info") 64 | async def setgrouptitle(_, message): 65 | reply = message.reply_to_message 66 | chat_id = message.chat.id 67 | user_id = message.from_user.id 68 | msg = await message.reply_text("ᴘʀᴏᴄᴇssɪɴɢ...") 69 | if message.chat.type == enums.ChatType.PRIVATE: 70 | await msg.edit("**ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴡᴏʀᴋ ᴏɴ ɢʀᴏᴜᴘs !**") 71 | elif reply: 72 | try: 73 | title = message.reply_to_message.text 74 | admin_check = await app.get_chat_member(chat_id, user_id) 75 | if admin_check.privileges.can_change_info: 76 | await message.chat.set_title(title) 77 | await msg.edit( 78 | "**ɴᴇᴡ ɢʀᴏᴜᴘ ɴᴀᴍᴇ ᴄʜᴀɴɢᴇᴅ !\nʙʏ** {}".format( 79 | message.from_user.mention 80 | ) 81 | ) 82 | except AttributeError: 83 | await msg.edit( 84 | "ᴛʜᴇ ᴜsᴇʀ ᴍᴏsᴛ ɴᴇᴇᴅ **ᴄʜᴀɴɢᴇ ɪɴғᴏ** ᴀᴅᴍɪɴ ʀɪɢʜᴛs ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴛɪᴛʟᴇ !" 85 | ) 86 | elif len(message.command) > 1: 87 | try: 88 | title = message.text.split(None, 1)[1] 89 | admin_check = await app.get_chat_member(chat_id, user_id) 90 | if admin_check.privileges.can_change_info: 91 | await message.chat.set_title(title) 92 | await msg.edit( 93 | "**ɴᴇᴡ ɢʀᴏᴜᴘ ɴᴀᴍᴇ ᴄʜᴀɴɢᴇᴅ !\nʙʏ** {}".format( 94 | message.from_user.mention 95 | ) 96 | ) 97 | except AttributeError: 98 | await msg.edit( 99 | "**ᴛʜᴇ ᴜsᴇʀ ᴍᴏsᴛ ɴᴇᴇᴅ ᴄʜᴀɴɢᴇ ɪɴғᴏ ᴀᴅᴍɪɴ ʀɪɢʜᴛs ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴛɪᴛʟᴇ !**" 100 | ) 101 | 102 | else: 103 | await msg.edit( 104 | "**ʏᴏᴜ ɴᴇᴇᴅ ʀᴇᴘʟʏ ᴛᴏ ᴛᴇxᴛ ᴏʀ ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴛɪᴛʟᴇ **" 105 | ) 106 | 107 | 108 | @app.on_message(filters.command(["setdiscription", "setdesc"])) 109 | @adminsOnly("can_change_info") 110 | async def setg_discription(_, message): 111 | reply = message.reply_to_message 112 | chat_id = message.chat.id 113 | user_id = message.from_user.id 114 | msg = await message.reply_text("**ᴘʀᴏᴄᴇssɪɴɢ...**") 115 | if message.chat.type == enums.ChatType.PRIVATE: 116 | await msg.edit("**ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴡᴏʀᴋs ᴏɴ ɢʀᴏᴜᴘs!**") 117 | elif reply: 118 | try: 119 | discription = message.reply_to_message.text 120 | admin_check = await app.get_chat_member(chat_id, user_id) 121 | if admin_check.privileges.can_change_info: 122 | await message.chat.set_description(discription) 123 | await msg.edit( 124 | "**ɴᴇᴡ ᴅɪsᴄʀɪᴘᴛɪᴏɴ ᴏғ ɢʀᴏᴜᴘ ᴄʜᴀɴɢᴇᴅ!**\nʙʏ {}".format( 125 | message.from_user.mention 126 | ) 127 | ) 128 | except AttributeError: 129 | await msg.edit( 130 | "**ᴛʜᴇ ᴜsᴇʀ ᴍᴜsᴛ ʜᴀᴠᴇ ᴄʜᴀɴɢᴇ ɪɴғᴏ ᴀᴅᴍɪɴ ʀɪɢʜᴛs ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴅɪsᴄʀɪᴘᴛɪᴏɴ!**" 131 | ) 132 | elif len(message.command) > 1: 133 | try: 134 | discription = message.text.split(None, 1)[1] 135 | admin_check = await app.get_chat_member(chat_id, user_id) 136 | if admin_check.privileges.can_change_info: 137 | await message.chat.set_description(discription) 138 | await msg.edit( 139 | "**ɴᴇᴡ ᴅɪsᴄʀɪᴘᴛɪᴏɴ ᴏғ ɢʀᴏᴜᴘ ᴄʜᴀɴɢᴇᴅ!**\nʙʏ {}".format( 140 | message.from_user.mention 141 | ) 142 | ) 143 | except AttributeError: 144 | await msg.edit( 145 | "**ᴛʜᴇ ᴜsᴇʀ ᴍᴜsᴛ ʜᴀᴠᴇ ᴄʜᴀɴɢᴇ ɪɴғᴏ ᴀᴅᴍɪɴ ʀɪɢʜᴛs ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴅɪsᴄʀɪᴘᴛɪᴏɴ!**" 146 | ) 147 | else: 148 | await msg.edit( 149 | "**ʏᴏᴜ ɴᴇᴇᴅ ᴛᴏ ʀᴇᴘʟʏ ᴛᴏ ᴛᴇxᴛ ᴏʀ ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ ᴛᴏ ᴄʜᴀɴɢᴇ ɢʀᴏᴜᴘ ᴅɪsᴄʀɪᴘᴛᴏɴ!**" 150 | ) 151 | -------------------------------------------------------------------------------- /plugins/hastag.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from YukkiMusic import app 3 | from TheApi import api 4 | 5 | 6 | @app.on_message(filters.command("hastag")) 7 | async def hastag(bot, message): 8 | 9 | try: 10 | text = message.text.split(" ", 1)[1] 11 | res = api.gen_hashtag(text) 12 | except IndexError: 13 | return await message.reply_text("Example:\n\n/hastag python") 14 | 15 | await message.reply_text(f"ʜᴇʀᴇ ɪs ʏᴏᴜʀ ʜᴀsᴛᴀɢ :\n
{res}
", quote=True) 16 | 17 | 18 | __MODULE__ = "Hᴀsʜᴛᴀɢ" 19 | __HELP__ = """ 20 | **ʜᴀsʜᴛᴀɢ ɢᴇɴᴇʀᴀᴛᴏʀ:** 21 | 22 | • `/hashtag [text]`: Gᴇɴᴇʀᴀᴛᴇ ʜᴀsʜᴛᴀɢs ғᴏʀ ᴛʜᴇ ɢɪᴠᴇɴ ᴛᴇxᴛ. 23 | """ 24 | -------------------------------------------------------------------------------- /plugins/hug.py: -------------------------------------------------------------------------------- 1 | from YukkiMusic import app 2 | from pyrogram import filters 3 | import nekos 4 | 5 | 6 | @app.on_message(filters.command("hug")) 7 | async def huggg(client, message): 8 | try: 9 | if message.reply_to_message: 10 | await message.reply_video( 11 | nekos.img("hug"), 12 | caption=f"{message.from_user.mention} hugged {message.reply_to_message.from_user.mention}", 13 | ) 14 | else: 15 | await message.reply_video(nekos.img("hug")) 16 | except Exception as e: 17 | await message.reply_text(f"Error: {e}") 18 | 19 | 20 | __MODULE__ = "Hᴜɢ" 21 | __HELP__ = """ 22 | Tʜɪs ʙᴏᴛ ʀᴇsᴘᴏɴᴅs ᴛᴏ ᴛʜᴇ ғᴏʟʟᴏᴡɪɴɢ ᴄᴏᴍᴍᴀɴᴅs: 23 | 24 | - /hug: Sᴇɴᴅs ᴀ ʜᴜɢɢɪɴɢ ᴀɴɪᴍᴀᴛɪᴏɴ. 25 | 26 | **Cᴏᴍᴍᴀɴᴅs** 27 | 28 | - /hug: Sᴇɴᴅs ᴀ ʜᴜɢɢɪɴɢ ᴀɴɪᴍᴀᴛɪᴏɴ. Iғ ᴜsᴇᴅ ᴀs ᴀ ʀᴇᴘʟʏ ᴛᴏ ᴀɴᴏᴛʜᴇʀ ᴍᴇssᴀɢᴇ, ɪᴛ ᴍᴇɴᴛɪᴏɴs ᴛʜᴇ sᴇɴᴅᴇʀ ᴀɴᴅ ʀᴇᴄɪᴘɪᴇɴᴛ ᴏғ ᴛʜᴇ ʜᴜɢ. 29 | 30 | **Hᴏᴡ ᴛᴏ Usᴇ** 31 | 32 | - Usᴇ /hug ᴛᴏ sᴇɴᴅ ᴀ ʜᴜɢɢɪɴɢ ᴀɴɪᴍᴀᴛɪᴏɴ. 33 | - Rᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴡɪᴛʜ /ʜᴜ ᴛᴏ sᴇɴᴅ ᴀ ʜᴜɢɢɪɴɢ ᴀɴɪᴍᴀᴛɪᴏɴ ᴍᴇɴᴛɪᴏɴɪɴɢ ᴛʜᴇ sᴇɴᴅᴇʀ ᴀɴᴅ ʀᴇᴄɪᴘɪᴇɴᴛ. 34 | 35 | **Nᴏᴛᴇs** 36 | 37 | - Eɴsᴜʀᴇ ʏᴏᴜʀ ᴄʜᴀᴛ sᴇᴛᴛɪɴɢs ᴀʟʟᴏᴡ ᴛʜᴇ ʙᴏᴛ ᴛᴏ sᴇɴᴅ ᴠɪᴅᴇᴏs/sᴛɪᴄᴋᴇʀs ᴀs ʀᴇᴘʟɪᴇs ғᴏʀ ғᴜʟʟ ғᴜɴᴄᴛɪᴏɴᴀʟɪᴛʏ.""" 38 | -------------------------------------------------------------------------------- /plugins/id.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from YukkiMusic import app 3 | 4 | 5 | @app.on_message(filters.command("id")) 6 | async def get_id(client, message): 7 | try: 8 | if not message.reply_to_message and message.chat: 9 | await message.reply( 10 | f"ᴜsᴇʀ {message.from_user.first_name}'s ɪᴅ ɪs {message.from_user.id}.\nᴛʜɪs ᴄʜᴀᴛ's ɪᴅ ɪs: {message.chat.id}." 11 | ) 12 | elif not message.reply_to_message.sticker or message.reply_to_message is None: 13 | if message.reply_to_message.forward_from_chat: 14 | await message.reply( 15 | f"Tʜᴇ ғᴏʀᴡᴀʀᴅᴇᴅ {str(message.reply_to_message.forward_from_chat.type)[9:].lower()}, {message.reply_to_message.forward_from_chat.title} ʜᴀs ᴀɴ ID ᴏғ {message.reply_to_message.forward_from_chat.id}" 16 | ) 17 | 18 | elif message.reply_to_message.forward_from: 19 | await message.reply( 20 | f"Tʜᴇ ғᴏʀᴡᴀʀᴅᴇᴅ ᴜsᴇʀ, {message.reply_to_message.forward_from.first_name} ʜᴀs ᴀɴ ID ᴏғ {message.reply_to_message.forward_from.id}." 21 | ) 22 | 23 | elif message.reply_to_message.forward_sender_name: 24 | await message.reply( 25 | "Sᴏʀʀʏ, I ɴᴇᴠᴇʀ sᴀᴡ ᴛʜᴀᴛ ᴜsᴇʀ's ᴍᴇssᴀɢᴇ ᴏʀ I ᴀᴍ ᴜɴᴀʙʟᴇ ᴛᴏ ғᴇᴛᴄʜ ᴛʜᴇ ID." 26 | ) 27 | else: 28 | await message.reply( 29 | f"ᴜsᴇʀ {message.reply_to_message.from_user.first_name}'s ID ɪs {message.reply_to_message.from_user.id}." 30 | ) 31 | elif message.reply_to_message.sticker: 32 | if message.reply_to_message.forward_from_chat: 33 | await message.reply( 34 | f"Tʜᴇ ғᴏʀᴡᴀʀᴅᴇᴅ {str(message.reply_to_message.forward_from_chat.type)[9:].lower()}, {message.reply_to_message.forward_from_chat.title} ʜᴀs ᴀɴ ID ᴏғ {message.reply_to_message.forward_from_chat.id} \nᴀɴᴅ ᴛʜᴇ ʀᴇᴘʟɪᴇᴅ sᴛɪᴄᴋᴇʀ ID ɪs {message.reply_to_message.sticker.file_id}" 35 | ) 36 | 37 | elif message.reply_to_message.forward_from: 38 | await message.reply( 39 | f"Tʜᴇ ғᴏʀᴡᴀʀᴅᴇᴅ ᴜsᴇʀ, {message.reply_to_message.forward_from.first_name} ʜᴀs ᴀɴ ID ᴏғ {message.reply_to_message.forward_from.id} \nᴀɴᴅ ᴛʜᴇ ʀᴇᴘʟɪᴇᴅ sᴛɪᴄᴋᴇʀ ID ɪs {message.reply_to_message.sticker.file_id}." 40 | ) 41 | 42 | elif message.reply_to_message.forward_sender_name: 43 | await message.reply( 44 | "Sᴏʀʀʏ, I ɴᴇᴠᴇʀ sᴀᴡ ᴛʜᴀᴛ ᴜsᴇʀ's ᴍᴇssᴀɢᴇ ᴏʀ I ᴀᴍ ᴜɴᴀʙʟᴇ ᴛᴏ ғᴇᴛᴄʜ ᴛʜᴇ ID." 45 | ) 46 | 47 | else: 48 | await message.reply( 49 | f"ᴜsᴇʀ {message.reply_to_message.from_user.first_name}'s ID ɪs {message.reply_to_message.from_user.id}\n ᴀɴᴅ ᴛʜᴇ ʀᴇᴘʟɪᴇᴅ sᴛɪᴄᴋᴇʀ ID ɪs {message.reply_to_message.sticker.file_id}." 50 | ) 51 | else: 52 | await message.reply( 53 | f"User {message.reply_to_message.from_user.first_name}'s ᴜsᴇʀ ID ɪs {message.reply_to_message.from_user.id}." 54 | ) 55 | except Exception as r: 56 | await message.reply(f"Aɴ ᴇʀʀᴏʀ ᴏᴄᴄᴜʀʀᴇᴅ ᴡʜɪʟᴇ ɢᴇᴛᴛɪɴɢ ᴛʜᴇ ID. {r}") 57 | 58 | 59 | __MODULE__ = "Usᴇʀɪᴅ" 60 | __HELP__ = """ 61 | **ɪᴅ ʀᴇᴛʀɪᴇᴠᴇʀ:** 62 | 63 | • `/id`: Retrieve user and chat IDs. 64 | """ 65 | -------------------------------------------------------------------------------- /plugins/ig.py: -------------------------------------------------------------------------------- 1 | import re 2 | import requests 3 | from pyrogram import filters 4 | 5 | from YukkiMusic import app 6 | from config import LOG_GROUP_ID 7 | 8 | 9 | @app.on_message(filters.command(["ig", "instagram", "reel"])) 10 | async def download_instagram_video(client, message): 11 | if len(message.command) < 2: 12 | await message.reply_text( 13 | "Pʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴛʜᴇ Iɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟ URL ᴀғᴛᴇʀ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ" 14 | ) 15 | return 16 | url = message.text.split()[1] 17 | if not re.match( 18 | re.compile(r"^(https?://)?(www\.)?(instagram\.com|instagr\.am)/.*$"), url 19 | ): 20 | return await message.reply_text( 21 | "Tʜᴇ ᴘʀᴏᴠɪᴅᴇᴅ URL ɪs ɴᴏᴛ ᴀ ᴠᴀʟɪᴅ Iɴsᴛᴀɢʀᴀᴍ URL😅😅" 22 | ) 23 | a = await message.reply_text("ᴘʀᴏᴄᴇssɪɴɢ...") 24 | api_url = f"https://insta-dl.hazex.workers.dev/?url={url}" 25 | 26 | response = requests.get(api_url) 27 | try: 28 | result = response.json() 29 | data = result["result"] 30 | except Exception as e: 31 | f = f"Eʀʀᴏʀ :\n{e}" 32 | try: 33 | await a.edit(f) 34 | except Exception: 35 | await message.reply_text(f) 36 | return await app.send_message(LOG_GROUP_ID, f) 37 | return await app.send_message(LOG_GROUP_ID, f) 38 | if not result["error"]: 39 | video_url = data["url"] 40 | duration = data["duration"] 41 | quality = data["quality"] 42 | type = data["extension"] 43 | size = data["formattedSize"] 44 | caption = f"**Dᴜʀᴀᴛɪᴏɴ :** {duration}\n**Qᴜᴀʟɪᴛʏ :** {quality}\n**Tʏᴘᴇ :** {type}\n**Sɪᴢᴇ :** {size}" 45 | await a.delete() 46 | await message.reply_video(video_url, caption=caption) 47 | else: 48 | try: 49 | return await a.edit("Fᴀɪʟᴇᴅ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ʀᴇᴇʟ") 50 | except Exception: 51 | return await message.reply_text("Fᴀɪʟᴇᴅ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ʀᴇᴇʟ") 52 | 53 | 54 | __MODULE__ = "Rᴇᴇʟ" 55 | __HELP__ = """ 56 | **ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟ ᴅᴏᴡɴʟᴏᴀᴅᴇʀ:** 57 | 58 | • `/ig [URL]`: ᴅᴏᴡɴʟᴏᴀᴅ ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟs. Pʀᴏᴠɪᴅᴇ ᴛʜᴇ ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟ URL ᴀғᴛᴇʀ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ. 59 | • `/instagram [URL]`: ᴅᴏᴡɴʟᴏᴀᴅ ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟs. Pʀᴏᴠɪᴅᴇ ᴛʜᴇ ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟ URL ᴀғᴛᴇʀ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ. 60 | • `/reel [URL]`: ᴅᴏᴡɴʟᴏᴀᴅ ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟs. Pʀᴏᴠɪᴅᴇ ᴛʜᴇ ɪɴsᴛᴀɢʀᴀᴍ ʀᴇᴇʟ URL ᴀғᴛᴇʀ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ. 61 | """ 62 | -------------------------------------------------------------------------------- /plugins/image.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import InputMediaPhoto 2 | from config import BANNED_USERS 3 | from YukkiMusic import app 4 | from pyrogram import filters 5 | from TheApi import api 6 | 7 | 8 | @app.on_message(filters.command(["image"], prefixes=["/", "!", "."]) & ~BANNED_USERS) 9 | async def image_from_bing(_, message): 10 | if len(message.command) < 2 and not message.reply_to_message: 11 | return await message.reply_text("**ɢɪᴠᴇ ɪᴍᴀɢᴇ ɴᴀᴍᴇ ғᴏʀ sᴇᴀʀᴄʜ 🔍**") 12 | 13 | if message.reply_to_message and message.reply_to_message.text: 14 | query = message.reply_to_message.text 15 | else: 16 | query = " ".join(message.command[1:]) 17 | 18 | messagesend = await message.reply_text("**🔍 sᴇᴀʀᴄʜɪɴɢ ғᴏʀ ɪᴍᴀɢᴇs...**") 19 | 20 | media_group = [] 21 | for url in api.bing_image(query, 6): 22 | media_group.append(InputMediaPhoto(media=url)) 23 | await messagesend.edit(f"**ᴜᴘʟᴏᴀᴅɪɴɢ...**") 24 | try: 25 | await app.send_media_group(message.chat.id, media_group) 26 | await messagesend.delete() 27 | except Exception as e: 28 | await messagesend.edit(e) 29 | -------------------------------------------------------------------------------- /plugins/info.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from pyrogram import enums, filters 4 | from pyrogram.types import Message 5 | 6 | from YukkiMusic import app 7 | from YukkiMusic.misc import SUDOERS 8 | from YukkiMusic.utils.database import is_gbanned_user 9 | 10 | n = "\n" 11 | w = " " 12 | 13 | 14 | def bold(x): 15 | return f"**{x}:** " 16 | 17 | 18 | def bold_ul(x): 19 | return f"**--{x}:**-- " 20 | 21 | 22 | def mono(x): 23 | return f"`{x}`{n}" 24 | 25 | 26 | def section( 27 | title: str, 28 | body: dict, 29 | indent: int = 2, 30 | underline: bool = False, 31 | ) -> str: 32 | text = (bold_ul(title) + n) if underline else bold(title) + n 33 | 34 | for key, value in body.items(): 35 | if value is not None: 36 | text += ( 37 | indent * w 38 | + bold(key) 39 | + ( 40 | (value[0] + n) 41 | if isinstance(value, list) and isinstance(value[0], str) 42 | else mono(value) 43 | ) 44 | ) 45 | return text 46 | 47 | 48 | async def userstatus(user_id): 49 | try: 50 | user = await app.get_users(user_id) 51 | x = user.status 52 | if x == enums.UserStatus.RECENTLY: 53 | return "Recently." 54 | elif x == enums.UserStatus.LAST_WEEK: 55 | return "Last week." 56 | elif x == enums.UserStatus.LONG_AGO: 57 | return "Long time ago." 58 | elif x == enums.UserStatus.OFFLINE: 59 | return "Offline." 60 | elif x == enums.UserStatus.ONLINE: 61 | return "Online." 62 | except BaseException: 63 | return "**sᴏᴍᴇᴛʜɪɴɢ ᴡʀᴏɴɢ ʜᴀᴘᴘᴇɴᴇᴅ !**" 64 | 65 | 66 | async def get_user_info(user, already=False): 67 | if not already: 68 | user = await app.get_users(user) 69 | if not user.first_name: 70 | return ["Deleted account", None] 71 | user_id = user.id 72 | online = await userstatus(user_id) 73 | username = user.username 74 | first_name = user.first_name 75 | mention = user.mention("Link") 76 | dc_id = user.dc_id 77 | photo_id = user.photo.big_file_id if user.photo else None 78 | is_gbanned = await is_gbanned_user(user_id) 79 | is_sudo = user_id in SUDOERS 80 | is_premium = user.is_premium 81 | body = { 82 | "ɴᴀᴍᴇ": [first_name], 83 | "ᴜsᴇʀɴᴀᴍᴇ": [("@" + username) if username else "Null"], 84 | "ɪᴅ": user_id, 85 | "ᴅᴄ ɪᴅ": dc_id, 86 | "ᴍᴇɴᴛɪᴏɴ": [mention], 87 | "ᴘʀᴇɪᴍɪᴜᴍ": is_premium, 88 | "ʟᴀsᴛ sᴇᴇɴ": online, 89 | } 90 | caption = section("ᴜsᴇʀ ɪɴғᴏ", body) 91 | return [caption, photo_id] 92 | 93 | 94 | async def get_chat_info(chat): 95 | chat = await app.get_chat(chat) 96 | username = chat.username 97 | link = f"[Link](t.me/{username})" if username else "Null" 98 | photo_id = chat.photo.big_file_id if chat.photo else None 99 | info = f""" 100 | ❅─────✧❅✦❅✧─────❅ 101 | ✦ ᴄʜᴀᴛ ɪɴғᴏ ✦ 102 | 103 | ➻ ᴄʜᴀᴛ ɪᴅ ‣ {chat.id} 104 | ➻ ɴᴀᴍᴇ ‣ {chat.title} 105 | ➻ ᴜsᴇʀɴᴀᴍᴇ ‣ {chat.username} 106 | ➻ ᴅᴄ ɪᴅ ‣ {chat.dc_id} 107 | ➻ ᴅᴇsᴄʀɪᴘᴛɪᴏɴ ‣ {chat.description} 108 | ➻ ᴄʜᴀᴛᴛʏᴘᴇ ‣ {chat.type} 109 | ➻ ɪs ᴠᴇʀɪғɪᴇᴅ ‣ {chat.is_verified} 110 | ➻ ɪs ʀᴇsᴛʀɪᴄᴛᴇᴅ ‣ {chat.is_restricted} 111 | ➻ ɪs ᴄʀᴇᴀᴛᴏʀ ‣ {chat.is_creator} 112 | ➻ ɪs sᴄᴀᴍ ‣ {chat.is_scam} 113 | ➻ ɪs ғᴀᴋᴇ ‣ {chat.is_fake} 114 | ➻ ᴍᴇᴍʙᴇʀ's ᴄᴏᴜɴᴛ ‣ {chat.members_count} 115 | ➻ ʟɪɴᴋ ‣ {link} 116 | 117 | 118 | ❅─────✧❅✦❅✧─────❅""" 119 | 120 | return info, photo_id 121 | 122 | 123 | @app.on_message(filters.command("info")) 124 | async def info_func(_, message: Message): 125 | if message.reply_to_message: 126 | user = message.reply_to_message.from_user.id 127 | elif not message.reply_to_message and len(message.command) == 1: 128 | user = message.from_user.id 129 | elif not message.reply_to_message and len(message.command) != 1: 130 | user_input = message.text.split(None, 1)[1] 131 | if user_input.isdigit(): 132 | user = int(user_input) 133 | elif user_input.startswith("@"): 134 | user = user_input 135 | else: 136 | return await message.reply_text( 137 | "ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴀ ᴜsᴇʀ's ᴜsᴇʀ ɪᴅ ᴏʀ ᴜsᴇʀɴᴀᴍᴇ ᴏʀ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴜsᴇʀ ᴛᴏ ɢᴇᴛ ɪɴғᴏ" 138 | ) 139 | 140 | m = await message.reply_text("ᴘʀᴏᴄᴇssɪɴɢ...") 141 | 142 | try: 143 | info_caption, photo_id = await get_user_info(user) 144 | except Exception as e: 145 | return await m.edit(str(e)) 146 | 147 | if not photo_id: 148 | return await m.edit(info_caption, disable_web_page_preview=True) 149 | photo = await app.download_media(photo_id) 150 | 151 | await message.reply_photo(photo, caption=info_caption, quote=False) 152 | await m.delete() 153 | os.remove(photo) 154 | 155 | 156 | @app.on_message(filters.command("chatinfo")) 157 | async def chat_info_func(_, message: Message): 158 | splited = message.text.split() 159 | if len(splited) == 1: 160 | chat = message.chat.id 161 | if chat == message.from_user.id: 162 | return await message.reply_text("**Usage:**/chat_info [USERNAME|ID]") 163 | else: 164 | chat = splited[1] 165 | try: 166 | m = await message.reply_text("Processing") 167 | 168 | info_caption, photo_id = await get_chat_info(chat) 169 | if not photo_id: 170 | return await m.edit(info_caption, disable_web_page_preview=True) 171 | 172 | photo = await app.download_media(photo_id) 173 | await message.reply_photo(photo, caption=info_caption, quote=False) 174 | 175 | await m.delete() 176 | os.remove(photo) 177 | except Exception as e: 178 | await m.edit(e) 179 | 180 | 181 | __MODULE__ = "Iɴғᴏ" 182 | __HELP__ = """ 183 | **ᴜsᴇʀ & ᴄʜᴀᴛ ɪɴғᴏʀᴍᴀᴛɪᴏɴ:** 184 | 185 | • `/info`: Gᴇᴛ ɪɴғᴏʀᴍᴀᴛɪᴏɴ ᴀʙᴏᴜᴛ ᴛʜᴇ ᴜsᴇʀ. Usᴇʀɴᴀᴍᴇ, ID, ᴀɴᴅ ᴍᴏʀᴇ. 186 | • `/chatinfo [ᴜsᴇʀɴᴀᴍᴇ|ɪᴅ]`: Gᴇᴛ ɪɴғᴏʀᴍᴀᴛɪᴏɴ ᴀʙᴏᴜᴛ ᴛʜᴇ ᴄʜᴀᴛ. ᴍᴇᴍʙᴇʀ ᴄᴏᴜɴᴛ, ɪs ᴠᴇʀɪғɪᴇᴅ, ɪɴᴠɪᴛᴇ ʟɪɴᴋ, ᴀɴᴅ ᴍᴏʀᴇ. 187 | """ 188 | -------------------------------------------------------------------------------- /plugins/joke.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | from pyrogram.enums import ParseMode 4 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 5 | 6 | from YukkiMusic import app 7 | 8 | JOKE_API_ENDPOINT = ( 9 | "https://hindi-jokes-api.onrender.com/jokes?api_key=93eeccc9d663115eba73839b3cd9" 10 | ) 11 | 12 | 13 | @app.on_message(filters.command("joke")) 14 | async def get_joke(_, message): 15 | response = requests.get(JOKE_API_ENDPOINT) 16 | r = response.json() 17 | joke_text = r["jokeContent"] 18 | refresh_button = InlineKeyboardButton("ʀᴇғʀᴇsʜ", callback_data=f"refresh_joke") 19 | keyboard = InlineKeyboardMarkup(inline_keyboard=[[refresh_button]]) 20 | await message.reply_text( 21 | joke_text, reply_markup=keyboard, parse_mode=ParseMode.HTML 22 | ) 23 | 24 | 25 | @app.on_callback_query(filters.regex(r"refresh_joke")) 26 | async def refresh_joke(_, query): 27 | await query.answer() 28 | response = requests.get(JOKE_API_ENDPOINT) 29 | r = response.json() 30 | new_joke_text = r["jokeContent"] 31 | await query.message.edit_text( 32 | new_joke_text, 33 | reply_markup=InlineKeyboardMarkup( 34 | [[InlineKeyboardButton("ʀᴇғʀᴇsʜ", callback_data=f"refresh_joke")]] 35 | ), 36 | parse_mode=ParseMode.HTML, 37 | ) 38 | -------------------------------------------------------------------------------- /plugins/love.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | from pyrogram import filters 4 | 5 | from YukkiMusic import app 6 | 7 | 8 | def get_random_message(love_percentage): 9 | if love_percentage <= 30: 10 | return random.choice( 11 | [ 12 | "Love is in the air but needs a little spark.", 13 | "A good start but there's room to grow.", 14 | "It's just the beginning of something beautiful.", 15 | ] 16 | ) 17 | elif love_percentage <= 70: 18 | return random.choice( 19 | [ 20 | "A strong connection is there. Keep nurturing it.", 21 | "You've got a good chance. Work on it.", 22 | "Love is blossoming, keep going.", 23 | ] 24 | ) 25 | else: 26 | return random.choice( 27 | [ 28 | "Wow! It's a match made in heaven!", 29 | "Perfect match! Cherish this bond.", 30 | "Destined to be together. Congratulations!", 31 | ] 32 | ) 33 | 34 | 35 | @app.on_message(filters.command("love", prefixes="/")) 36 | def love_command(client, message): 37 | command, *args = message.text.split(" ") 38 | if len(args) >= 2: 39 | name1 = args[0].strip() 40 | name2 = args[1].strip() 41 | 42 | love_percentage = random.randint(10, 100) 43 | love_message = get_random_message(love_percentage) 44 | 45 | response = f"{name1}💕 + {name2}💕 = {love_percentage}%\n\n{love_message}" 46 | else: 47 | response = "Please enter two names after /love command." 48 | app.send_message(message.chat.id, response) 49 | 50 | 51 | __MODULE__ = "Lᴏᴠᴇ" 52 | __HELP__ = """ 53 | **ʟᴏᴠᴇ ᴄᴀʟᴄᴜʟᴀᴛᴏʀ:** 54 | 55 | • `/love [name1] [name2]`: Cᴀʟᴄᴜʟᴀᴛᴇs ᴛʜᴇ ᴘᴇʀᴄᴇɴᴛᴀɢᴇ ᴏғ ʟᴏᴠᴇ ʙᴇᴛᴡᴇᴇɴ ᴛᴡᴏ ᴘᴇᴏᴘʟᴇ. 56 | """ 57 | -------------------------------------------------------------------------------- /plugins/markdown.py: -------------------------------------------------------------------------------- 1 | from pyrogram.enums import ChatType, ParseMode 2 | from pyrogram.filters import command 3 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 4 | 5 | from YukkiMusic import app 6 | from YukkiMusic.utils.functions import MARKDOWN 7 | 8 | 9 | @app.on_message(command("markdownhelp")) 10 | async def mkdwnhelp(_, m: Message): 11 | keyb = InlineKeyboardMarkup( 12 | [ 13 | [ 14 | InlineKeyboardButton( 15 | text="Click Here!", 16 | url=f"http://t.me/{app.username}?start=mkdwn_help", 17 | ) 18 | ] 19 | ] 20 | ) 21 | if m.chat.type != ChatType.PRIVATE: 22 | await m.reply( 23 | "Click on the below button to get markdown usage syntax in pm!", 24 | reply_markup=keyb, 25 | ) 26 | else: 27 | await m.reply( 28 | MARKDOWN, parse_mode=ParseMode.HTML, disable_web_page_preview=True 29 | ) 30 | return 31 | -------------------------------------------------------------------------------- /plugins/mongo.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from pymongo import MongoClient 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | 7 | from YukkiMusic import app 8 | 9 | mongo_url_pattern = re.compile(r"mongodb(?:\+srv)?:\/\/[^\s]+") 10 | 11 | 12 | @app.on_message(filters.command("mongochk")) 13 | async def mongo_command(client, message: Message): 14 | if len(message.command) < 2: 15 | await message.reply( 16 | "ᴘʟᴇᴀsᴇ ᴇɴᴛᴇʀ ʏᴏᴜʀ ᴍᴏɴɢᴏᴅʙ ᴜʀʟ ᴀғᴛᴇʀ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ `/mongochk your_mongodb_url`" 17 | ) 18 | return 19 | 20 | mongo_url = message.command[1] 21 | if re.match(mongo_url_pattern, mongo_url): 22 | try: 23 | # Attempt to connect to the MongoDB instance 24 | client = MongoClient(mongo_url, serverSelectionTimeoutMS=5000) 25 | client.server_info() # Will cause an exception if connection fails 26 | await message.reply("ᴍᴏɴɢᴏᴅʙ ᴜʀʟ ɪs ᴠᴀʟɪᴅ ᴀɴᴅ ᴄᴏɴɴᴇᴄᴛɪᴏɴ sᴜᴄᴇssғᴜʟ ✅") 27 | except Exception as e: 28 | await message.reply(f"ғᴀɪʟᴇᴅ ᴛᴏ ᴄᴏɴɴᴇᴄᴛ ᴍᴏɴɢᴏᴅʙ: {e}") 29 | else: 30 | await message.reply("ᴜᴘs! ʏᴏᴜʀ ᴍᴏɴɢᴏᴅʙ ғᴏʀᴍᴀᴛ ɪs ɪɴᴠᴀʟɪᴅ") 31 | 32 | 33 | __MODULE__ = "Mᴏɴɢᴏᴅʙ" 34 | __HELP__ = """ 35 | **ᴍᴏɴɢᴏᴅʙ ᴄʜᴇᴄᴋᴇʀ:** 36 | 37 | • `/mongochk [mongo_url]`: Cʜᴇᴄᴋs ᴛʜᴇ ᴠᴀʟɪᴅɪᴛʏ ᴏғ ᴀ ᴍᴏɴɢᴏᴅʙ URL ᴀɴᴅ ᴄᴏɴɴᴇᴄᴛɪᴏɴ ᴛᴏ ᴛʜᴇ ᴍᴏɴɢᴏᴅʙ ɪɴsᴛᴀɴᴄᴇ. 38 | """ 39 | -------------------------------------------------------------------------------- /plugins/notes.py: -------------------------------------------------------------------------------- 1 | from inspect import getfullargspec 2 | from re import findall 3 | import datetime 4 | 5 | from pyrogram import filters 6 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 7 | 8 | from config import BANNED_USERS 9 | from YukkiMusic import app 10 | from YukkiMusic.utils.database import ( 11 | delete_note, 12 | deleteall_notes, 13 | get_note, 14 | get_note_names, 15 | save_note, 16 | ) 17 | from utils.error import capture_err 18 | from YukkiMusic.utils.functions import ( 19 | check_format, 20 | extract_text_and_keyb, 21 | get_data_and_name, 22 | ) 23 | from YukkiMusic.utils.keyboard import ikb 24 | from utils.permissions import adminsOnly, member_permissions 25 | 26 | 27 | def extract_urls(reply_markup): 28 | urls = [] 29 | if reply_markup.inline_keyboard: 30 | buttons = reply_markup.inline_keyboard 31 | for i, row in enumerate(buttons): 32 | for j, button in enumerate(row): 33 | if button.url: 34 | name = ( 35 | "\n~\nbutton" 36 | if i * len(row) + j + 1 == 1 37 | else f"button{i * len(row) + j + 1}" 38 | ) 39 | urls.append((f"{name}", button.text, button.url)) 40 | return urls 41 | 42 | 43 | async def eor(msg: Message, **kwargs): 44 | func = ( 45 | (msg.edit_text if msg.from_user.is_self else msg.reply) 46 | if msg.from_user 47 | else msg.reply 48 | ) 49 | spec = getfullargspec(func.__wrapped__).args 50 | return await func(**{k: v for k, v in kwargs.items() if k in spec}) 51 | 52 | 53 | @app.on_message(filters.command("save") & filters.group & ~BANNED_USERS) 54 | @adminsOnly("can_change_info") 55 | async def save_notee(_, message): 56 | try: 57 | if len(message.command) < 2: 58 | await eor( 59 | message, 60 | text="**Usage:**\nReply to a message with /save [NOTE_NAME] to save a new note.", 61 | ) 62 | else: 63 | replied_message = message.reply_to_message 64 | if not replied_message: 65 | replied_message = message 66 | data, name = await get_data_and_name(replied_message, message) 67 | if data == "error": 68 | return await message.reply_text( 69 | "**Usage:**\n__/save [NOTE_NAME] [CONTENT]__\n`-----------OR-----------`\nReply to a message with.\n/save [NOTE_NAME]" 70 | ) 71 | if replied_message.text: 72 | _type = "text" 73 | file_id = None 74 | if replied_message.sticker: 75 | _type = "sticker" 76 | file_id = replied_message.sticker.file_id 77 | if replied_message.animation: 78 | _type = "animation" 79 | file_id = replied_message.animation.file_id 80 | if replied_message.photo: 81 | _type = "photo" 82 | file_id = replied_message.photo.file_id 83 | if replied_message.document: 84 | _type = "document" 85 | file_id = replied_message.document.file_id 86 | if replied_message.video: 87 | _type = "video" 88 | file_id = replied_message.video.file_id 89 | if replied_message.video_note: 90 | _type = "video_note" 91 | file_id = replied_message.video_note.file_id 92 | if replied_message.audio: 93 | _type = "audio" 94 | file_id = replied_message.audio.file_id 95 | if replied_message.voice: 96 | _type = "voice" 97 | file_id = replied_message.voice.file_id 98 | if replied_message.reply_markup and not findall(r"\[.+\,.+\]", data): 99 | urls = extract_urls(replied_message.reply_markup) 100 | if urls: 101 | response = "\n".join( 102 | [f"{name}=[{text}, {url}]" for name, text, url in urls] 103 | ) 104 | data = data + response 105 | if data: 106 | data = await check_format(ikb, data) 107 | if not data: 108 | return await message.reply_text( 109 | "**Wrong formatting, check the help section.**" 110 | ) 111 | note = { 112 | "type": _type, 113 | "data": data, 114 | "file_id": file_id, 115 | } 116 | chat_id = message.chat.id 117 | await save_note(chat_id, name, note) 118 | await eor(message, text=f"__**Saved note {name}.**__") 119 | except UnboundLocalError: 120 | return await message.reply_text( 121 | "**Replied message is inaccessible.\n`Forward the message and try again`**" 122 | ) 123 | 124 | 125 | @app.on_message(filters.command("notes") & filters.group & ~BANNED_USERS) 126 | @capture_err 127 | async def get_notes(_, message): 128 | chat_id = message.chat.id 129 | 130 | _notes = await get_note_names(chat_id) 131 | 132 | if not _notes: 133 | return await eor(message, text="**No notes in this chat.**") 134 | _notes.sort() 135 | msg = f"List of notes in {message.chat.title}\n" 136 | for note in _notes: 137 | msg += f"**-** `{note}`\n" 138 | await eor(message, text=msg) 139 | 140 | 141 | @app.on_message(filters.command("get") & filters.group & ~BANNED_USERS) 142 | @capture_err 143 | async def get_one_note(_, message): 144 | if len(message.text.split()) < 2: 145 | return await eor(message, text="Invalid arguments") 146 | from_user = message.from_user if message.from_user else message.sender_chat 147 | chat_id = message.chat.id 148 | name = message.text.split(None, 1)[1] 149 | if not name: 150 | return 151 | _note = await get_note(chat_id, name) 152 | if not _note: 153 | return 154 | type = _note["type"] 155 | data = _note["data"] 156 | file_id = _note.get("file_id") 157 | keyb = None 158 | if data: 159 | if "{app.mention}" in data: 160 | data = data.replace("{app.mention}", app.mention) 161 | if "{GROUPNAME}" in data: 162 | data = data.replace("{GROUPNAME}", message.chat.title) 163 | if "{NAME}" in data: 164 | data = data.replace("{NAME}", message.from_user.mention) 165 | if "{ID}" in data: 166 | data = data.replace("{ID}", f"`message.from_user.id`") 167 | if "{FIRSTNAME}" in data: 168 | data = data.replace("{FIRSTNAME}", message.from_user.first_name) 169 | if "{SURNAME}" in data: 170 | sname = ( 171 | message.from_user.last_name 172 | if message.from_user.last_name.last_name 173 | else "None" 174 | ) 175 | data = data.replace("{SURNAME}", sname) 176 | if "{USERNAME}" in data: 177 | susername = ( 178 | message.from_user.username if message.from_user.username else "None" 179 | ) 180 | data = data.replace("{USERNAME}", susername) 181 | if "{DATE}" in data: 182 | DATE = datetime.datetime.now().strftime("%Y-%m-%d") 183 | data = data.replace("{DATE}", DATE) 184 | if "{WEEKDAY}" in data: 185 | WEEKDAY = datetime.datetime.now().strftime("%A") 186 | data = data.replace("{WEEKDAY}", WEEKDAY) 187 | if "{TIME}" in data: 188 | TIME = datetime.datetime.now().strftime("%H:%M:%S") 189 | data = data.replace("{TIME}", f"{TIME} UTC") 190 | 191 | if findall(r"\[.+\,.+\]", data): 192 | keyboard = extract_text_and_keyb(ikb, data) 193 | if keyboard: 194 | data, keyb = keyboard 195 | replied_message = message.reply_to_message 196 | if replied_message: 197 | replied_user = ( 198 | replied_message.from_user 199 | if replied_message.from_user 200 | else replied_message.sender_chat 201 | ) 202 | if replied_user.id != from_user.id: 203 | message = replied_message 204 | await get_reply(message, type, file_id, data, keyb) 205 | 206 | 207 | @app.on_message(filters.regex(r"^#.+") & filters.text & filters.group & ~BANNED_USERS) 208 | @capture_err 209 | async def get_one_note(_, message): 210 | from_user = message.from_user if message.from_user else message.sender_chat 211 | chat_id = message.chat.id 212 | name = message.text.replace("#", "", 1) 213 | if not name: 214 | return 215 | _note = await get_note(chat_id, name) 216 | if not _note: 217 | return 218 | type = _note["type"] 219 | data = _note["data"] 220 | file_id = _note.get("file_id") 221 | keyb = None 222 | if data: 223 | if "{app.mention}" in data: 224 | data = data.replace("{app.mention}", app.mention) 225 | if "{GROUPNAME}" in data: 226 | data = data.replace("{GROUPNAME}", message.chat.title) 227 | if "{NAME}" in data: 228 | data = data.replace("{NAME}", message.from_user.mention) 229 | if "{ID}" in data: 230 | data = data.replace("{ID}", f"`message.from_user.id`") 231 | if "{FIRSTNAME}" in data: 232 | data = data.replace("{FIRSTNAME}", message.from_user.first_name) 233 | if "{SURNAME}" in data: 234 | sname = ( 235 | message.from_user.last_name 236 | if message.from_user.last_name.last_name 237 | else "None" 238 | ) 239 | data = data.replace("{SURNAME}", sname) 240 | if "{USERNAME}" in data: 241 | susername = ( 242 | message.from_user.username if message.from_user.username else "None" 243 | ) 244 | data = data.replace("{USERNAME}", susername) 245 | if "{DATE}" in data: 246 | DATE = datetime.datetime.now().strftime("%Y-%m-%d") 247 | data = data.replace("{DATE}", DATE) 248 | if "{WEEKDAY}" in data: 249 | WEEKDAY = datetime.datetime.now().strftime("%A") 250 | data = data.replace("{WEEKDAY}", WEEKDAY) 251 | if "{TIME}" in data: 252 | TIME = datetime.datetime.now().strftime("%H:%M:%S") 253 | data = data.replace("{TIME}", f"{TIME} UTC") 254 | 255 | if findall(r"\[.+\,.+\]", data): 256 | keyboard = extract_text_and_keyb(ikb, data) 257 | if keyboard: 258 | data, keyb = keyboard 259 | replied_message = message.reply_to_message 260 | if replied_message: 261 | replied_user = ( 262 | replied_message.from_user 263 | if replied_message.from_user 264 | else replied_message.sender_chat 265 | ) 266 | if replied_user.id != from_user.id: 267 | message = replied_message 268 | await get_reply(message, type, file_id, data, keyb) 269 | 270 | 271 | async def get_reply(message, type, file_id, data, keyb): 272 | if type == "text": 273 | await message.reply_text( 274 | text=data, 275 | reply_markup=keyb, 276 | disable_web_page_preview=True, 277 | ) 278 | if type == "sticker": 279 | await message.reply_sticker( 280 | sticker=file_id, 281 | ) 282 | if type == "animation": 283 | await message.reply_animation( 284 | animation=file_id, 285 | caption=data, 286 | reply_markup=keyb, 287 | ) 288 | if type == "photo": 289 | await message.reply_photo( 290 | photo=file_id, 291 | caption=data, 292 | reply_markup=keyb, 293 | ) 294 | if type == "document": 295 | await message.reply_document( 296 | document=file_id, 297 | caption=data, 298 | reply_markup=keyb, 299 | ) 300 | if type == "video": 301 | await message.reply_video( 302 | video=file_id, 303 | caption=data, 304 | reply_markup=keyb, 305 | ) 306 | if type == "video_note": 307 | await message.reply_video_note( 308 | video_note=file_id, 309 | ) 310 | if type == "audio": 311 | await message.reply_audio( 312 | audio=file_id, 313 | caption=data, 314 | reply_markup=keyb, 315 | ) 316 | if type == "voice": 317 | await message.reply_voice( 318 | voice=file_id, 319 | caption=data, 320 | reply_markup=keyb, 321 | ) 322 | 323 | 324 | @app.on_message(filters.command("delete") & filters.group & ~BANNED_USERS) 325 | @adminsOnly("can_change_info") 326 | async def del_note(_, message): 327 | if len(message.command) < 2: 328 | return await eor(message, text="**Usage**\n__/delete [NOTE_NAME]__") 329 | name = message.text.split(None, 1)[1].strip() 330 | if not name: 331 | return await eor(message, text="**Usage**\n__/delete [NOTE_NAME]__") 332 | 333 | chat_id = message.chat.id 334 | 335 | deleted = await delete_note(chat_id, name) 336 | if deleted: 337 | await eor(message, text=f"**Deleted note {name} successfully.**") 338 | else: 339 | await eor(message, text="**No such note.**") 340 | 341 | 342 | @app.on_message(filters.command("deleteall") & filters.group & ~BANNED_USERS) 343 | @adminsOnly("can_change_info") 344 | async def delete_all(_, message): 345 | _notes = await get_note_names(message.chat.id) 346 | if not _notes: 347 | return await message.reply_text("**No notes in this chat.**") 348 | else: 349 | keyboard = InlineKeyboardMarkup( 350 | [ 351 | [ 352 | InlineKeyboardButton("YES, DO IT", callback_data="delete_yes"), 353 | InlineKeyboardButton("Cancel", callback_data="delete_no"), 354 | ] 355 | ] 356 | ) 357 | await message.reply_text( 358 | "**Are you sure you want to delete all the notes in this chat forever ?.**", 359 | reply_markup=keyboard, 360 | ) 361 | 362 | 363 | @app.on_callback_query(filters.regex("delete_(.*)")) 364 | async def delete_all_cb(_, cb): 365 | chat_id = cb.message.chat.id 366 | from_user = cb.from_user 367 | permissions = await member_permissions(chat_id, from_user.id) 368 | permission = "can_change_info" 369 | if permission not in permissions: 370 | return await cb.answer( 371 | f"You don't have the required permission.\n Permission: {permission}", 372 | show_alert=True, 373 | ) 374 | input = cb.data.split("_", 1)[1] 375 | if input == "yes": 376 | stoped_all = await deleteall_notes(chat_id) 377 | if stoped_all: 378 | return await cb.message.edit( 379 | "**Successfully deleted all notes on this chat.**" 380 | ) 381 | if input == "no": 382 | await cb.message.reply_to_message.delete() 383 | await cb.message.delete() 384 | 385 | 386 | __MODULE__ = "Nᴏᴛᴇs" 387 | __HELP__ = """ 388 | **ɴᴏᴛᴇꜱ:** 389 | 390 | • `/save [NOTE_NAME] [CONTENT]`: Sᴀᴠᴇs ᴀ ɴᴏᴛᴇ ᴡɪᴛʜ ᴛʜᴇ ɢɪᴠᴇɴ ɴᴀᴍᴇ ᴀɴᴅ ᴄᴏɴᴛᴇɴᴛ. 391 | • `/notes`: Sʜᴏᴡs ᴀʟʟ sᴀᴠᴇᴅ ɴᴏᴛᴇꜱ ɪɴ ᴛʜᴇ ᴄʜᴀᴛ. 392 | • `/get [NOTE_NAME]`: Gᴇᴛs ᴛʜᴇ ᴄᴏɴᴛᴇɴᴛ ᴏғ ᴀ sᴀᴠᴇᴅ ɴᴏᴛᴇ. 393 | • `/delete [NOTE_NAME]`: Dᴇʟᴇᴛᴇs ᴀ sᴀᴠᴇᴅ ɴᴏᴛᴇ. 394 | • `/deleteall`: Dᴇʟᴇᴛᴇs ᴀʟʟ sᴀᴠᴇᴅ ɴᴏᴛᴇꜱ ɪɴ ᴛʜᴇ ᴄʜᴀᴛ. 395 | """ 396 | -------------------------------------------------------------------------------- /plugins/pretender.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Union 2 | 3 | from motor.motor_asyncio import AsyncIOMotorClient as MongoCli 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from pyrogram.enums import ChatMembersFilter 7 | 8 | from config import MONGO_DB_URI 9 | from YukkiMusic import app 10 | 11 | mongo = MongoCli(MONGO_DB_URI).Rankings 12 | 13 | impdb = mongo.pretender 14 | 15 | 16 | async def usr_data(chat_id: int, user_id: int) -> bool: 17 | user = await impdb.find_one({"chat_id": chat_id, "user_id": user_id}) 18 | return bool(user) 19 | 20 | 21 | async def get_userdata(chat_id: int, user_id: int) -> Union[Dict[str, str], None]: 22 | user = await impdb.find_one({"chat_id": chat_id, "user_id": user_id}) 23 | return user 24 | 25 | 26 | async def add_userdata( 27 | chat_id: int, user_id: int, username: str, first_name: str, last_name: str 28 | ): 29 | await impdb.update_one( 30 | {"chat_id": chat_id, "user_id": user_id}, 31 | { 32 | "$set": { 33 | "username": username, 34 | "first_name": first_name, 35 | "last_name": last_name, 36 | } 37 | }, 38 | upsert=True, 39 | ) 40 | 41 | 42 | async def check_pretender(chat_id: int) -> bool: 43 | chat = await impdb.find_one({"chat_id_toggle": chat_id}) 44 | return bool(chat) 45 | 46 | 47 | async def impo_on(chat_id: int) -> None: 48 | await impdb.insert_one({"chat_id_toggle": chat_id}) 49 | 50 | 51 | async def impo_off(chat_id: int) -> None: 52 | await impdb.delete_one({"chat_id_toggle": chat_id}) 53 | 54 | 55 | @app.on_message(filters.group & ~filters.bot & ~filters.via_bot, group=69) 56 | async def chk_usr(_, message: Message): 57 | chat_id = message.chat.id 58 | if message.sender_chat or not await check_pretender(chat_id): 59 | return 60 | user_id = message.from_user.id 61 | user_data = await get_userdata(chat_id, user_id) 62 | if not user_data: 63 | await add_userdata( 64 | chat_id, 65 | user_id, 66 | message.from_user.username, 67 | message.from_user.first_name, 68 | message.from_user.last_name, 69 | ) 70 | return 71 | 72 | usernamebefore = user_data.get("username", "") 73 | first_name = user_data.get("first_name", "") 74 | lastname_before = user_data.get("last_name", "") 75 | 76 | msg = f"[{message.from_user.id}](tg://user?id={message.from_user.id})\n" 77 | 78 | changes = [] 79 | 80 | if ( 81 | first_name != message.from_user.first_name 82 | and lastname_before != message.from_user.last_name 83 | ): 84 | changes.append( 85 | f"ᴄʜᴀɴɢᴇᴅ ʜᴇʀ ɴᴀᴍᴇ ғʀᴏᴍ {first_name} {lastname_before} ᴛᴏ {message.from_user.first_name} {message.from_user.last_name}\n" 86 | ) 87 | elif first_name != message.from_user.first_name: 88 | changes.append( 89 | f"ᴄʜᴀɴɢᴇᴅ ʜᴇʀ ғɪʀsᴛ ɴᴀᴍᴇ ғʀᴏᴍ {first_name} ᴛᴏ {message.from_user.first_name}\n" 90 | ) 91 | elif lastname_before != message.from_user.last_name: 92 | changes.append( 93 | f"ᴄʜᴀɴɢᴇᴅ ʜᴇʀ ʟᴀsᴛ ɴᴀᴍᴇ ғʀᴏᴍ {lastname_before} ᴛᴏ {message.from_user.last_name}\n" 94 | ) 95 | 96 | if usernamebefore != message.from_user.username: 97 | changes.append( 98 | f"ᴄʜᴀɴɢᴇᴅ ʜᴇʀ ᴜsᴇʀɴᴀᴍᴇ ғʀᴏᴍ @{usernamebefore} ᴛᴏ @{message.from_user.username}\n" 99 | ) 100 | 101 | if changes: 102 | msg += "".join(changes) 103 | await message.reply_text(msg) 104 | 105 | await add_userdata( 106 | chat_id, 107 | user_id, 108 | message.from_user.username, 109 | message.from_user.first_name, 110 | message.from_user.last_name, 111 | ) 112 | 113 | 114 | @app.on_message( 115 | filters.group & filters.command("pretender") & ~filters.bot & ~filters.via_bot 116 | ) 117 | async def set_mataa(_, message: Message): 118 | admin_ids = [ 119 | admin.user.id 120 | async for admin in app.get_chat_members( 121 | message.chat.id, filter=ChatMembersFilter.ADMINISTRATORS 122 | ) 123 | ] 124 | if message.from_user.id not in admin_ids: 125 | return 126 | if len(message.command) == 1: 127 | return await message.reply("**ᴅᴇᴛᴇᴄᴛᴇᴅ ᴘʀᴇᴛᴇɴᴅᴇʀ ᴜsᴀɢᴇ:\n/pretender on|off**") 128 | chat_id = message.chat.id 129 | if message.command[1] == "on": 130 | cekset = await check_pretender(chat_id) 131 | if cekset: 132 | await message.reply( 133 | f"ᴘʀᴇᴛᴇɴᴅᴇʀ ɪs ᴀʟʀᴇᴀᴅʏ ᴇɴᴀʙʟᴇᴅ ғᴏʀ **{message.chat.title}**" 134 | ) 135 | else: 136 | await impo_on(chat_id) 137 | await message.reply( 138 | f"sᴜᴄᴇssғᴜʟʟʏ ᴇɴᴀʙʟᴇᴅ ᴘʀᴇᴛᴇɴᴅᴇʀ ғᴏʀ **{message.chat.title}**" 139 | ) 140 | elif message.command[1] == "off": 141 | cekset = await check_pretender(chat_id) 142 | if not cekset: 143 | await message.reply( 144 | f"ᴘʀᴇᴛᴇɴᴅᴇʀ ɪs ᴀʟʀᴇᴀᴅʏ ᴅɪsᴀʙʟᴇᴅ ғᴏʀ **{message.chat.title}**" 145 | ) 146 | else: 147 | await impo_off(chat_id) 148 | await message.reply( 149 | f"sᴜᴄᴇssғᴜʟʟʏ ᴅɪsᴀʙʟᴇᴅ ᴘʀᴇᴛᴇɴᴅᴇʀ ғᴏʀ **{message.chat.title}" 150 | ) 151 | else: 152 | await message.reply("**ᴅᴇᴛᴇᴄᴛᴇᴅ ᴘʀᴇᴛᴇɴᴅᴇʀ ᴜsᴀɢᴇ:\n/pretender on|off**") 153 | 154 | 155 | __MODULE__ = "Pʀᴇᴛᴇɴᴅᴇʀ" 156 | __HELP__ = """ 157 | /pretender - [Oɴ / ᴏғғ] - ᴛᴏ ᴛᴜʀɴ ᴏɴ ᴏʀ ᴏғғ ᴘʀᴇᴛᴇɴᴅᴇʀ ғᴏʀ ʏᴏᴜ ᴄʜᴀᴛ ɪғ ᴀɴʏ ᴜsᴇʀ ᴄʜᴀɴɢᴇ ʜᴇʀ ᴜsᴇʀɴᴀᴍᴇ, ɴᴀᴍᴇ , ʙɪᴏ ʙᴏᴛ ᴡɪʟʟ sᴇɴᴅ ᴍᴇssᴀɢᴇ ɪɴ ʏᴏᴜʀ ᴄʜᴀᴛ""" 158 | -------------------------------------------------------------------------------- /plugins/pypi.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 4 | 5 | from YukkiMusic import app 6 | 7 | 8 | def get_pypi_info(package_name): 9 | try: 10 | api_url = f"https://pypi.org/pypi/{package_name}/json" 11 | response = requests.get(api_url) 12 | if response.status_code == 200: 13 | pypi_info = response.json() 14 | return pypi_info 15 | else: 16 | return None 17 | except Exception as e: 18 | print(f"Error fetching PyPI information: {e}") 19 | return None 20 | 21 | 22 | @app.on_message(filters.command("pypi", prefixes="/")) 23 | async def pypi_info_command(client, message): 24 | try: 25 | package_name = message.command[1] 26 | pypi_info = get_pypi_info(package_name) 27 | 28 | if pypi_info: 29 | info_message = ( 30 | f"ᴅᴇᴀʀ {message.from_user.mention} \n " 31 | f"ʜᴇʀᴇ ɪs ʏᴏᴜʀ ᴘᴀᴋᴀɢᴇ ᴅᴇᴛᴀɪʟs \n\n " 32 | f"ᴘᴀᴋᴀɢᴇ ɴᴀᴍᴇ ➪ {pypi_info['info']['name']}\n\n" 33 | f"ʟᴀᴛᴇsᴛ ᴠᴇʀsɪᴏɴ ➪ {pypi_info['info']['version']}\n\n" 34 | f"ᴅᴇsᴄʀɪᴘᴛɪᴏɴ ➪ {pypi_info['info']['summary']}\n\n" 35 | f"ᴘʀᴏJᴇᴄᴛ ᴜʀʟ ➪ {pypi_info['info']['project_urls']['Homepage']}" 36 | ) 37 | close_markup = InlineKeyboardMarkup( 38 | [[InlineKeyboardButton(text="〆 ᴄʟᴏsᴇ 〆", callback_data="close")]] 39 | ) 40 | await message.reply_text(info_message, reply_markup=close_markup) 41 | else: 42 | await message.reply_text( 43 | f"Package '{package_name}' not found \n please dont try again later ." 44 | ) 45 | 46 | except IndexError: 47 | await message.reply_text( 48 | "Please provide a package name after the /pypi command." 49 | ) 50 | 51 | 52 | __MODULE__ = "Pʏᴘɪ" 53 | __HELP__ = """ 54 | **ᴄᴏᴍᴍᴀɴᴅs:** 55 | • /pypi `: Get details about a specified Python package from PyPI. 56 | 57 | **ɪɴғᴏ:** 58 | ᴛʜɪs ᴍᴏᴅᴜʟᴇ ᴀʟʟᴏᴡs ᴜsᴇʀs ᴛᴏ ғᴇᴛᴄʜ ɪɴғᴏʀᴍᴀᴛɪᴏɴ ᴀʙᴏᴜᴛ ᴘʏᴛʜᴏɴ ᴘᴀᴄᴋᴀɢᴇs ғʀᴏᴍ ᴘʏᴘɪ, ɪɴᴄʟᴜᴅɪɴɢ ᴛʜᴇ ᴘᴀᴄᴋᴀɢᴇ ɴᴀᴍᴇ, ʟᴀᴛᴇsᴛ ᴠᴇʀsɪᴏɴ, ᴅᴇsᴄʀɪᴘᴛɪᴏɴ, ᴀɴᴅ ᴘʀᴏᴊᴇᴄᴛ ᴜʀʟ. 59 | 60 | **ɴᴏᴛᴇ:** 61 | ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴀ ᴠᴀʟɪᴅ ᴘᴀᴄᴋᴀɢᴇ ɴᴀᴍᴇ ᴀғᴛᴇʀ ᴛʜᴇ `/pypi` ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ʀᴇᴛʀɪᴇᴠᴇ ᴘᴀᴄᴋᴀɢᴇ ᴅᴇᴛᴀɪʟs. 62 | """ 63 | -------------------------------------------------------------------------------- /plugins/q.py: -------------------------------------------------------------------------------- 1 | from io import BytesIO 2 | 3 | from httpx import AsyncClient, Timeout 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | 7 | from YukkiMusic import app 8 | 9 | fetch = AsyncClient( 10 | http2=True, 11 | verify=False, 12 | headers={ 13 | "Accept-Language": "id-ID", 14 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edge/107.0.1418.42", 15 | }, 16 | timeout=Timeout(20), 17 | ) 18 | 19 | 20 | class QuotlyException(Exception): 21 | pass 22 | 23 | 24 | async def get_message_sender_id(ctx: Message): 25 | if ctx.forward_date: 26 | if ctx.forward_sender_name: 27 | return 1 28 | elif ctx.forward_from: 29 | return ctx.forward_from.id 30 | elif ctx.forward_from_chat: 31 | return ctx.forward_from_chat.id 32 | else: 33 | return 1 34 | elif ctx.from_user: 35 | return ctx.from_user.id 36 | elif ctx.sender_chat: 37 | return ctx.sender_chat.id 38 | else: 39 | return 1 40 | 41 | 42 | async def get_message_sender_name(ctx: Message): 43 | if ctx.forward_date: 44 | if ctx.forward_sender_name: 45 | return ctx.forward_sender_name 46 | elif ctx.forward_from: 47 | return ( 48 | f"{ctx.forward_from.first_name} {ctx.forward_from.last_name}" 49 | if ctx.forward_from.last_name 50 | else ctx.forward_from.first_name 51 | ) 52 | 53 | elif ctx.forward_from_chat: 54 | return ctx.forward_from_chat.title 55 | else: 56 | return "" 57 | elif ctx.from_user: 58 | if ctx.from_user.last_name: 59 | return f"{ctx.from_user.first_name} {ctx.from_user.last_name}" 60 | else: 61 | return ctx.from_user.first_name 62 | elif ctx.sender_chat: 63 | return ctx.sender_chat.title 64 | else: 65 | return "" 66 | 67 | 68 | async def get_custom_emoji(ctx: Message): 69 | if ctx.forward_date: 70 | return ( 71 | "" 72 | if ctx.forward_sender_name 73 | or not ctx.forward_from 74 | and ctx.forward_from_chat 75 | or not ctx.forward_from 76 | else ctx.forward_from.emoji_status.custom_emoji_id 77 | ) 78 | 79 | return ctx.from_user.emoji_status.custom_emoji_id if ctx.from_user else "" 80 | 81 | 82 | async def get_message_sender_username(ctx: Message): 83 | if ctx.forward_date: 84 | if ( 85 | not ctx.forward_sender_name 86 | and not ctx.forward_from 87 | and ctx.forward_from_chat 88 | and ctx.forward_from_chat.username 89 | ): 90 | return ctx.forward_from_chat.username 91 | elif ( 92 | not ctx.forward_sender_name 93 | and not ctx.forward_from 94 | and ctx.forward_from_chat 95 | or ctx.forward_sender_name 96 | or not ctx.forward_from 97 | ): 98 | return "" 99 | else: 100 | return ctx.forward_from.username or "" 101 | elif ctx.from_user and ctx.from_user.username: 102 | return ctx.from_user.username 103 | elif ( 104 | ctx.from_user 105 | or ctx.sender_chat 106 | and not ctx.sender_chat.username 107 | or not ctx.sender_chat 108 | ): 109 | return "" 110 | else: 111 | return ctx.sender_chat.username 112 | 113 | 114 | async def get_message_sender_photo(ctx: Message): 115 | if ctx.forward_date: 116 | if ( 117 | not ctx.forward_sender_name 118 | and not ctx.forward_from 119 | and ctx.forward_from_chat 120 | and ctx.forward_from_chat.photo 121 | ): 122 | return { 123 | "small_file_id": ctx.forward_from_chat.photo.small_file_id, 124 | "small_photo_unique_id": ctx.forward_from_chat.photo.small_photo_unique_id, 125 | "big_file_id": ctx.forward_from_chat.photo.big_file_id, 126 | "big_photo_unique_id": ctx.forward_from_chat.photo.big_photo_unique_id, 127 | } 128 | elif ( 129 | not ctx.forward_sender_name 130 | and not ctx.forward_from 131 | and ctx.forward_from_chat 132 | or ctx.forward_sender_name 133 | or not ctx.forward_from 134 | ): 135 | return "" 136 | else: 137 | return ( 138 | { 139 | "small_file_id": ctx.forward_from.photo.small_file_id, 140 | "small_photo_unique_id": ctx.forward_from.photo.small_photo_unique_id, 141 | "big_file_id": ctx.forward_from.photo.big_file_id, 142 | "big_photo_unique_id": ctx.forward_from.photo.big_photo_unique_id, 143 | } 144 | if ctx.forward_from.photo 145 | else "" 146 | ) 147 | 148 | elif ctx.from_user and ctx.from_user.photo: 149 | return { 150 | "small_file_id": ctx.from_user.photo.small_file_id, 151 | "small_photo_unique_id": ctx.from_user.photo.small_photo_unique_id, 152 | "big_file_id": ctx.from_user.photo.big_file_id, 153 | "big_photo_unique_id": ctx.from_user.photo.big_photo_unique_id, 154 | } 155 | elif ( 156 | ctx.from_user 157 | or ctx.sender_chat 158 | and not ctx.sender_chat.photo 159 | or not ctx.sender_chat 160 | ): 161 | return "" 162 | else: 163 | return { 164 | "small_file_id": ctx.sender_chat.photo.small_file_id, 165 | "small_photo_unique_id": ctx.sender_chat.photo.small_photo_unique_id, 166 | "big_file_id": ctx.sender_chat.photo.big_file_id, 167 | "big_photo_unique_id": ctx.sender_chat.photo.big_photo_unique_id, 168 | } 169 | 170 | 171 | async def get_text_or_caption(ctx: Message): 172 | if ctx.text: 173 | return ctx.text 174 | elif ctx.caption: 175 | return ctx.caption 176 | else: 177 | return "" 178 | 179 | 180 | async def pyrogram_to_quotly(messages, is_reply): 181 | if not isinstance(messages, list): 182 | messages = [messages] 183 | payload = { 184 | "type": "quote", 185 | "format": "png", 186 | "backgroundColor": "#1b1429", 187 | "messages": [], 188 | } 189 | 190 | for message in messages: 191 | the_message_dict_to_append = {} 192 | if message.entities: 193 | the_message_dict_to_append["entities"] = [ 194 | { 195 | "type": entity.type.name.lower(), 196 | "offset": entity.offset, 197 | "length": entity.length, 198 | } 199 | for entity in message.entities 200 | ] 201 | elif message.caption_entities: 202 | the_message_dict_to_append["entities"] = [ 203 | { 204 | "type": entity.type.name.lower(), 205 | "offset": entity.offset, 206 | "length": entity.length, 207 | } 208 | for entity in message.caption_entities 209 | ] 210 | else: 211 | the_message_dict_to_append["entities"] = [] 212 | the_message_dict_to_append["chatId"] = await get_message_sender_id(message) 213 | the_message_dict_to_append["text"] = await get_text_or_caption(message) 214 | the_message_dict_to_append["avatar"] = True 215 | the_message_dict_to_append["from"] = {} 216 | the_message_dict_to_append["from"]["id"] = await get_message_sender_id(message) 217 | the_message_dict_to_append["from"]["name"] = await get_message_sender_name( 218 | message 219 | ) 220 | the_message_dict_to_append["from"]["username"] = ( 221 | await get_message_sender_username(message) 222 | ) 223 | the_message_dict_to_append["from"]["type"] = message.chat.type.name.lower() 224 | the_message_dict_to_append["from"]["photo"] = await get_message_sender_photo( 225 | message 226 | ) 227 | if message.reply_to_message and is_reply: 228 | the_message_dict_to_append["replyMessage"] = { 229 | "name": await get_message_sender_name(message.reply_to_message), 230 | "text": await get_text_or_caption(message.reply_to_message), 231 | "chatId": await get_message_sender_id(message.reply_to_message), 232 | } 233 | else: 234 | the_message_dict_to_append["replyMessage"] = {} 235 | payload["messages"].append(the_message_dict_to_append) 236 | r = await fetch.post("https://bot.lyo.su/quote/generate.png", json=payload) 237 | if not r.is_error: 238 | return r.read() 239 | else: 240 | raise QuotlyException(r.json()) 241 | 242 | 243 | def isArgInt(txt) -> list: 244 | count = txt 245 | try: 246 | count = int(count) 247 | return [True, count] 248 | except ValueError: 249 | return [False, 0] 250 | 251 | 252 | @app.on_message(filters.command(["q", "r"]) & filters.reply) 253 | async def msg_quotly_cmd(self: app, ctx: Message): 254 | ww = await ctx.reply_text("ᴡᴀɪᴛ ᴀ sᴇᴄᴏɴᴅ......") 255 | is_reply = False 256 | if ctx.command[0].endswith("r"): 257 | is_reply = True 258 | if len(ctx.text.split()) > 1: 259 | check_arg = isArgInt(ctx.command[1]) 260 | if check_arg[0]: 261 | if check_arg[1] < 2 or check_arg[1] > 10: 262 | await ww.delete() 263 | return await ctx.reply_msg("Invalid range", del_in=6) 264 | try: 265 | messages = [ 266 | i 267 | for i in await self.get_messages( 268 | chat_id=ctx.chat.id, 269 | message_ids=range( 270 | ctx.reply_to_message.id, 271 | ctx.reply_to_message.id + (check_arg[1] + 5), 272 | ), 273 | replies=-1, 274 | ) 275 | if not i.empty and not i.media 276 | ] 277 | except Exception: 278 | return await ctx.reply_text("🤷🏻‍♂️") 279 | try: 280 | make_quotly = await pyrogram_to_quotly(messages, is_reply=is_reply) 281 | bio_sticker = BytesIO(make_quotly) 282 | bio_sticker.name = "misskatyquote_sticker.webp" 283 | await ww.delete() 284 | return await ctx.reply_sticker(bio_sticker) 285 | except Exception: 286 | await ww.delete() 287 | return await ctx.reply_msg("🤷🏻‍♂️") 288 | try: 289 | messages_one = await self.get_messages( 290 | chat_id=ctx.chat.id, message_ids=ctx.reply_to_message.id, replies=-1 291 | ) 292 | messages = [messages_one] 293 | except Exception: 294 | await ww.delete() 295 | return await ctx.reply_msg("🤷🏻‍♂️") 296 | try: 297 | make_quotly = await pyrogram_to_quotly(messages, is_reply=is_reply) 298 | bio_sticker = BytesIO(make_quotly) 299 | bio_sticker.name = "misskatyquote_sticker.webp" 300 | await ww.delete() 301 | return await ctx.reply_sticker(bio_sticker) 302 | except Exception as e: 303 | await ww.delete() 304 | return await ctx.reply_msg(f"ERROR: {e}") 305 | 306 | 307 | __HELP__ = """ 308 | **ǫᴜᴏᴛᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ ʙᴏᴛ ᴄᴏᴍᴍᴀɴᴅs** 309 | 310 | ᴜsᴇ ᴛʜᴇsᴇ ᴄᴏᴍᴍᴀɴᴅs ᴛᴏ ᴄʀᴇᴀᴛᴇ ǫᴜᴏᴛᴇs ғʀᴏᴍ ᴍᴇssᴀɢᴇs: 311 | 312 | - `/q`: ᴄʀᴇᴀᴛᴇ ᴀ ǫᴜᴏᴛᴇ ғʀᴏᴍ ᴀ sɪɴɢʟᴇ ᴍᴇssᴀɢᴇ. 313 | - `/r`: ᴄʀᴇᴀᴛᴇ ᴀ ǫᴜᴏᴛᴇ ғʀᴏᴍ ᴀ sɪɴɢʟᴇ ᴍᴇssᴀɢᴇ ᴀɴᴅ ɪᴛs ʀᴇᴘʟɪᴇᴅ ᴍᴇssᴀɢᴇ. 314 | 315 | **ᴇxᴀᴍᴘʟᴇs:** 316 | - `/q `: ᴄʀᴇᴀᴛᴇ ᴀ ǫᴜᴏᴛᴇ ғʀᴏᴍ ʀᴇᴘʟɪᴇᴅ ᴍᴇssᴀɢᴇs. 317 | 318 | - `/r `: ᴄʀᴇᴀᴛᴇ ᴀ ǫᴜᴏᴛᴇ ғʀᴏᴍ ʀᴇᴘʟɪᴇᴅ ᴍᴇssᴀɢᴇs. 319 | 320 | **ɴᴏᴛᴇ:** 321 | ᴍᴀᴋᴇ sᴜʀᴇ ᴛᴏ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ғᴏʀ ᴛʜᴇ ǫᴜᴏᴛᴇ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴡᴏʀᴋ. 322 | """ 323 | 324 | __MODULE__ = "Qᴜᴏᴛᴇ" 325 | -------------------------------------------------------------------------------- /plugins/qrgen.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | 3 | from YukkiMusic import app 4 | 5 | 6 | @app.on_message(filters.command(["qr"])) 7 | async def write_text(client, message): 8 | if len(message.command) < 2: 9 | await message.reply_text("**Usage**:- `/qr https://t.me/vivekkumar07089`") 10 | return 11 | text = " ".join(message.command[1:]) 12 | photo_url = "https://apis.xditya.me/qr/gen?text=" + text 13 | await app.send_photo( 14 | chat_id=message.chat.id, photo=photo_url, caption="Here is your qrcode" 15 | ) 16 | 17 | 18 | __MODULE__ = "Qʀɢᴇɴ" 19 | 20 | __HELP__ = """ 21 | Ƭʜɪs ᴍᴏᴅᴜʟᴇ ɢᴇɴᴇʀᴀᴛᴇs Qʀ ᴄᴏᴅᴇs. Usᴇ ᴛʜᴇ /qr ᴄᴏᴍᴍᴀɴᴅ ғᴏʟʟᴏᴡᴇᴅ ʙʏ ᴛʜᴇ ᴛᴇxᴛ ᴏʀ URL ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴇɴᴄᴏᴅᴇ ɪɴᴛᴏ ᴀ Qʀ ᴄᴏᴅᴇ. Fᴏʀ ᴇxᴀᴍᴘʟᴇ, `/qr https://t.me/vivekkumar07089`. Tʜᴇ ʙᴏᴛ ᴡɪʟʟ ᴛʜᴇɴ ɢᴇɴᴇʀᴀᴛᴇ ᴀ Qʀ ᴄᴏᴅᴇ ғᴏʀ ᴛʜᴇ ᴘʀᴏᴠɪᴅᴇᴅ ɪɴᴘᴜᴛ. Mᴀᴋᴇ sᴜʀᴇ ᴛᴏ ɪɴᴄʟᴜᴅᴇ ᴛʜᴇ ᴘʀᴏᴛᴏᴄᴏʟ (http:// ᴏʀ https://) ғᴏʀ URLs. Eɴᴊᴏʏ ᴄʀᴇᴀᴛɪɴɢ Qʀ ᴄᴏᴅᴇs ᴡɪᴛʜ ᴇᴀsᴇ! 22 | """ 23 | -------------------------------------------------------------------------------- /plugins/quiz.py: -------------------------------------------------------------------------------- 1 | import random 2 | import requests 3 | import time 4 | 5 | from pyrogram import filters 6 | from pyrogram.enums import PollType, ChatAction 7 | from YukkiMusic import app 8 | 9 | 10 | last_command_time = {} 11 | 12 | 13 | @app.on_message(filters.command(["quiz"])) 14 | async def quiz(client, message): 15 | user_id = message.from_user.id 16 | current_time = time.time() 17 | 18 | if user_id in last_command_time and current_time - last_command_time[user_id] < 5: 19 | await message.reply_text( 20 | "Pʟᴇᴀsᴇ ᴡᴀɪᴛ 𝟻 sᴇᴄᴏɴᴅs ʙᴇғᴏʀᴇ ᴜsɪɴɢ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴀɢᴀɪɴ." 21 | ) 22 | return 23 | 24 | last_command_time[user_id] = current_time 25 | 26 | categories = [9, 17, 18, 20, 21, 27] 27 | await app.send_chat_action(message.chat.id, ChatAction.TYPING) 28 | 29 | url = f"https://opentdb.com/api.php?amount=1&category={random.choice(categories)}&type=multiple" 30 | response = requests.get(url).json() 31 | 32 | question_data = response["results"][0] 33 | question = question_data["question"] 34 | correct_answer = question_data["correct_answer"] 35 | incorrect_answers = question_data["incorrect_answers"] 36 | 37 | all_answers = incorrect_answers + [correct_answer] 38 | random.shuffle(all_answers) 39 | 40 | cid = all_answers.index(correct_answer) 41 | await app.send_poll( 42 | chat_id=message.chat.id, 43 | question=question, 44 | options=all_answers, 45 | is_anonymous=False, 46 | type=PollType.QUIZ, 47 | correct_option_id=cid, 48 | ) 49 | 50 | 51 | __MODULE__ = "Qᴜɪᴢ" 52 | __HELP__ = " /quiz - ᴛᴏ ɢᴇᴛ ᴀɴ ʀᴀɴᴅᴏᴍ ǫᴜɪᴢ" 53 | -------------------------------------------------------------------------------- /plugins/radio.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2024 by TheTeamVivek@Github, < https://github.com/TheTeamVivek >. 3 | # 4 | # This file is part of < https://github.com/TheTeamVivek/YukkiMusic > project, 5 | # and is released under the "GNU v3.0 License Agreement". 6 | # Please see < https://github.com/TheTeamVivek/YukkiMusic/blob/master/LICENSE > 7 | # 8 | # All rights reserved. 9 | # 10 | 11 | import logging 12 | 13 | from pyrogram import filters 14 | from pyrogram.enums import ChatMemberStatus 15 | from pyrogram.errors import ( 16 | ChatAdminRequired, 17 | InviteRequestSent, 18 | UserAlreadyParticipant, 19 | UserNotParticipant, 20 | ) 21 | from pyrogram.types import Message 22 | 23 | from config import BANNED_USERS, adminlist 24 | from strings import get_string 25 | from YukkiMusic import app 26 | from YukkiMusic.misc import SUDOERS 27 | from YukkiMusic.utils.database import ( 28 | get_assistant, 29 | get_cmode, 30 | get_lang, 31 | get_playmode, 32 | get_playtype, 33 | ) 34 | from YukkiMusic.utils.logger import play_logs 35 | from YukkiMusic.utils.stream.stream import stream 36 | 37 | RADIO_STATION = { 38 | "Air Bilaspur": "http://air.pc.cdn.bitgravity.com/air/live/pbaudio110/playlist.m3u8", 39 | "Air Raipur": "http://air.pc.cdn.bitgravity.com/air/live/pbaudio118/playlist.m3u8", 40 | "Capital FM": "http://media-ice.musicradio.com/CapitalMP3?.mp3&listening-from-radio-garden=1616312105154", 41 | "English": "https://hls-01-regions.emgsound.ru/11_msk/playlist.m3u8", 42 | "Mirchi": "http://peridot.streamguys.com:7150/Mirchi", 43 | "Radio Today": "http://stream.zenolive.com/8wv4d8g4344tv", 44 | "YouTube": "https://www.youtube.com/live/eu191hR_LEc?si=T-9QYD548jd0Mogp", 45 | "Zee News": "https://www.youtube.com/live/TPcmrPrygDc?si=hiHBkIidgurQAd1P", 46 | "Aaj Tak": "https://www.youtube.com/live/Nq2wYlWFucg?si=usY4UYiSBInKA0S1", 47 | } 48 | 49 | valid_stations = "\n".join([f"`{name}`" for name in sorted(RADIO_STATION.keys())]) 50 | 51 | 52 | @app.on_message( 53 | filters.command(["radioplayforce", "radio", "cradio"]) 54 | & filters.group 55 | & ~BANNED_USERS 56 | ) 57 | async def radio(client, message: Message): 58 | msg = await message.reply_text("ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ ᴀ ᴍᴏᴍᴇɴᴛ....") 59 | try: 60 | try: 61 | userbot = await get_assistant(message.chat.id) 62 | get = await app.get_chat_member(message.chat.id, userbot.id) 63 | except ChatAdminRequired: 64 | return await msg.edit_text( 65 | f"» ɪ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴘᴇʀᴍɪssɪᴏɴs ᴛᴏ ɪɴᴠɪᴛᴇ ᴜsᴇʀs ᴠɪᴀ ʟɪɴᴋ ғᴏʀ ɪɴᴠɪᴛɪɴɢ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}." 66 | ) 67 | if get.status == ChatMemberStatus.BANNED: 68 | return await msg.edit_text( 69 | text=f"» {userbot.mention} ᴀssɪsᴛᴀɴᴛ ɪs ʙᴀɴɴᴇᴅ ɪɴ {message.chat.title}\n\n𖢵 ɪᴅ : `{userbot.id}`\n𖢵 ɴᴀᴍᴇ : {userbot.mention}\n𖢵 ᴜsᴇʀɴᴀᴍᴇ : @{userbot.username}\n\nᴘʟᴇᴀsᴇ ᴜɴʙᴀɴ ᴛʜᴇ ᴀssɪsᴛᴀɴᴛ ᴀɴᴅ ᴘʟᴀʏ ᴀɢᴀɪɴ...", 70 | ) 71 | except UserNotParticipant: 72 | if message.chat.username: 73 | invitelink = message.chat.username 74 | try: 75 | await userbot.resolve_peer(invitelink) 76 | except Exception as ex: 77 | logging.exception(ex) 78 | else: 79 | try: 80 | invitelink = await client.export_chat_invite_link(message.chat.id) 81 | except ChatAdminRequired: 82 | return await msg.edit_text( 83 | f"» ɪ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴘᴇʀᴍɪssɪᴏɴs ᴛᴏ ɪɴᴠɪᴛᴇ ᴜsᴇʀs ᴠɪᴀ ʟɪɴᴋ ғᴏʀ ɪɴᴠɪᴛɪɴɢ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}." 84 | ) 85 | except InviteRequestSent: 86 | try: 87 | await app.approve_chat_join_request(message.chat.id, userbot.id) 88 | except Exception as e: 89 | return await msg.edit( 90 | f"ғᴀɪʟᴇᴅ ᴛᴏ ɪɴᴠɪᴛᴇ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}.\n\n**ʀᴇᴀsᴏɴ :** `{ex}`" 91 | ) 92 | except Exception as ex: 93 | if "channels.JoinChannel" in str(ex) or "Username not found" in str(ex): 94 | return await msg.edit_text( 95 | f"» ɪ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴘᴇʀᴍɪssɪᴏɴs ᴛᴏ ɪɴᴠɪᴛᴇ ᴜsᴇʀs ᴠɪᴀ ʟɪɴᴋ ғᴏʀ ɪɴᴠɪᴛɪɴɢ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}." 96 | ) 97 | else: 98 | return await msg.edit_text( 99 | f"ғᴀɪʟᴇᴅ ᴛᴏ ɪɴᴠɪᴛᴇ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}.\n\n**ʀᴇᴀsᴏɴ :** `{ex}`" 100 | ) 101 | if invitelink.startswith("https://t.me/+"): 102 | invitelink = invitelink.replace("https://t.me/+", "https://t.me/joinchat/") 103 | anon = await msg.edit_text( 104 | f"ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ...\n\nɪɴᴠɪᴛɪɴɢ {userbot.mention} ᴛᴏ {message.chat.title}." 105 | ) 106 | try: 107 | await userbot.join_chat(invitelink) 108 | await asyncio.sleep(2) 109 | await msg.edit_text( 110 | f"{userbot.mention} ᴊᴏɪɴᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ,\n\nsᴛᴀʀᴛɪɴɢ sᴛʀᴇᴀᴍ..." 111 | ) 112 | except UserAlreadyParticipant: 113 | pass 114 | except InviteRequestSent: 115 | try: 116 | await app.approve_chat_join_request(message.chat.id, userbot.id) 117 | except Exception as e: 118 | return await msg.edit( 119 | f"ғᴀɪʟᴇᴅ ᴛᴏ ɪɴᴠɪᴛᴇ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}.\n\n**ʀᴇᴀsᴏɴ :** `{ex}`" 120 | ) 121 | except Exception as ex: 122 | if "channels.JoinChannel" in str(ex) or "Username not found" in str(ex): 123 | return await msg.edit_text( 124 | f"» ɪ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴘᴇʀᴍɪssɪᴏɴs ᴛᴏ ɪɴᴠɪᴛᴇ ᴜsᴇʀs ᴠɪᴀ ʟɪɴᴋ ғᴏʀ ɪɴᴠɪᴛɪɴɢ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}." 125 | ) 126 | else: 127 | return await msg.edit_text( 128 | f"ғᴀɪʟᴇᴅ ᴛᴏ ɪɴᴠɪᴛᴇ {userbot.mention} ᴀssɪsᴛᴀɴᴛ ᴛᴏ {message.chat.title}.\n\n**ʀᴇᴀsᴏɴ :** `{ex}`" 129 | ) 130 | 131 | try: 132 | await userbot.resolve_peer(invitelink) 133 | except BaseException: 134 | pass 135 | await msg.delete() 136 | station_name = " ".join(message.command[1:]) 137 | RADIO_URL = RADIO_STATION.get(station_name) 138 | if RADIO_URL: 139 | language = await get_lang(message.chat.id) 140 | _ = get_string(language) 141 | playmode = await get_playmode(message.chat.id) 142 | playty = await get_playtype(message.chat.id) 143 | if playty != "Everyone": 144 | if message.from_user.id not in SUDOERS: 145 | admins = adminlist.get(message.chat.id) 146 | if not admins: 147 | return await message.reply_text(_["admin_18"]) 148 | else: 149 | if message.from_user.id not in admins: 150 | return await message.reply_text(_["play_4"]) 151 | if message.command[0][0] == "c": 152 | chat_id = await get_cmode(message.chat.id) 153 | if chat_id is None: 154 | return await message.reply_text(_["setting_12"]) 155 | try: 156 | chat = await app.get_chat(chat_id) 157 | except BaseException: 158 | return await message.reply_text(_["cplay_4"]) 159 | channel = chat.title 160 | else: 161 | chat_id = message.chat.id 162 | channel = None 163 | 164 | video = None 165 | mystic = await message.reply_text( 166 | _["play_2"].format(channel) if channel else _["play_1"] 167 | ) 168 | try: 169 | await stream( 170 | _, 171 | mystic, 172 | message.from_user.id, 173 | RADIO_URL, 174 | chat_id, 175 | message.from_user.mention, 176 | message.chat.id, 177 | video=video, 178 | streamtype="index", 179 | ) 180 | except Exception as e: 181 | ex_type = type(e).__name__ 182 | err = e if ex_type == "AssistantErr" else _["general_3"].format(ex_type) 183 | return await mystic.edit_text(err) 184 | return await play_logs(message, streamtype="M3u8 or Index Link") 185 | else: 186 | await message.reply( 187 | f"ɢɪᴠᴇ ᴍᴇ ᴀ sᴛᴀᴛɪᴏɴ ɴᴀᴍᴇ ᴛᴏ ᴘʟᴀʏ ʀᴀᴅɪᴏ\nʙᴇʟᴏᴡ ᴀʀᴇ sᴏᴍᴇ sᴛᴀᴛɪᴏɴ ɴᴀᴍᴇ:\n{valid_stations}" 188 | ) 189 | 190 | 191 | __MODULE__ = "Rᴀᴅɪᴏ" 192 | __HELP__ = f"\n/radio [sᴛᴀᴛɪᴏɴ ɴᴀᴍᴇ] - ᴛᴏ ᴘʟᴀʏ **ʀᴀᴅɪᴏ ɪɴ ᴠᴏɪᴄᴇ ᴄʜᴀᴛ**\n\nʙᴇʟᴏᴡ ᴀʀᴇ sᴏᴍᴇ sᴛᴀᴛɪᴏɴ ɴᴀᴍᴇ:\n{valid_stations}" 193 | -------------------------------------------------------------------------------- /plugins/slap.py: -------------------------------------------------------------------------------- 1 | from YukkiMusic import app 2 | from pyrogram import filters 3 | import nekos 4 | 5 | 6 | @app.on_message(filters.command("slap")) 7 | async def slap(client, message): 8 | try: 9 | if message.reply_to_message: 10 | await message.reply_video( 11 | nekos.img("slap"), 12 | caption=f"{message.from_user.mention} sʟᴀᴘᴘᴇᴅ {message.reply_to_message.from_user.mention}", 13 | ) 14 | else: 15 | await message.reply_video(nekos.img("slap")) 16 | except Exception as e: 17 | await message.reply_text(f"Error: {e}") 18 | 19 | 20 | __HELP__ = """ 21 | Aᴠᴀɪʟᴀʙʟᴇ ᴄᴏᴍᴍᴀɴᴅs: 22 | - /sʟᴀᴘ: Sʟᴀᴘs sᴏᴍᴇᴏɴᴇ. Iғ ᴜsᴇᴅ ᴀs ᴀ ʀᴇᴘʟʏ, sʟᴀᴘs ᴛʜᴇ ʀᴇᴘʟɪᴇᴅ ᴜsᴇʀ. 23 | """ 24 | __MODULE__ = "Sʟᴀᴘ" 25 | -------------------------------------------------------------------------------- /plugins/sticker.py: -------------------------------------------------------------------------------- 1 | import imghdr 2 | import math 3 | import os 4 | from asyncio import gather 5 | from traceback import format_exc 6 | from typing import List 7 | 8 | from PIL import Image 9 | from pyrogram import Client, errors, filters, raw 10 | from pyrogram.errors import ( 11 | PeerIdInvalid, 12 | ShortnameOccupyFailed, 13 | StickerEmojiInvalid, 14 | StickerPngDimensions, 15 | StickerPngNopng, 16 | UserIsBlocked, 17 | ) 18 | from pyrogram.file_id import FileId 19 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 20 | 21 | from YukkiMusic import app 22 | from utils.error import capture_err 23 | 24 | BOT_USERNAME = app.username 25 | 26 | MAX_STICKERS = ( 27 | 120 # would be better if we could fetch this limit directly from telegram 28 | ) 29 | SUPPORTED_TYPES = ["jpeg", "png", "webp"] 30 | STICKER_DIMENSIONS = (512, 512) 31 | 32 | 33 | async def get_sticker_set_by_name( 34 | client: Client, name: str 35 | ) -> raw.base.messages.StickerSet: 36 | try: 37 | return await client.invoke( 38 | raw.functions.messages.GetStickerSet( 39 | stickerset=raw.types.InputStickerSetShortName(short_name=name), 40 | hash=0, 41 | ) 42 | ) 43 | except errors.exceptions.not_acceptable_406.StickersetInvalid: 44 | return None 45 | 46 | 47 | # Known errors: (I don't see a reason to catch them as we, for sure, won't face them right now): 48 | # errors.exceptions.bad_request_400.PackShortNameInvalid -> pack name needs to end with _by_botname 49 | # errors.exceptions.bad_request_400.ShortnameOccupyFailed -> pack's name 50 | # is already in use 51 | 52 | 53 | async def create_sticker_set( 54 | client: Client, 55 | owner: int, 56 | title: str, 57 | short_name: str, 58 | stickers: List[raw.base.InputStickerSetItem], 59 | ) -> raw.base.messages.StickerSet: 60 | return await client.invoke( 61 | raw.functions.stickers.CreateStickerSet( 62 | user_id=await client.resolve_peer(owner), 63 | title=title, 64 | short_name=short_name, 65 | stickers=stickers, 66 | ) 67 | ) 68 | 69 | 70 | async def add_sticker_to_set( 71 | client: Client, 72 | stickerset: raw.base.messages.StickerSet, 73 | sticker: raw.base.InputStickerSetItem, 74 | ) -> raw.base.messages.StickerSet: 75 | return await client.invoke( 76 | raw.functions.stickers.AddStickerToSet( 77 | stickerset=raw.types.InputStickerSetShortName( 78 | short_name=stickerset.set.short_name 79 | ), 80 | sticker=sticker, 81 | ) 82 | ) 83 | 84 | 85 | async def create_sticker( 86 | sticker: raw.base.InputDocument, emoji: str 87 | ) -> raw.base.InputStickerSetItem: 88 | return raw.types.InputStickerSetItem(document=sticker, emoji=emoji) 89 | 90 | 91 | async def resize_file_to_sticker_size(file_path: str) -> str: 92 | im = Image.open(file_path) 93 | if (im.width, im.height) < STICKER_DIMENSIONS: 94 | size1 = im.width 95 | size2 = im.height 96 | if im.width > im.height: 97 | scale = STICKER_DIMENSIONS[0] / size1 98 | size1new = STICKER_DIMENSIONS[0] 99 | size2new = size2 * scale 100 | else: 101 | scale = STICKER_DIMENSIONS[1] / size2 102 | size1new = size1 * scale 103 | size2new = STICKER_DIMENSIONS[1] 104 | size1new = math.floor(size1new) 105 | size2new = math.floor(size2new) 106 | sizenew = (size1new, size2new) 107 | im = im.resize(sizenew) 108 | else: 109 | im.thumbnail(STICKER_DIMENSIONS) 110 | try: 111 | os.remove(file_path) 112 | file_path = f"{file_path}.png" 113 | return file_path 114 | finally: 115 | im.save(file_path) 116 | 117 | 118 | async def upload_document( 119 | client: Client, file_path: str, chat_id: int 120 | ) -> raw.base.InputDocument: 121 | media = await client.invoke( 122 | raw.functions.messages.UploadMedia( 123 | peer=await client.resolve_peer(chat_id), 124 | media=raw.types.InputMediaUploadedDocument( 125 | mime_type=client.guess_mime_type(file_path) or "application/zip", 126 | file=await client.save_file(file_path), 127 | attributes=[ 128 | raw.types.DocumentAttributeFilename( 129 | file_name=os.path.basename(file_path) 130 | ) 131 | ], 132 | ), 133 | ) 134 | ) 135 | return raw.types.InputDocument( 136 | id=media.document.id, 137 | access_hash=media.document.access_hash, 138 | file_reference=media.document.file_reference, 139 | ) 140 | 141 | 142 | async def get_document_from_file_id( 143 | file_id: str, 144 | ) -> raw.base.InputDocument: 145 | decoded = FileId.decode(file_id) 146 | return raw.types.InputDocument( 147 | id=decoded.media_id, 148 | access_hash=decoded.access_hash, 149 | file_reference=decoded.file_reference, 150 | ) 151 | 152 | 153 | @app.on_message(filters.command("stickerid")) 154 | @capture_err 155 | async def sticker_id(_, message: Message): 156 | reply = message.reply_to_message 157 | 158 | if not reply: 159 | return await message.reply("Reply to a sticker.") 160 | 161 | if not reply.sticker: 162 | return await message.reply("Reply to a sticker.") 163 | 164 | await message.reply_text(f"`{reply.sticker.file_id}`") 165 | 166 | 167 | @app.on_message(filters.command("getsticker")) 168 | @capture_err 169 | async def sticker_image(_, message: Message): 170 | r = message.reply_to_message 171 | 172 | if not r: 173 | return await message.reply("Reply to a sticker.") 174 | 175 | if not r.sticker: 176 | return await message.reply("Reply to a sticker.") 177 | 178 | m = await message.reply("Sending..") 179 | f = await r.download(f"{r.sticker.file_unique_id}.png") 180 | 181 | await gather( 182 | *[ 183 | message.reply_photo(f), 184 | message.reply_document(f), 185 | ] 186 | ) 187 | 188 | await m.delete() 189 | os.remove(f) 190 | 191 | 192 | @app.on_message(filters.command("kang")) 193 | @capture_err 194 | async def kang(client, message: Message): 195 | if not message.reply_to_message: 196 | return await message.reply_text("Reply to a sticker/image to kang it.") 197 | if not message.from_user: 198 | return await message.reply_text("You are anon admin, kang stickers in my pm.") 199 | msg = await message.reply_text("Kanging Sticker..") 200 | 201 | # Find the proper emoji 202 | args = message.text.split() 203 | if len(args) > 1: 204 | sticker_emoji = str(args[1]) 205 | elif message.reply_to_message.sticker and message.reply_to_message.sticker.emoji: 206 | sticker_emoji = message.reply_to_message.sticker.emoji 207 | else: 208 | sticker_emoji = "🤔" 209 | 210 | # Get the corresponding fileid, resize the file if necessary 211 | doc = message.reply_to_message.photo or message.reply_to_message.document 212 | try: 213 | if message.reply_to_message.sticker: 214 | sticker = await create_sticker( 215 | await get_document_from_file_id( 216 | message.reply_to_message.sticker.file_id 217 | ), 218 | sticker_emoji, 219 | ) 220 | elif doc: 221 | if doc.file_size > 10000000: 222 | return await msg.edit("File size too large.") 223 | 224 | temp_file_path = await app.download_media(doc) 225 | image_type = imghdr.what(temp_file_path) 226 | if image_type not in SUPPORTED_TYPES: 227 | return await msg.edit("Format not supported! ({})".format(image_type)) 228 | try: 229 | temp_file_path = await resize_file_to_sticker_size(temp_file_path) 230 | except OSError as e: 231 | await msg.edit_text("Something wrong happened.") 232 | raise Exception( 233 | f"Something went wrong while resizing the sticker (at {temp_file_path}); {e}" 234 | ) 235 | sticker = await create_sticker( 236 | await upload_document(client, temp_file_path, message.chat.id), 237 | sticker_emoji, 238 | ) 239 | if os.path.isfile(temp_file_path): 240 | os.remove(temp_file_path) 241 | else: 242 | return await msg.edit("Nope, can't kang that.") 243 | except ShortnameOccupyFailed: 244 | await message.reply_text("Change Your Name Or Username") 245 | return 246 | 247 | except Exception as e: 248 | await message.reply_text(str(e)) 249 | e = format_exc() 250 | return print(e) 251 | 252 | # Find an available pack & add the sticker to the pack; create a new pack if needed 253 | # Would be a good idea to cache the number instead of searching it every 254 | # single time... 255 | packnum = 0 256 | packname = "f" + str(message.from_user.id) + "_by_" + BOT_USERNAME 257 | limit = 0 258 | try: 259 | while True: 260 | # Prevent infinite rules 261 | if limit >= 50: 262 | return await msg.delete() 263 | 264 | stickerset = await get_sticker_set_by_name(client, packname) 265 | if not stickerset: 266 | stickerset = await create_sticker_set( 267 | client, 268 | message.from_user.id, 269 | f"{message.from_user.first_name[:32]}'s kang pack", 270 | packname, 271 | [sticker], 272 | ) 273 | elif stickerset.set.count >= MAX_STICKERS: 274 | packnum += 1 275 | packname = ( 276 | "f" 277 | + str(packnum) 278 | + "_" 279 | + str(message.from_user.id) 280 | + "_by_" 281 | + BOT_USERNAME 282 | ) 283 | limit += 1 284 | continue 285 | else: 286 | try: 287 | await add_sticker_to_set(client, stickerset, sticker) 288 | except StickerEmojiInvalid: 289 | return await msg.edit("[ERROR]: INVALID_EMOJI_IN_ARGUMENT") 290 | limit += 1 291 | break 292 | 293 | await msg.edit( 294 | "Sticker Kanged To [Pack](t.me/addstickers/{})\nEmoji: {}".format( 295 | packname, sticker_emoji 296 | ) 297 | ) 298 | except (PeerIdInvalid, UserIsBlocked): 299 | keyboard = InlineKeyboardMarkup( 300 | [[InlineKeyboardButton(text="Start", url=f"t.me/{BOT_USERNAME}")]] 301 | ) 302 | await msg.edit( 303 | "You Need To Start A Private Chat With Me.", 304 | reply_markup=keyboard, 305 | ) 306 | except StickerPngNopng: 307 | await message.reply_text( 308 | "Stickers must be png files but the provided image was not a png" 309 | ) 310 | except StickerPngDimensions: 311 | await message.reply_text("The sticker png dimensions are invalid.") 312 | 313 | 314 | __MODULE__ = "Sᴛɪᴄᴋᴇʀ" 315 | __HELP__ = """ 316 | **COMMANDS:** 317 | 318 | • /stickerid - **ɢᴇᴛs ᴛʜᴇ ғɪʟᴇ ɪᴅ ᴏғ ᴀɴʏ ʀᴇᴘʟɪᴇᴅ sᴛɪᴄᴋᴇʀ.** 319 | • /getsticker - **ɢᴇᴛs ᴛʜᴇ ɪᴍᴀɢᴇ ᴏғ ᴀɴʏ ʀᴇᴘʟɪᴇᴅ sᴛɪᴄᴋᴇʀ.** 320 | • /kang - **ᴋᴀɴɢs ᴀɴʏ sᴛɪᴄᴋᴇʀ ɪɴ ᴛʜᴇ ʏᴏᴜ ᴘᴀᴄᴋ** 321 | 322 | **INFO:** 323 | 324 | - ᴛʜɪs ʙᴏᴛ ᴀʟʟᴏᴡs ᴜsᴇʀs ᴛᴏ ɢᴇᴛ ᴛʜᴇ ғɪʟᴇ ɪᴅ ᴏʀ ᴛʜᴇ ɪᴍᴀɢᴇ ᴏғ ᴀɴʏ sᴛɪᴄᴋᴇʀ ᴛʜᴀᴛ ɪs ʀᴇᴘʟɪᴇᴅ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ, ᴀɴᴅ ᴀʟsᴏ ᴀʟʟᴏᴡs ᴜsᴇʀs ᴛᴏ ᴋᴀɴɢ ᴀɴʏ sᴛɪᴄᴋᴇʀ ɪɴ ᴛʜᴇ ᴄʜᴀᴛ ᴀɴᴅ ᴀᴅᴅ ɪᴛ ᴛᴏ ᴀ sᴛɪᴄᴋᴇʀ ᴘᴀᴄᴋ. 325 | """ 326 | -------------------------------------------------------------------------------- /plugins/tagall.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from pyrogram import filters 3 | from pyrogram.enums import ChatMembersFilter 4 | 5 | from pyrogram.errors import FloodWait 6 | 7 | from YukkiMusic import app 8 | 9 | 10 | SPAM_CHATS = [] 11 | 12 | 13 | async def is_admin(chat_id, user_id): 14 | admin_ids = [ 15 | admin.user.id 16 | async for admin in app.get_chat_members( 17 | chat_id, filter=ChatMembersFilter.ADMINISTRATORS 18 | ) 19 | ] 20 | if user_id in admin_ids: 21 | return True 22 | return False 23 | 24 | 25 | @app.on_message( 26 | filters.command(["all", "allmention", "mentionall", "tagall"], prefixes=["/", "@"]) 27 | ) 28 | async def tag_all_users(_, message): 29 | admin = await is_admin(message.chat.id, message.from_user.id) 30 | if not admin: 31 | return 32 | 33 | if message.chat.id in SPAM_CHATS: 34 | return await message.reply_text( 35 | "ᴛᴀɢɢɪɴɢ ᴘʀᴏᴄᴇss ɪs ᴀʟʀᴇᴀᴅʏ ʀᴜɴɴɪɴɢ ɪғ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ sᴛᴏᴘ sᴏ ᴜsᴇ /cancel" 36 | ) 37 | replied = message.reply_to_message 38 | if len(message.command) < 2 and not replied: 39 | await message.reply_text( 40 | "** ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ ᴛᴏ ᴛᴀɢ ᴀʟʟ, ʟɪᴋᴇ »** `@all Hi Friends`" 41 | ) 42 | return 43 | if replied: 44 | usernum = 0 45 | usertxt = "" 46 | try: 47 | SPAM_CHATS.append(message.chat.id) 48 | async for m in app.get_chat_members(message.chat.id): 49 | if message.chat.id not in SPAM_CHATS: 50 | break 51 | if m.user.is_deleted or m.user.is_bot: 52 | continue 53 | usernum += 1 54 | usertxt += f"[{m.user.first_name}](tg://user?id={m.user.id}) " 55 | if usernum == 7: 56 | await replied.reply_text( 57 | usertxt, 58 | disable_web_page_preview=True, 59 | ) 60 | await asyncio.sleep(1) 61 | usernum = 0 62 | usertxt = "" 63 | 64 | if usernum != 0: 65 | await replied.reply_text( 66 | usertxt, 67 | disable_web_page_preview=True, 68 | ) 69 | except FloodWait as e: 70 | await asyncio.sleep(e.value) 71 | try: 72 | SPAM_CHATS.remove(message.chat.id) 73 | except Exception: 74 | pass 75 | else: 76 | try: 77 | usernum = 0 78 | usertxt = "" 79 | text = message.text.split(None, 1)[1] 80 | SPAM_CHATS.append(message.chat.id) 81 | async for m in app.get_chat_members(message.chat.id): 82 | if message.chat.id not in SPAM_CHATS: 83 | break 84 | if m.user.is_deleted or m.user.is_bot: 85 | continue 86 | usernum += 1 87 | usertxt += f"[{m.user.first_name}](tg://user?id={m.user.id}) " 88 | if usernum == 7: 89 | await app.send_message( 90 | message.chat.id, 91 | f"{text}\n{usertxt}", 92 | disable_web_page_preview=True, 93 | ) 94 | await asyncio.sleep(2) 95 | usernum = 0 96 | usertxt = "" 97 | if usernum != 0: 98 | await app.send_message( 99 | message.chat.id, 100 | f"{text}\n\n{usertxt}", 101 | disable_web_page_preview=True, 102 | ) 103 | except FloodWait as e: 104 | await asyncio.sleep(e.value) 105 | try: 106 | SPAM_CHATS.remove(message.chat.id) 107 | except Exception: 108 | pass 109 | 110 | 111 | async def tag_all_admins(_, message): 112 | if message.chat.id in SPAM_CHATS: 113 | return await message.reply_text( 114 | "ᴛᴀɢɢɪɴɢ ᴘʀᴏᴄᴇss ɪs ᴀʟʀᴇᴀᴅʏ ʀᴜɴɴɪɴɢ ɪғ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ sᴛᴏᴘ sᴏ ᴜsᴇ /cancel" 115 | ) 116 | replied = message.reply_to_message 117 | if len(message.command) < 2 and not replied: 118 | await message.reply_text( 119 | "** ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ ᴛᴏ ᴛᴀɢ ᴀʟʟ, ʟɪᴋᴇ »** `@admins Hi Friends`" 120 | ) 121 | return 122 | if replied: 123 | usernum = 0 124 | usertxt = "" 125 | try: 126 | SPAM_CHATS.append(message.chat.id) 127 | async for m in app.get_chat_members( 128 | message.chat.id, filter=ChatMembersFilter.ADMINISTRATORS 129 | ): 130 | if message.chat.id not in SPAM_CHATS: 131 | break 132 | if m.user.is_deleted or m.user.is_bot: 133 | continue 134 | usernum += 1 135 | usertxt += f"[{m.user.first_name}](tg://user?id={m.user.id}) " 136 | if usernum == 7: 137 | await replied.reply_text( 138 | usertxt, 139 | disable_web_page_preview=True, 140 | ) 141 | await asyncio.sleep(1) 142 | usernum = 0 143 | usertxt = "" 144 | if usernum != 0: 145 | await replied.reply_text( 146 | usertxt, 147 | disable_web_page_preview=True, 148 | ) 149 | except FloodWait as e: 150 | await asyncio.sleep(e.value) 151 | try: 152 | SPAM_CHATS.remove(message.chat.id) 153 | except Exception: 154 | pass 155 | else: 156 | usernum = 0 157 | usertxt = "" 158 | try: 159 | text = message.text.split(None, 1)[1] 160 | SPAM_CHATS.append(message.chat.id) 161 | async for m in app.get_chat_members( 162 | message.chat.id, filter=ChatMembersFilter.ADMINISTRATORS 163 | ): 164 | if message.chat.id not in SPAM_CHATS: 165 | break 166 | if m.user.is_deleted or m.user.is_bot: 167 | continue 168 | usernum += 1 169 | usertxt += f"[{m.user.first_name}](tg://user?id={m.user.id}) " 170 | if usernum == 7: 171 | await app.send_message( 172 | message.chat.id, 173 | f"{text}\n{usertxt}", 174 | disable_web_page_preview=True, 175 | ) 176 | await asyncio.sleep(2) 177 | usernum = 0 178 | usertxt = "" 179 | if usernum != 0: 180 | await app.send_message( 181 | message.chat.id, 182 | f"{text}\n\n{usertxt}", 183 | disable_web_page_preview=True, 184 | ) 185 | except FloodWait as e: 186 | await asyncio.sleep(e.value) 187 | try: 188 | SPAM_CHATS.remove(message.chat.id) 189 | except Exception: 190 | pass 191 | 192 | 193 | @app.on_message( 194 | filters.command(["admin", "admins", "report"], prefixes=["/", "@"]) & filters.group 195 | ) 196 | async def admintag_with_reporting(client, message): 197 | if not message.from_user: 198 | return 199 | chat_id = message.chat.id 200 | from_user_id = message.from_user.id 201 | admins = [ 202 | admin.user.id 203 | async for admin in client.get_chat_members( 204 | chat_id, filter=ChatMembersFilter.ADMINISTRATORS 205 | ) 206 | ] 207 | if message.command[0] == "report": 208 | if from_user_id in admins: 209 | return await message.reply_text( 210 | "ᴏᴘᴘs! ʏᴏᴜ ᴀʀᴇ ʟᴏᴏᴋs ʟɪᴋᴇ ᴀɴ ᴀᴅᴍɪɴ!\nʏᴏᴜ ᴄᴀɴ'ᴛ ʀᴇᴘᴏʀᴛ ᴀɴʏ ᴜsᴇʀs ᴛᴏ ᴀᴅᴍɪɴ" 211 | ) 212 | 213 | if from_user_id in admins: 214 | return await tag_all_admins(client, message) 215 | 216 | if len(message.text.split()) <= 1 and not message.reply_to_message: 217 | return await message.reply_text("Reply to a message to report that user.") 218 | 219 | reply = message.reply_to_message or message 220 | reply_user_id = reply.from_user.id if reply.from_user else reply.sender_chat.id 221 | linked_chat = (await client.get_chat(chat_id)).linked_chat 222 | if reply_user_id == app.id: 223 | return await message.reply_text("Why would I report myself?") 224 | if ( 225 | reply_user_id in admins 226 | or reply_user_id == chat_id 227 | or (linked_chat and reply_user_id == linked_chat.id) 228 | ): 229 | return await message.reply_text( 230 | "Do you know that the user you are replying to is an admin?" 231 | ) 232 | 233 | user_mention = reply.from_user.mention if reply.from_user else "the user" 234 | text = f"Reported {user_mention} to admins!." 235 | 236 | for admin in admins: 237 | admin_member = await client.get_chat_member(chat_id, admin) 238 | if not admin_member.user.is_bot and not admin_member.user.is_deleted: 239 | text += f"[\u2063](tg://user?id={admin})" 240 | 241 | await reply.reply_text(text) 242 | 243 | 244 | @app.on_message( 245 | filters.command( 246 | [ 247 | "stopmention", 248 | "cancel", 249 | "cancelmention", 250 | "offmention", 251 | "mentionoff", 252 | "cancelall", 253 | ], 254 | prefixes=["/", "@"], 255 | ) 256 | ) 257 | async def cancelcmd(_, message): 258 | chat_id = message.chat.id 259 | admin = await is_admin(chat_id, message.from_user.id) 260 | if not admin: 261 | return 262 | if chat_id in SPAM_CHATS: 263 | try: 264 | SPAM_CHATS.remove(chat_id) 265 | except Exception: 266 | pass 267 | return await message.reply_text("**ᴛᴀɢɢɪɴɢ ᴘʀᴏᴄᴇss sᴜᴄᴄᴇssғᴜʟʟʏ sᴛᴏᴘᴘᴇᴅ!**") 268 | 269 | else: 270 | await message.reply_text("**ɴᴏ ᴘʀᴏᴄᴇss ᴏɴɢᴏɪɴɢ!**") 271 | return 272 | 273 | 274 | __MODULE__ = "Tᴀɢᴀʟʟ" 275 | __HELP__ = """ 276 | 277 | @all ᴏʀ /all | /tagall ᴏʀ @tagall | /mentionall ᴏʀ @mentionall [ᴛᴇxᴛ] ᴏʀ [ʀᴇᴘʟʏ ᴛᴏ ᴀɴʏ ᴍᴇssᴀɢᴇ] ᴛᴏ ᴛᴀɢ ᴀʟʟ ᴜsᴇʀ's ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ ʙᴛ ʙᴏᴛ 278 | 279 | /admins | @admins | /report [ᴛᴇxᴛ] ᴏʀ [ʀᴇᴘʟʏ ᴛᴏ ᴀɴʏ ᴍᴇssᴀɢᴇ] ᴛᴏ ᴛᴀɢ ᴀʟʟ ᴀᴅᴍɪɴ's ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ 280 | 281 | 282 | /cancel Oʀ @cancel | /offmention Oʀ @offmention | /mentionoff Oʀ @mentionoff | /cancelall Oʀ @cancelall - ᴛᴏ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴀɴʏ ᴛᴀɢ ᴘʀᴏᴄᴇss 283 | 284 | **__Nᴏᴛᴇ__** Tʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴄᴀɴ ᴏɴʟʏ ᴜsᴇ ᴛʜᴇ Aᴅᴍɪɴs ᴏғ Cʜᴀᴛ ᴀɴᴅ ᴍᴀᴋᴇ Sᴜʀᴇ Bᴏᴛ ᴀɴᴅ ᴀssɪsᴛᴀɴᴛ ɪs ᴀɴ ᴀᴅᴍɪɴ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ's 285 | """ 286 | -------------------------------------------------------------------------------- /plugins/telegraph.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pyrogram import filters 3 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 4 | from telegraph import upload_file 5 | from YukkiMusic import app 6 | 7 | 8 | @app.on_message(filters.command(["tgm", "tgt", "telegraph", "tl"])) 9 | async def get_link_group(client, message): 10 | if not message.reply_to_message: 11 | return await message.reply_text( 12 | "Pʟᴇᴀsᴇ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇᴅɪᴀ ᴛᴏ ᴜᴘʟᴏᴀᴅ ᴏɴ Tᴇʟᴇɢʀᴀᴘʜ" 13 | ) 14 | 15 | media = message.reply_to_message 16 | file_size = 0 17 | if media.photo: 18 | file_size = media.photo.file_size 19 | elif media.video: 20 | file_size = media.video.file_size 21 | elif media.document: 22 | file_size = media.document.file_size 23 | 24 | if file_size > 5 * 1024 * 1024: 25 | return await message.reply_text("Pʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴀ ᴍᴇᴅɪᴀ ғɪʟᴇ ᴜɴᴅᴇʀ 𝟻MB.") 26 | try: 27 | text = await message.reply("Pʀᴏᴄᴇssɪɴɢ...") 28 | 29 | async def progress(current, total): 30 | await text.edit_text(f"📥 Dᴏᴡɴʟᴏᴀᴅɪɴɢ... {current * 100 / total:.1f}%") 31 | 32 | try: 33 | local_path = await media.download(progress=progress) 34 | await text.edit_text("📤Uᴘʟᴏᴀᴅɪɴɢ ᴛᴏ ᴛᴇʟᴇɢʀᴀᴘʜ...") 35 | upload_path = upload_file(local_path) 36 | await text.edit_text( 37 | f"🌐 | [ᴛᴇʟᴇɢʀᴀᴘʜ ʟɪɴᴋ](https://telegra.ph{upload_path[0]})", 38 | reply_markup=InlineKeyboardMarkup( 39 | [ 40 | [ 41 | InlineKeyboardButton( 42 | "ᴛᴇʟᴇɢʀᴀᴘʜ ʟɪɴᴋ", 43 | url=f"https://telegra.ph{upload_path[0]}", 44 | ) 45 | ] 46 | ] 47 | ), 48 | ) 49 | try: 50 | os.remove(local_path) 51 | except Exception: 52 | pass 53 | except Exception as e: 54 | await text.edit_text(f"❌ Fɪʟᴇ ᴜᴘʟᴏᴀᴅ ғᴀɪʟᴇᴅ\n\nRᴇᴀsᴏɴ: {e}") 55 | try: 56 | os.remove(local_path) 57 | except Exception: 58 | pass 59 | return 60 | except Exception: 61 | pass 62 | 63 | 64 | __HELP__ = """ 65 | **ᴛᴇʟᴇɢʀᴀᴘʜ ᴜᴘʟᴏᴀᴅ ʙᴏᴛ ᴄᴏᴍᴍᴀɴᴅs** 66 | 67 | ᴜsᴇ ᴛʜᴇsᴇ ᴄᴏᴍᴍᴀɴᴅs ᴛᴏ ᴜᴘʟᴏᴀᴅ ᴍᴇᴅɪᴀ ᴛᴏ ᴛᴇʟᴇɢʀᴀᴘʜ: 68 | 69 | - `/tgm`: ᴜᴘʟᴏᴀᴅ ʀᴇᴘʟɪᴇᴅ ᴍᴇᴅɪᴀ ᴛᴏ ᴛᴇʟᴇɢʀᴀᴘʜ. 70 | - `/tgt`: sᴀᴍᴇ ᴀs `/tgm`. 71 | - `/telegraph`: sᴀᴍᴇ ᴀs `/tgm`. 72 | - `/tl`: sᴀᴍᴇ ᴀs `/tgm`. 73 | 74 | **ᴇxᴀᴍᴘʟᴇ:** 75 | - ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴘʜᴏᴛᴏ ᴏʀ ᴠɪᴅᴇᴏ ᴡɪᴛʜ `/tgm` ᴛᴏ ᴜᴘʟᴏᴀᴅ ɪᴛ. 76 | 77 | **ɴᴏᴛᴇ:** 78 | ʏᴏᴜ ᴍᴜsᴛ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇᴅɪᴀ ғɪʟᴇ ғᴏʀ ᴛʜᴇ ᴜᴘʟᴏᴀᴅ ᴛᴏ ᴡᴏʀᴋ. 79 | """ 80 | 81 | __MODULE__ = "Tᴇʟᴇɢʀᴀᴘʜ" 82 | -------------------------------------------------------------------------------- /plugins/thumb.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from pyrogram import filters 4 | 5 | from YukkiMusic import app 6 | from youtubesearchpython.__future__ import VideosSearch 7 | 8 | 9 | async def gen_infos(url): 10 | results = VideosSearch(url, limit=1) 11 | for result in (await results.next())["result"]: 12 | title = result["title"] 13 | thumbnail = result["thumbnails"][0]["url"].split("?")[0] 14 | return title, thumbnail 15 | 16 | 17 | def is_url(url): 18 | regex = r"(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})" 19 | match = re.match(regex, url) 20 | if match: 21 | return True, match.group(1) 22 | return False, None 23 | 24 | 25 | @app.on_message( 26 | filters.command(["getthumb", "genthumb", "thumb", "thumbnail"], prefixes="/") 27 | ) 28 | async def get_thumbnail_command(client, message): 29 | if len(message.command) < 2: 30 | return await message.reply_text( 31 | "ᴘʀᴏᴠɪᴅᴇ ᴍᴇ ᴀ ʏᴛ ᴠɪᴅᴇᴏᴜʀʟ ᴀғᴛᴇʀ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ɢᴇᴛ ᴛʜᴜᴍʙɴᴀɪʟ" 32 | ) 33 | try: 34 | a = await message.reply_text("ᴘʀᴏᴄᴇssɪɴɢ...") 35 | url = message.text.split(" ")[1] 36 | i, video_id = is_url(url) 37 | if not i: 38 | return await a.edit("ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴀ ᴠᴀʟɪᴅ ʏᴏᴜᴛᴜʙᴇ ʟɪɴᴋ.") 39 | 40 | title, thumb = await gen_infos(url) 41 | caption = f"[{title}](https://t.me/{app.username}?start=info_{video_id})" 42 | await message.reply_photo(thumb, caption=caption) 43 | await a.delete() 44 | except Exception as e: 45 | await a.edit(f"ᴀɴ ᴇʀʀᴏʀʀ ᴏᴄᴜʀʀᴇᴅ: {e}") 46 | 47 | 48 | __HELP__ = """ 49 | **ʏᴏᴜᴛᴜʙᴇ ᴛʜᴜᴍʙɴᴀɪʟ ʙᴏᴛ ᴄᴏᴍᴍᴀɴᴅs** 50 | 51 | ᴜsᴇ ᴛʜᴇsᴇ ᴄᴏᴍᴍᴀɴᴅs ᴛᴏ ɢᴇᴛ ᴛʜᴇ ᴛʜᴜᴍʙɴᴀɪʟ ғʀᴏᴍ ᴀ ʏᴏᴜᴛᴜʙᴇ ᴠɪᴅᴇᴏ: 52 | 53 | - /getthumb <ʏᴏᴜᴛᴜʙᴇ_ᴜʀʟ>: ɢᴇᴛ ᴛʜᴇ ᴛʜᴜᴍʙɴᴀɪʟ ғᴏʀ ᴀ ʏᴏᴜᴛᴜʙᴇ ᴠɪᴅᴇᴏ. 54 | 55 | - /genthumb <ʏᴏᴜᴛᴜʙᴇ_ᴜʀʟ>: sᴀᴍᴇ ᴀs /getthumb. 56 | 57 | - /thumb <ʏᴏᴜᴛᴜʙᴇ_ᴜʀʟ>: sᴀᴍᴇ ᴀs /getthumb. 58 | 59 | - /thumbnail <ʏᴏᴜᴛᴜʙᴇ_ᴜʀʟ>: sᴀᴍᴇ ᴀs /getthumb. 60 | 61 | 62 | **ᴇxᴀᴍᴘʟᴇ:** 63 | - `/getthumb https://www.youtube.com/watch?v=Tl4bQBfOtbg` 64 | 65 | **ɴᴏᴛᴇ:** 66 | ᴘʀᴏᴠɪᴅᴇ ᴀ ᴠᴀʟɪᴅ ʏᴏᴜᴛᴜʙᴇ ᴜʀʟ ᴀғᴛᴇʀ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ɢᴇᴛ ᴛʜᴇ ᴛʜᴜᴍʙɴᴀɪʟ. 67 | """ 68 | 69 | __MODULE__ = "Yᴛʜᴜᴍʙ" 70 | -------------------------------------------------------------------------------- /plugins/truth.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | 4 | from YukkiMusic import app 5 | 6 | truth_api_url = "https://api.truthordarebot.xyz/v1/truth" 7 | dare_api_url = "https://api.truthordarebot.xyz/v1/dare" 8 | 9 | 10 | @app.on_message(filters.command("truth")) 11 | def get_truth(client, message): 12 | try: 13 | response = requests.get(truth_api_url) 14 | if response.status_code == 200: 15 | truth_question = response.json()["question"] 16 | message.reply_text(f"Truth question:\n\n{truth_question}") 17 | else: 18 | message.reply_text( 19 | "Failed to fetch a truth question. Please try again later." 20 | ) 21 | except Exception as e: 22 | message.reply_text( 23 | "An error occurred while fetching a truth question. Please try again later." 24 | ) 25 | 26 | 27 | @app.on_message(filters.command("dare")) 28 | def get_dare(client, message): 29 | try: 30 | response = requests.get(dare_api_url) 31 | if response.status_code == 200: 32 | dare_question = response.json()["question"] 33 | message.reply_text(f"Dare question:\n\n{dare_question}") 34 | else: 35 | message.reply_text( 36 | "Failed to fetch a dare question. Please try again later." 37 | ) 38 | except Exception as e: 39 | message.reply_text( 40 | "An error occurred while fetching a dare question. Please try again later." 41 | ) 42 | 43 | 44 | __HELP__ = """ 45 | **ᴛʀᴜᴛʜ ᴏʀ ᴅᴀʀᴇ ʙᴏᴛ ᴄᴏᴍᴍᴀɴᴅs** 46 | 47 | ᴜsᴇ ᴛʜᴇsᴇ ᴄᴏᴍᴍᴀɴᴅs ᴛᴏ ᴘʟᴀʏ ᴛʀᴜᴛʜ ᴏʀ ᴅᴀʀᴇ: 48 | 49 | - `/truth`: ɢᴇᴛ ᴀ ʀᴀɴᴅᴏᴍ ᴛʀᴜᴛʜ ǫᴜᴇsᴛɪᴏɴ. ᴀɴsᴡᴇʀ ʜᴏɴᴇsᴛʟʏ! 50 | - `/dare`: ɢᴇᴛ ᴀ ʀᴀɴᴅᴏᴍ ᴅᴀʀᴇ ᴄʜᴀʟʟᴇɴɢᴇ. ᴄᴏᴍᴘʟᴇᴛᴇ ɪᴛ ɪғ ʏᴏᴜ ᴅᴀʀᴇ! 51 | 52 | **ᴇxᴀᴍᴘʟᴇs:** 53 | - `/truth`: "ᴡʜᴀᴛ ɪs ʏᴏᴜʀ ᴍᴏsᴛ ᴇᴍʙᴀʀʀᴀssɪɴɢ ᴍᴏᴍᴇɴᴛ?" 54 | - `/dare`: "ᴅᴏ 10 ᴘᴜsʜ-ᴜᴘs." 55 | 56 | **ɴᴏᴛᴇ:** 57 | ɪғ ʏᴏᴜ ᴇɴᴄᴏᴜɴᴛᴇʀ ᴀɴʏ ɪssᴜᴇs ᴡɪᴛʜ ғᴇᴛᴄʜɪɴɢ ǫᴜᴇsᴛɪᴏɴs, ᴘʟᴇᴀsᴇ ᴛʀʏ ᴀɢᴀɪɴ ʟᴀᴛᴇʀ. 58 | """ 59 | 60 | __MODULE__ = "Tʀᴜᴛʜ" 61 | -------------------------------------------------------------------------------- /plugins/tts.py: -------------------------------------------------------------------------------- 1 | import io 2 | 3 | from gtts import gTTS 4 | from pyrogram import filters 5 | 6 | from YukkiMusic import app 7 | 8 | 9 | @app.on_message(filters.command("tts")) 10 | async def text_to_speech(client, message): 11 | if len(message.command) < 2: 12 | return await message.reply_text( 13 | "Please provide some text to convert to speech." 14 | ) 15 | 16 | text = message.text.split(None, 1)[1] 17 | tts = gTTS(text, lang="hi") 18 | audio_data = io.BytesIO() 19 | tts.write_to_fp(audio_data) 20 | audio_data.seek(0) 21 | 22 | audio_file = io.BytesIO(audio_data.read()) 23 | audio_file.name = "audio.mp3" 24 | await message.reply_audio(audio_file) 25 | 26 | 27 | __HELP__ = """ 28 | **ᴛᴇxᴛ ᴛᴏ sᴘᴇᴇᴄʜ ʙᴏᴛ ᴄᴏᴍᴍᴀɴᴅ** 29 | 30 | ᴜsᴇ ᴛʜᴇ `/tts` ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴄᴏɴᴠᴇʀᴛ ᴛᴇxᴛ ɪɴᴛᴏ sᴘᴇᴇᴄʜ. 31 | 32 | - `/tts <ᴛᴇxᴛ>`: ᴄᴏɴᴠᴇʀᴛs ᴛʜᴇ ɢɪᴠᴇɴ ᴛᴇxᴛ ᴛᴏ sᴘᴇᴇᴄʜ ɪɴ ʜɪɴᴅɪ. 33 | 34 | **ᴇxᴀᴍᴘʟᴇ:** 35 | - `/tts Namaste Duniya` 36 | 37 | **ɴᴏᴛᴇ:** 38 | ᴍᴀᴋᴇ sᴜʀᴇ ᴛᴏ ᴘʀᴏᴠɪᴅᴇ sᴏᴍᴇ ᴛᴇxᴛ ᴀғᴛᴇʀ ᴛʜᴇ `/tts` ᴄᴏᴍᴍᴀɴᴅ. 39 | """ 40 | 41 | __MODULE__ = "Tᴛs" 42 | -------------------------------------------------------------------------------- /plugins/upscale.py: -------------------------------------------------------------------------------- 1 | """from os import remove 2 | from pyrogram import filters 3 | from lexica import Client as LexicaClient 4 | from pyrogram.errors.exceptions.bad_request_400 import PhotoInvalidDimensions 5 | from YukkiMusic import app 6 | from utils.error import capture_err 7 | 8 | lexica_client = LexicaClient() 9 | 10 | def upscale_image(image: bytes) -> bytes: 11 | return lexica_client.upscale(image) 12 | 13 | @app.on_message(filters.command("upscale")) 14 | @capture_err 15 | async def upscale_reply_image(client, message): 16 | if not message.reply_to_message or not message.reply_to_message.photo: 17 | return await message.reply_text("ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴘʜᴏᴛᴏ ᴛᴏ ᴜᴘsᴄᴀʟᴇ ɪᴛ....😑") 18 | if message.reply_to_message.photo: 19 | a = await message.reply_text("ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ ᴀ ᴍᴏᴍᴇɴᴛ......") 20 | photo = await client.download_media(message.reply_to_message.photo.file_id) 21 | 22 | with open(photo, 'rb') as f: 23 | image_bytes = f.read() 24 | try: 25 | upscaled_image_bytes = upscale_image(image_bytes) 26 | await a.edit("ᴀʟᴍᴏsᴛ ᴅᴏɴᴇ......❣️") 27 | with open('upscaled.png', 'wb') as f: 28 | f.write(upscaled_image_bytes) 29 | try: 30 | await message.reply_photo(photo='upscaled.png') 31 | remove('upscaled.png') 32 | await a.delete() 33 | except PhotoInvalidDimensions: 34 | await message.reply_document('upscaled.png') 35 | remove('upscaled.png') 36 | await a.delete() 37 | except Exception as e: 38 | remove('upscaled.png') 39 | await a.edit(e)""" 40 | -------------------------------------------------------------------------------- /plugins/wall.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import requests 4 | from pyrogram import filters 5 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 6 | 7 | from YukkiMusic import app 8 | 9 | 10 | @app.on_message(filters.command(["wall", "wallpaper"])) 11 | async def wall(_, message: Message): 12 | 13 | try: 14 | text = message.text.split(None, 1)[1] 15 | except IndexError: 16 | text = None 17 | if not text: 18 | return await message.reply_text("`Please give some query to search.`") 19 | m = await message.reply_text("sᴇᴀʀᴄʜɪɴɢ...") 20 | try: 21 | url = requests.get(f"https://api.safone.dev/wall?query={text}").json()[ 22 | "results" 23 | ] 24 | ran = random.randint(0, 7) 25 | await message.reply_photo( 26 | photo=url[ran]["imageUrl"], 27 | caption=f"🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {message.from_user.mention}", 28 | reply_markup=InlineKeyboardMarkup( 29 | [ 30 | [InlineKeyboardButton("ʟɪɴᴋ", url=url[ran]["imageUrl"])], 31 | ] 32 | ), 33 | ) 34 | await m.delete() 35 | except Exception as e: 36 | await m.edit_text( 37 | f"`ᴡᴀʟʟᴘᴀᴘᴇʀ ɴᴏᴛ ғᴏᴜɴᴅ ғᴏʀ : `{text}`", 38 | ) 39 | 40 | 41 | __MODULE__ = "Wᴀʟʟ" 42 | __HELP__ = """ 43 | **COMMANDS:** 44 | 45 | • /WALL - **ᴅᴏᴡɴʟᴏᴀᴅ ᴀɴᴅ sᴇɴᴅ ᴡᴀʟʟᴘᴀᴘᴇʀ.** 46 | 47 | **INFO:** 48 | 49 | - ᴛʜɪs ʙᴏᴛ ᴘʀᴏᴠɪᴅᴇs ᴀ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ᴀɴᴅ sᴇɴᴅ ᴡᴀʟʟᴘᴀᴘᴇʀ. 50 | - ᴜsᴇ /WALL ᴄᴏᴍᴍᴀɴᴅ ᴡɪᴛʜ ᴀ ᴛᴇxᴛ ᴛᴏ sᴇᴀʀᴄʜ ғᴏʀ ᴡᴀʟʟᴘᴀᴘᴇʀ ᴀɴᴅ sᴇɴᴅ ɪᴛ ᴛᴏ ᴛʜᴇ ᴄʜᴀᴛ. 51 | 52 | **NOTE:** 53 | 54 | - ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴄᴀɴ ʙᴇ ᴜsᴇᴅ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ᴀɴᴅ sᴇɴᴅ ᴡᴀʟʟᴘᴀᴘᴇʀ. 55 | """ 56 | -------------------------------------------------------------------------------- /plugins/websource.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import filters 3 | from requests.adapters import HTTPAdapter 4 | from requests.packages.urllib3.util.retry import Retry 5 | 6 | from YukkiMusic import app 7 | 8 | 9 | def download_website(url): 10 | headers = { 11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" 12 | } 13 | 14 | retries = Retry(total=5, backoff_factor=1, status_forcelist=[500, 502, 503, 504]) 15 | session = requests.Session() 16 | session.mount("http://", HTTPAdapter(max_retries=retries)) 17 | 18 | try: 19 | response = session.get(url, headers=headers) 20 | if response.status_code == 200: 21 | return response.text 22 | else: 23 | return ( 24 | f"Failed to download source code. Status code: {response.status_code}" 25 | ) 26 | 27 | except Exception as e: 28 | return f"An error occurred: {str(e)}" 29 | 30 | 31 | # Handler for /webdl command to download website source code 32 | @app.on_message(filters.command("webdl")) 33 | def web_download(client, message): 34 | # Check if the command has a URL attached 35 | if len(message.command) == 1: 36 | message.reply_text("Please enter a URL along with the /webdl command.") 37 | return 38 | 39 | # Get the URL after /webdl command 40 | url = message.command[1] 41 | 42 | source_code = download_website(url) 43 | if source_code.startswith("An error occurred") or source_code.startswith( 44 | "Failed to download" 45 | ): 46 | message.reply_text(source_code) 47 | else: 48 | # Save the source code to a file 49 | with open("website.txt", "w", encoding="utf-8") as file: 50 | file.write(source_code) 51 | message.reply_document(document="website.txt", caption=f"Source code of {url}") 52 | 53 | 54 | __MODULE__ = "Wᴇʙᴅʟ" 55 | __HELP__ = """ 56 | **ᴄᴏᴍᴍᴀɴᴅ:** 57 | 58 | • /webdl - **ᴅᴏᴡɴʟᴏᴀᴅ ᴡᴇʙsɪᴛᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ.** 59 | 60 | **ɪɴғᴏ:** 61 | 62 | - ᴛʜɪs ʙᴏᴛ ᴘʀᴏᴠɪᴅᴇs ᴀ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ᴛʜᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ᴏғ ᴀ ᴡᴇʙsɪᴛᴇ. 63 | - ᴜsᴇ /webdl ᴄᴏᴍᴍᴀɴᴅ ᴡɪᴛʜ ᴀ ᴜʀʟ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ᴛʜᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ᴏғ ᴛʜᴇ ᴡᴇʙsɪᴛᴇ. 64 | 65 | **ɴᴏᴛᴇ:** 66 | 67 | - ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴄᴀɴ ʙᴇ ᴜsᴇᴅ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ᴡᴇʙsɪᴛᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ. 68 | - ᴛʜᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ᴡɪʟʟ ʙᴇ sᴀᴠᴇᴅ ᴀs ᴀ ᴅᴏᴄᴜᴍᴇɴᴛ ᴀɴᴅ sᴇɴᴛ ᴀs ᴀ ᴅᴏᴄᴜᴍᴇɴᴛ ᴛᴏ ᴛʜᴇ ᴄʜᴀᴛ. 69 | """ 70 | -------------------------------------------------------------------------------- /plugins/welcome.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from re import findall 3 | 4 | from pyrogram import filters 5 | from pyrogram.enums import ChatMemberStatus as CMS 6 | from pyrogram.errors.exceptions.bad_request_400 import ChatAdminRequired 7 | from pyrogram.types import ( 8 | Chat, 9 | ChatMemberUpdated, 10 | InlineKeyboardButton, 11 | InlineKeyboardMarkup, 12 | ) 13 | 14 | from YukkiMusic import app 15 | from YukkiMusic.misc import SUDOERS 16 | from .notes import extract_urls 17 | from YukkiMusic.utils.database import is_gbanned_user 18 | 19 | from utils import ( 20 | del_welcome, 21 | get_welcome, 22 | set_welcome, 23 | ) 24 | 25 | from utils.error import capture_err 26 | from YukkiMusic.utils.functions import check_format, extract_text_and_keyb 27 | from YukkiMusic.utils.keyboard import ikb 28 | from utils.permissions import adminsOnly 29 | 30 | 31 | async def handle_new_member(member, chat): 32 | 33 | try: 34 | if member.id in SUDOERS: 35 | return 36 | if await is_gbanned_user(member.id): 37 | await chat.ban_member(member.id) 38 | await app.send_message( 39 | chat.id, 40 | f"{member.mention} was globally banned, and got removed," 41 | + " if you think this is a false gban, you can appeal" 42 | + " for this ban in support chat.", 43 | ) 44 | return 45 | if member.is_bot: 46 | return 47 | return await send_welcome_message(chat, member.id) 48 | 49 | except ChatAdminRequired: 50 | return 51 | 52 | 53 | @app.on_chat_member_updated(filters.group, group=6) 54 | @capture_err 55 | async def welcome(_, user: ChatMemberUpdated): 56 | if not ( 57 | user.new_chat_member 58 | and user.new_chat_member.status not in {CMS.RESTRICTED} 59 | and not user.old_chat_member 60 | ): 61 | return 62 | 63 | member = user.new_chat_member.user if user.new_chat_member else user.from_user 64 | chat = user.chat 65 | return await handle_new_member(member, chat) 66 | 67 | 68 | async def send_welcome_message(chat: Chat, user_id: int, delete: bool = False): 69 | welcome, raw_text, file_id = await get_welcome(chat.id) 70 | 71 | if not raw_text: 72 | return 73 | text = raw_text 74 | keyb = None 75 | if findall(r"\[.+\,.+\]", raw_text): 76 | text, keyb = extract_text_and_keyb(ikb, raw_text) 77 | u = await app.get_users(user_id) 78 | if "{GROUPNAME}" in text: 79 | text = text.replace("{GROUPNAME}", chat.title) 80 | if "{NAME}" in text: 81 | text = text.replace("{NAME}", u.mention) 82 | if "{ID}" in text: 83 | text = text.replace("{ID}", f"`{user_id}`") 84 | if "{FIRSTNAME}" in text: 85 | text = text.replace("{FIRSTNAME}", u.first_name) 86 | if "{SURNAME}" in text: 87 | sname = u.last_name or "None" 88 | text = text.replace("{SURNAME}", sname) 89 | if "{USERNAME}" in text: 90 | susername = u.username or "None" 91 | text = text.replace("{USERNAME}", susername) 92 | if "{DATE}" in text: 93 | DATE = datetime.datetime.now().strftime("%Y-%m-%d") 94 | text = text.replace("{DATE}", DATE) 95 | if "{WEEKDAY}" in text: 96 | WEEKDAY = datetime.datetime.now().strftime("%A") 97 | text = text.replace("{WEEKDAY}", WEEKDAY) 98 | if "{TIME}" in text: 99 | TIME = datetime.datetime.now().strftime("%H:%M:%S") 100 | text = text.replace("{TIME}", f"{TIME} UTC") 101 | 102 | if welcome == "Text": 103 | m = await app.send_message( 104 | chat.id, 105 | text=text, 106 | reply_markup=keyb, 107 | disable_web_page_preview=True, 108 | ) 109 | elif welcome == "Photo": 110 | m = await app.send_photo( 111 | chat.id, 112 | photo=file_id, 113 | caption=text, 114 | reply_markup=keyb, 115 | ) 116 | else: 117 | m = await app.send_animation( 118 | chat.id, 119 | animation=file_id, 120 | caption=text, 121 | reply_markup=keyb, 122 | ) 123 | 124 | 125 | @app.on_message(filters.command("setwelcome") & ~filters.private) 126 | @adminsOnly("can_change_info") 127 | async def set_welcome_func(_, message): 128 | usage = "You need to reply to a text, gif or photo to set it as greetings.\n\nNotes: caption required for gif and photo." 129 | key = InlineKeyboardMarkup( 130 | [ 131 | [ 132 | InlineKeyboardButton( 133 | text="More Help", 134 | url=f"t.me/{app.username}?start=greetings", 135 | ) 136 | ], 137 | ] 138 | ) 139 | replied_message = message.reply_to_message 140 | chat_id = message.chat.id 141 | try: 142 | if not replied_message: 143 | await message.reply_text(usage, reply_markup=key) 144 | return 145 | if replied_message.animation: 146 | welcome = "Animation" 147 | file_id = replied_message.animation.file_id 148 | text = replied_message.caption 149 | if not text: 150 | return await message.reply_text(usage, reply_markup=key) 151 | raw_text = text.markdown 152 | if replied_message.photo: 153 | welcome = "Photo" 154 | file_id = replied_message.photo.file_id 155 | text = replied_message.caption 156 | if not text: 157 | return await message.reply_text(usage, reply_markup=key) 158 | raw_text = text.markdown 159 | if replied_message.text: 160 | welcome = "Text" 161 | file_id = None 162 | text = replied_message.text 163 | raw_text = text.markdown 164 | if replied_message.reply_markup and not findall(r"\[.+\,.+\]", raw_text): 165 | urls = extract_urls(replied_message.reply_markup) 166 | if urls: 167 | response = "\n".join( 168 | [f"{name}=[{text}, {url}]" for name, text, url in urls] 169 | ) 170 | raw_text = raw_text + response 171 | raw_text = await check_format(ikb, raw_text) 172 | if raw_text: 173 | await set_welcome(chat_id, welcome, raw_text, file_id) 174 | return await message.reply_text( 175 | "Welcome message has been successfully set." 176 | ) 177 | else: 178 | return await message.reply_text( 179 | "Wrong formatting, check the help section.\n\n**Usage:**\nText: `Text`\nText + Buttons: `Text ~ Buttons`", 180 | reply_markup=key, 181 | ) 182 | except UnboundLocalError: 183 | return await message.reply_text( 184 | "**Only Text, Gif and Photo welcome message are supported.**" 185 | ) 186 | 187 | 188 | @app.on_message(filters.command(["delwelcome", "deletewelcome"]) & ~filters.private) 189 | @adminsOnly("can_change_info") 190 | async def del_welcome_func(_, message): 191 | chat_id = message.chat.id 192 | await del_welcome(chat_id) 193 | await message.reply_text("Welcome message has been deleted.") 194 | 195 | 196 | @app.on_message(filters.command("getwelcome") & ~filters.private) 197 | @adminsOnly("can_change_info") 198 | async def get_welcome_func(_, message): 199 | chat = message.chat 200 | welcome, raw_text, file_id = await get_welcome(chat.id) 201 | if not raw_text: 202 | return await message.reply_text("No welcome message set.") 203 | if not message.from_user: 204 | return await message.reply_text("You're anon, can't send welcome message.") 205 | 206 | await send_welcome_message(chat, message.from_user.id) 207 | 208 | await message.reply_text( 209 | f'Welcome: {welcome}\n\nFile_id: `{file_id}`\n\n`{raw_text.replace("`", "")}`' 210 | ) 211 | 212 | 213 | __MODULE__ = "Wᴇʟᴄᴏᴍᴇ" 214 | __HELP__ = """ 215 | /setwelcome - Rᴇᴘʟʏ ᴛʜɪs ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴄᴏɴᴛᴀɪɴɪɴɢ ᴄᴏʀʀᴇᴄᴛ 216 | ғᴏʀᴍᴀᴛ ғᴏʀ ᴀ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ, ᴄʜᴇᴄᴋ ᴇɴᴅ ᴏғ ᴛʜɪs ᴍᴇssᴀɢᴇ. 217 | 218 | /delwelcome - Dᴇʟᴇᴛᴇ ᴛʜᴇ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ. 219 | /getwelcome - Gᴇᴛ ᴛʜᴇ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ. 220 | 221 | **SET_WELCOME ->** 222 | 223 | **Tᴏ sᴇᴛ ᴀ ᴘʜᴏᴛᴏ ᴏʀ ɢɪғ ᴀs ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ. Aᴅᴅ ʏᴏᴜʀ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ ᴀs ᴄᴀᴘᴛɪᴏɴ ᴛᴏ ᴛʜᴇ ᴘʜᴏᴛᴏ ᴏʀ ɢɪғ. Tʜᴇ ᴄᴀᴘᴛɪᴏɴ ᴍᴜsᴇ ʙᴇ ɪɴ ᴛʜᴇ ғᴏʀᴍᴀᴛ ɢɪᴠᴇɴ ʙᴇʟᴏᴡ.** 224 | 225 | Fᴏʀ ᴛᴇxᴛ ᴡᴇʟᴄᴏᴍᴇ ᴍᴇssᴀɢᴇ ɪᴜsᴛ sᴇɴᴅ ᴛʜᴇ ᴛᴇxᴛ. Tʜᴇɴ ʀᴇᴘʟʏ ᴡɪᴛʜ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅ 226 | 227 | Tʜᴇ ғᴏʀᴍᴀᴛ sʜᴏᴜʟᴅ ʙᴇ sᴏᴍᴇᴛʜɪɴɢ ʟɪᴋᴇ ʙᴇʟᴏᴡ. 228 | 229 | **Hɪ** {NAME} [{ID}] Wᴇʟᴄᴏᴍᴇ ᴛᴏ {GROUPNAME} 230 | 231 | ~ #Tʜɪs sᴇᴘᴀʀᴀᴛᴇʀ (~) sʜᴏᴜʟᴅ ʙᴇ ᴛʜᴇʀᴇ ʙᴇᴛᴡᴇᴇɴ ᴛᴇxᴛ ᴀɴᴅ ʙᴜᴛᴛᴏɴs, ʀᴇᴍᴏᴠᴇ ᴛʜɪs ᴄᴏᴍᴍᴇɴᴛ ᴀʟsᴏ 232 | 233 | Button=[Dᴜᴄᴋ, ʜᴛᴛᴘs://ᴅᴜᴄᴋᴅᴜᴄᴋɢᴏ.ᴄᴏᴍ] 234 | Button2=[Gɪᴛʜᴜʙ, ʜᴛᴛᴘs://ɢɪᴛʜᴜʙ.ᴄᴏᴍ] 235 | **NOTES ->** 236 | 237 | Cʜᴇᴄᴋᴏᴜᴛ /markdownhelp ᴛᴏ ᴋɴᴏᴡ ᴍᴏʀᴇ ᴀʙᴏᴜᴛ ғᴏʀᴍᴀᴛᴛɪɴɢs ᴀɴᴅ ᴏᴛʜᴇʀ sʏɴᴛᴀx. 238 | """ 239 | -------------------------------------------------------------------------------- /plugins/whois.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from pyrogram.errors import PeerIdInvalid 3 | from pyrogram.types import Message, User 4 | 5 | from YukkiMusic import app 6 | 7 | 8 | def ReplyCheck(message: Message): 9 | reply_id = None 10 | 11 | if message.reply_to_message: 12 | reply_id = message.reply_to_message.message_id 13 | 14 | elif not message.from_user.is_self: 15 | reply_id = message.message_id 16 | 17 | return reply_id 18 | 19 | 20 | infotext = ( 21 | "[{full_name}](tg://user?id={user_id})\n\n" 22 | " ➻ ᴜsᴇʀ ɪᴅ: `{user_id}`\n" 23 | " ➻ ғɪʀsᴛ ɴᴀᴍᴇ: `{first_name}`\n" 24 | " ➻ ʟᴀsᴛ ɴᴀᴍᴇ: `{last_name}`\n" 25 | " ➻ ᴜsᴇʀɴᴀᴍᴇ: `@{username}`\n" 26 | " ➻ ʟᴀsᴛ sᴇᴇɴ: `{last_online}`" 27 | ) 28 | 29 | 30 | def LastOnline(user: User): 31 | if user.is_bot: 32 | return "" 33 | elif user.status == "recently": 34 | return "ʀᴇᴄᴇɴᴛʟʏ" 35 | elif user.status == "within_week": 36 | return "ᴡɪᴛʜɪɴ ᴛʜᴇ ʟᴀsᴛ ᴡᴇᴇᴋ" 37 | elif user.status == "within_month": 38 | return "ᴡɪᴛʜɪɴ ᴛʜᴇ ʟᴀsᴛ ᴍᴏɴᴛʜ" 39 | elif user.status == "long_time_ago": 40 | return "ᴀ ʟᴏɴɢ ᴛɪᴍᴇ ᴀɢᴏ :(" 41 | elif user.status == "online": 42 | return "ᴄᴜʀʀᴇɴᴛʟʏ ᴏɴʟɪɴᴇ" 43 | elif user.status == "offline": 44 | return datetime.fromtimestamp(user.status.date).strftime( 45 | "%a, %d %b %Y, %H:%M:%S" 46 | ) 47 | 48 | 49 | def FullName(user: User): 50 | return user.first_name + " " + user.last_name if user.last_name else user.first_name 51 | 52 | 53 | @app.on_message(filters.command("whois")) 54 | async def whois(client, message): 55 | cmd = message.command 56 | if not message.reply_to_message and len(cmd) == 1: 57 | get_user = message.from_user.id 58 | elif len(cmd) == 1: 59 | get_user = message.reply_to_message.from_user.id 60 | elif len(cmd) > 1: 61 | get_user = cmd[1] 62 | try: 63 | get_user = int(cmd[1]) 64 | except ValueError: 65 | pass 66 | try: 67 | user = await client.get_users(get_user) 68 | except PeerIdInvalid: 69 | await message.reply("I don't know that user.") 70 | return 71 | desc = await client.get_chat(get_user) 72 | desc = desc.description 73 | await message.reply_text( 74 | infotext.format( 75 | full_name=FullName(user), 76 | user_id=user.id, 77 | user_dc=user.dc_id, 78 | first_name=user.first_name, 79 | last_name=user.last_name if user.last_name else "", 80 | username=user.username if user.username else "", 81 | last_online=LastOnline(user), 82 | bio=desc if desc else "ᴇᴍᴩᴛʏ.", 83 | ), 84 | disable_web_page_preview=True, 85 | ) 86 | 87 | 88 | __HELP__ = """ 89 | **ᴄᴏᴍᴍᴀɴᴅ:** 90 | 91 | • /whois - **ᴄʜᴇᴄᴋ ᴜsᴇʀ ɪɴғᴏʀᴍᴀᴛɪᴏɴ.** 92 | 93 | **ɪɴғᴏ:** 94 | 95 | - ᴛʜɪs ʙᴏᴛ ᴘʀᴏᴠɪᴅᴇs ᴀ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴄʜᴇᴄᴋ ᴜsᴇʀ ɪɴғᴏʀᴍᴀᴛɪᴏɴ. 96 | - ᴜsᴇ /whois ᴄᴏᴍᴍᴀɴᴅ ғᴏʟʟᴏᴡᴇᴅ ʙʏ ᴀ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴏʀ ᴀ ᴜsᴇʀ ɪᴅ ᴛᴏ ɢᴇᴛ ɪɴғᴏʀᴍᴀᴛɪᴏɴ ᴀʙᴏᴜᴛ ᴛʜᴇ ᴜsᴇʀ. 97 | 98 | **ɴᴏᴛᴇ:** 99 | 100 | - ᴛʜᴇ /whois ᴄᴏᴍᴍᴀɴᴅ ᴄᴀɴ ʙᴇ ᴜsᴇᴅ ᴛᴏ ʀᴇᴛʀɪᴇᴠᴇ ɪɴғᴏʀᴍᴀᴛɪᴏɴ ᴀʙᴏᴜᴛ ᴀ ᴜsᴇʀ ɪɴ ᴛʜᴇ ᴄʜᴀᴛ. 101 | - ᴛʜᴇ ɪɴғᴏʀᴍᴀᴛɪᴏɴ ɪɴᴄʟᴜᴅᴇs ᴜsᴇʀ ɪᴅ, ғɪʀsᴛ ɴᴀᴍᴇ, ʟᴀsᴛ ɴᴀᴍᴇ, ᴜsᴇʀɴᴀᴍᴇ, ᴀɴᴅ ʟᴀsᴛ sᴇᴇɴ sᴛᴀᴛᴜs. 102 | """ 103 | 104 | __MODULE__ = "Wʜᴏɪs" 105 | -------------------------------------------------------------------------------- /plugins/write.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from TheApi import api 3 | 4 | from YukkiMusic import app 5 | 6 | 7 | @app.on_message(filters.command(["write"])) 8 | async def write(client, message): 9 | if message.reply_to_message and message.reply_to_message.text: 10 | txt = message.reply_to_message.text 11 | elif len(message.command) > 1: 12 | txt = message.text.split(None, 1)[1] 13 | else: 14 | return await message.reply( 15 | "Pʟᴇᴀsᴇ ʀᴇᴘʟʏ ᴛᴏ ᴍᴇssᴀɢᴇ ᴏʀ ᴡʀɪᴛᴇ ᴀғᴛᴇʀ ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴜsᴇ ᴡʀɪᴛᴇ CMD" 16 | ) 17 | nan = await message.reply_text("Pʀᴏᴄᴇssɪɴɢ...") 18 | try: 19 | img = api.write(txt) 20 | await message.reply_photo(img) 21 | await nan.delete() 22 | except Exception as e: 23 | await nan.edit(e) 24 | 25 | 26 | __MODULE__ = "Wʀɪᴛᴇ" 27 | __HELP__ = """ 28 | **COMMANDS**: 29 | - /write: ᴡʀɪᴛᴇ ᴛᴇxᴛ ᴏɴ ᴀɴ ᴄʟᴏᴜᴅ ᴀɴᴅ ɢᴇᴛ ᴀɴ ᴇᴅɪᴛᴇᴅ ᴘʜᴏᴛᴏ. 30 | 31 | **INFO**: 32 | - ᴍᴏᴅᴜʟᴇ ɴᴀᴍᴇ: ᴡʀɪᴛᴇ 33 | - ᴅᴇsᴄʀɪᴘᴛɪᴏɴ: ᴡʀɪᴛᴇ ᴛᴇxᴛ ᴏɴ ᴀɴ ᴄʟᴏᴜᴅ ᴀɴᴅ ɢᴇᴛ ᴀɴ ᴇᴅɪᴛᴇᴅ ᴘʜᴏᴛᴏ. 34 | - ᴄᴏᴍᴍᴀɴᴅs: /write 35 | - ᴘᴇʀᴍɪssɪᴏɴs ɴᴇᴇᴅᴇᴅ: ɴᴏɴᴇ 36 | 37 | **NOTE**: 38 | - ᴜsᴇ ᴅɪʀᴇᴄᴛʟʏ ɪɴ ᴀ ɢʀᴏᴜᴘ ᴄʜᴀᴛ ᴡɪᴛʜ ᴍᴇ ғᴏʀ ᴛʜᴇ ʙᴇsᴛ ʀᴇsᴜʟᴛs.""" 39 | -------------------------------------------------------------------------------- /plugins/zombies.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.enums import ChatMemberStatus 5 | from pyrogram.errors import FloodWait 6 | from YukkiMusic import app 7 | from utils.permissions import adminsOnly 8 | 9 | chatQueue = [] 10 | 11 | stopProcess = False 12 | 13 | 14 | @app.on_message(filters.command(["zombies"])) 15 | @adminsOnly("can_restrict_members") 16 | async def remove(client, message): 17 | 18 | global stopProcess 19 | try: 20 | try: 21 | sender = await app.get_chat_member(message.chat.id, message.from_user.id) 22 | has_permissions = sender.privileges 23 | except BaseException: 24 | has_permissions = message.sender_chat 25 | if has_permissions: 26 | bot = await app.get_chat_member(message.chat.id, "self") 27 | if bot.status == ChatMemberStatus.MEMBER: 28 | await message.reply( 29 | "➠ | ɪ ɴᴇᴇᴅ ᴀᴅᴍɪɴ ᴘᴇʀᴍɪssɪᴏɴs ᴛᴏ ʀᴇᴍᴏᴠᴇ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs." 30 | ) 31 | else: 32 | if len(chatQueue) > 30: 33 | await message.reply( 34 | "➠ | ɪ'ᴍ ᴀʟʀᴇᴀᴅʏ ᴡᴏʀᴋɪɴɢ ᴏɴ ᴍʏ ᴍᴀxɪᴍᴜᴍ ɴᴜᴍʙᴇʀ ᴏғ 30 ᴄʜᴀᴛs ᴀᴛ ᴛʜᴇ ᴍᴏᴍᴇɴᴛ. ᴘʟᴇᴀsᴇ ᴛʀʏ ᴀɢᴀɪɴ sʜᴏʀᴛʟʏ." 35 | ) 36 | else: 37 | if message.chat.id in chatQueue: 38 | await message.reply( 39 | "➠ | ᴛʜᴇʀᴇ's ᴀʟʀᴇᴀᴅʏ ᴀɴ ᴏɴɢɪɪɴɢ ᴘʀᴏᴄᴇss ɪɴ ᴛʜɪs ᴄʜᴀᴛ. ᴘʟᴇᴀsᴇ [ /stop ] ᴛᴏ sᴛᴀʀᴛ ᴀ ɴᴇᴡ ᴏɴᴇ." 40 | ) 41 | else: 42 | chatQueue.append(message.chat.id) 43 | deletedList = [] 44 | async for member in app.get_chat_members(message.chat.id): 45 | if member.user.is_deleted == True: 46 | deletedList.append(member.user) 47 | else: 48 | pass 49 | lenDeletedList = len(deletedList) 50 | if lenDeletedList == 0: 51 | await message.reply("⟳ | ɴᴏ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ɪɴ ᴛʜɪs ᴄʜᴀᴛ.") 52 | chatQueue.remove(message.chat.id) 53 | else: 54 | k = 0 55 | processTime = lenDeletedList * 1 56 | temp = await app.send_message( 57 | message.chat.id, 58 | f"🧭 | ᴛᴏᴛᴀʟ ᴏғ {lenDeletedList} ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ʜᴀs ʙᴇᴇɴ ᴅᴇᴛᴇᴄᴛᴇᴅ.\n🥀 | ᴇsᴛɪᴍᴀᴛᴇᴅ ᴛɪᴍᴇ: {processTime} sᴇᴄᴏɴᴅs ғʀᴏᴍ ɴᴏᴡ.", 59 | ) 60 | if stopProcess: 61 | stopProcess = False 62 | while len(deletedList) > 0 and not stopProcess: 63 | deletedAccount = deletedList.pop(0) 64 | try: 65 | await app.ban_chat_member( 66 | message.chat.id, deletedAccount.id 67 | ) 68 | except FloodWait as e: 69 | await asyncio.sleep(e.value) 70 | except Exception: 71 | pass 72 | k += 1 73 | if k == lenDeletedList: 74 | await message.reply( 75 | f"✅ | sᴜᴄᴄᴇssғᴜʟʟʏ ʀᴇᴍᴏᴠᴇᴅ ᴀʟʟ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄɪᴜɴᴛs ғʀᴏᴍ ᴛʜɪs ᴄʜᴀᴛ." 76 | ) 77 | await temp.delete() 78 | else: 79 | await message.reply( 80 | f"✅ | sᴜᴄᴄᴇssғᴜʟʟʏ ʀᴇᴍᴏᴠᴇᴅ {k} ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ғʀᴏᴍ ᴛʜɪs ᴄʜᴀᴛ." 81 | ) 82 | await temp.delete() 83 | chatQueue.remove(message.chat.id) 84 | else: 85 | await message.reply( 86 | "👮🏻 | sᴏʀʀʏ, **ᴏɴʟʏ ᴀᴅᴍɪɴ** ᴄᴀɴ ᴇxᴇᴄᴜᴛᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ." 87 | ) 88 | except FloodWait as e: 89 | await asyncio.sleep(e.value) 90 | 91 | 92 | __MODULE__ = "Zᴏᴍʙɪᴇs" 93 | __HELP__ = """ 94 | **commands:** 95 | - /zombies: ʀᴇᴍᴏᴠᴇ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ғʀᴏᴍ ᴛʜᴇ ɢʀᴏᴜᴘ. 96 | 97 | **info:** 98 | - ᴍᴏᴅᴜʟᴇ ɴᴀᴍᴇ: ʀᴇᴍᴏᴠᴇ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs 99 | - ᴅᴇsᴄʀɪᴘᴛɪᴏɴ: ʀᴇᴍᴏᴠᴇ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ғʀᴏᴍ ᴛʜᴇ ɢʀᴏᴜᴘ. 100 | - ᴄᴏᴍᴍᴀɴᴅs: /zombies 101 | - ᴘᴇʀᴍɪssɪᴏɴs ɴᴇᴇᴅᴇᴅ: ᴄᴀɴ ʀᴇsᴛʀɪᴄᴛ ᴍᴇᴍʙᴇʀs 102 | 103 | **note:** 104 | - ᴜsᴇ ᴅɪʀᴇᴄᴛʟʏ ɪɴ ᴀ ɢʀᴏᴜᴘ ᴄʜᴀᴛ ᴡɪᴛʜ ᴍᴇ ғᴏʀ ʙᴇsᴛ ᴇғғᴇᴄᴛ. ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴇxᴇᴄᴜᴛᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ.""" 105 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | bing-image-urls 2 | gTTS 3 | googlesearch-python 4 | httpx[http2] 5 | pyfiglet 6 | lexica-api 7 | MukeshAPI 8 | nekos.py 9 | telegraph 10 | uuid 11 | git+https://github.com/Vivekkumar-IN/TheApi@main -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .error import * 2 | from .welcomedb import * 3 | from .couple import * 4 | -------------------------------------------------------------------------------- /utils/couple.py: -------------------------------------------------------------------------------- 1 | coupledb = {} 2 | # in memory storage 3 | 4 | 5 | async def _get_lovers(cid: int): 6 | chat_data = coupledb.get(cid, {}) 7 | lovers = chat_data.get("couple", {}) 8 | return lovers 9 | 10 | 11 | async def get_image(cid: int): 12 | chat_data = coupledb.get(cid, {}) 13 | image = chat_data.get("img", "") 14 | return image 15 | 16 | 17 | async def get_couple(cid: int, date: str): 18 | lovers = await _get_lovers(cid) 19 | return lovers.get(date, False) 20 | 21 | 22 | async def save_couple(cid: int, date: str, couple: dict, img: str): 23 | if cid not in coupledb: 24 | coupledb[cid] = {"couple": {}, "img": ""} 25 | coupledb[cid]["couple"][date] = couple 26 | coupledb[cid]["img"] = img 27 | -------------------------------------------------------------------------------- /utils/error.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2024 by TheTeamVivek@Github, < https://github.com/TheTeamVivek >. 3 | # 4 | # This file is part of < https://github.com/TheTeamVivek/YukkiMusic > project, 5 | # and is released under the MIT License. 6 | # Please see < https://github.com/TheTeamVivek/YukkiMusic/blob/master/LICENSE > 7 | # 8 | # All rights reserved. 9 | # 10 | 11 | import traceback 12 | from functools import wraps 13 | 14 | from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden 15 | 16 | from config import LOG_GROUP_ID 17 | from YukkiMusic import app 18 | 19 | 20 | def split_limits(text): 21 | if len(text) < 2048: 22 | return [text] 23 | 24 | lines = text.splitlines(True) 25 | small_msg = "" 26 | result = [] 27 | for line in lines: 28 | if len(small_msg) + len(line) < 2048: 29 | small_msg += line 30 | else: 31 | result.append(small_msg) 32 | small_msg = line 33 | 34 | result.append(small_msg) 35 | 36 | return result 37 | 38 | 39 | def capture_err(func): 40 | @wraps(func) 41 | async def capture(client, message, *args, **kwargs): 42 | try: 43 | return await func(client, message, *args, **kwargs) 44 | except ChatWriteForbidden: 45 | await app.leave_chat(message.chat.id) 46 | return 47 | except Exception as err: 48 | errors = traceback.format_exc() 49 | error_feedback = split_limits( 50 | "**ERROR** | {} | {}\n```command\n{}```\n\n```python\n{}```\n".format( 51 | 0 if not message.from_user else message.from_user.mention, 52 | ( 53 | 0 54 | if not message.chat 55 | else ( 56 | f"@{message.chat.username}" 57 | if message.chat.username 58 | else f"`{message.chat.id}`" 59 | ) 60 | ), 61 | message.text or message.caption, 62 | "".join(errors), 63 | ), 64 | ) 65 | for x in error_feedback: 66 | await app.send_message(LOG_GROUP_ID, x) 67 | raise err 68 | 69 | return capture 70 | -------------------------------------------------------------------------------- /utils/permissions.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from functools import wraps 3 | from traceback import format_exc as err 4 | 5 | from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden 6 | from pyrogram.types import Message 7 | 8 | from YukkiMusic import app 9 | from YukkiMusic.misc import SUDOERS 10 | 11 | 12 | async def member_permissions(chat_id: int, user_id: int): 13 | perms = [] 14 | member = (await app.get_chat_member(chat_id, user_id)).privileges 15 | if not member: 16 | return [] 17 | if member.can_post_messages: 18 | perms.append("can_post_messages") 19 | if member.can_edit_messages: 20 | perms.append("can_edit_messages") 21 | if member.can_delete_messages: 22 | perms.append("can_delete_messages") 23 | if member.can_restrict_members: 24 | perms.append("can_restrict_members") 25 | if member.can_promote_members: 26 | perms.append("can_promote_members") 27 | if member.can_change_info: 28 | perms.append("can_change_info") 29 | if member.can_invite_users: 30 | perms.append("can_invite_users") 31 | if member.can_pin_messages: 32 | perms.append("can_pin_messages") 33 | if member.can_manage_video_chats: 34 | perms.append("can_manage_video_chats") 35 | return perms 36 | 37 | 38 | async def authorised(func, subFunc2, client, message, *args, **kwargs): 39 | chatID = message.chat.id 40 | try: 41 | await func(client, message, *args, **kwargs) 42 | except ChatWriteForbidden: 43 | await app.leave_chat(chatID) 44 | except Exception as e: 45 | logging.exception(e) 46 | try: 47 | await message.reply_text(str(e.MESSAGE)) 48 | except AttributeError: 49 | await message.reply_text(str(e)) 50 | e = err() 51 | print(str(e)) 52 | return subFunc2 53 | 54 | 55 | async def unauthorised( 56 | message: Message, permission, subFunc2, bot_lacking_permission=False 57 | ): 58 | chatID = message.chat.id 59 | if bot_lacking_permission: 60 | text = ( 61 | "I don't have the required permission to perform this action." 62 | + f"\n**Permission:** __{permission}__" 63 | ) 64 | else: 65 | text = ( 66 | "You don't have the required permission to perform this action." 67 | + f"\n**Permission:** __{permission}__" 68 | ) 69 | try: 70 | await message.reply_text(text) 71 | except ChatWriteForbidden: 72 | await app.leave_chat(chatID) 73 | return subFunc2 74 | 75 | 76 | async def bot_permissions(chat_id: int): 77 | perms = [] 78 | return await member_permissions(chat_id, app.id) 79 | 80 | 81 | def adminsOnly(permission): 82 | def subFunc(func): 83 | @wraps(func) 84 | async def subFunc2(client, message: Message, *args, **kwargs): 85 | chatID = message.chat.id 86 | 87 | # Check if the bot has the required permission 88 | bot_perms = await bot_permissions(chatID) 89 | if permission not in bot_perms: 90 | return await unauthorised( 91 | message, permission, subFunc2, bot_lacking_permission=True 92 | ) 93 | 94 | if not message.from_user: 95 | # For anonymous admins 96 | if message.sender_chat and message.sender_chat.id == message.chat.id: 97 | return await authorised( 98 | func, 99 | subFunc2, 100 | client, 101 | message, 102 | *args, 103 | **kwargs, 104 | ) 105 | return await unauthorised(message, permission, subFunc2) 106 | 107 | # For admins and sudo users 108 | userID = message.from_user.id 109 | permissions = await member_permissions(chatID, userID) 110 | if userID not in SUDOERS and permission not in permissions: 111 | return await unauthorised(message, permission, subFunc2) 112 | return await authorised(func, subFunc2, client, message, *args, **kwargs) 113 | 114 | return subFunc2 115 | 116 | return subFunc 117 | -------------------------------------------------------------------------------- /utils/welcomedb.py: -------------------------------------------------------------------------------- 1 | from YukkiMusic.core.mongo import mongodb 2 | 3 | greetingsdb = mongodb.greetings 4 | 5 | 6 | async def set_welcome(chat_id: int, message: str, raw_text: str, file_id: str): 7 | update_data = { 8 | "message": message, 9 | "raw_text": raw_text, 10 | "file_id": file_id, 11 | "type": "welcome", 12 | } 13 | 14 | return await greetingsdb.update_one( 15 | {"chat_id": chat_id, "type": "welcome"}, {"$set": update_data}, upsert=True 16 | ) 17 | 18 | 19 | async def set_goodbye(chat_id: int, message: str, raw_text: str, file_id: str): 20 | update_data = { 21 | "message": message, 22 | "raw_text": raw_text, 23 | "file_id": file_id, 24 | "type": "goodbye", 25 | } 26 | 27 | return await greetingsdb.update_one( 28 | {"chat_id": chat_id, "type": "goodbye"}, {"$set": update_data}, upsert=True 29 | ) 30 | 31 | 32 | async def get_welcome(chat_id: int) -> (str, str, str): 33 | data = await greetingsdb.find_one({"chat_id": chat_id, "type": "welcome"}) 34 | if not data: 35 | return "", "", "" 36 | 37 | message = data.get("message", "") 38 | raw_text = data.get("raw_text", "") 39 | file_id = data.get("file_id", "") 40 | 41 | return message, raw_text, file_id 42 | 43 | 44 | async def del_welcome(chat_id: int): 45 | return await greetingsdb.delete_one({"chat_id": chat_id, "type": "welcome"}) 46 | 47 | 48 | async def get_goodbye(chat_id: int) -> (str, str, str): 49 | data = await greetingsdb.find_one({"chat_id": chat_id, "type": "goodbye"}) 50 | if not data: 51 | return "", "", "" 52 | 53 | message = data.get("message", "") 54 | raw_text = data.get("raw_text", "") 55 | file_id = data.get("file_id", "") 56 | 57 | return message, raw_text, file_id 58 | 59 | 60 | async def del_goodbye(chat_id: int): 61 | return await greetingsdb.delete_one({"chat_id": chat_id, "type": "goodbye"}) 62 | 63 | 64 | async def set_greetings_on(chat_id: int, type: str) -> bool: 65 | if type == "welcome": 66 | type = "welcome_on" 67 | elif type == "goodbye": 68 | type = "goodbye_on" 69 | 70 | existing = await greetingsdb.find_one({"chat_id": chat_id}) 71 | 72 | if existing and existing.get(type) is True: 73 | return True 74 | 75 | result = await greetingsdb.update_one( 76 | {"chat_id": chat_id}, {"$set": {type: True}}, upsert=True 77 | ) 78 | 79 | return result.modified_count > 0 or result.upserted_id is not None 80 | 81 | 82 | async def is_greetings_on(chat_id: int, type: str) -> bool: 83 | if type == "welcome": 84 | type = "welcome_on" 85 | elif type == "goodbye": 86 | type = "goodbye_on" 87 | 88 | data = await greetingsdb.find_one({"chat_id": chat_id}) 89 | if not data: 90 | return False 91 | return data.get(type, False) 92 | 93 | 94 | async def set_greetings_off(chat_id: int, type: str) -> bool: 95 | if type == "welcome": 96 | type = "welcome_on" 97 | elif type == "goodbye": 98 | type = "goodbye_on" 99 | 100 | existing = await greetingsdb.find_one({"chat_id": chat_id}) 101 | if not existing or existing.get(type) is False: 102 | return True 103 | 104 | result = await greetingsdb.update_one( 105 | {"chat_id": chat_id}, {"$set": {type: False}}, upsert=True 106 | ) 107 | return result.modified_count > 0 108 | --------------------------------------------------------------------------------