File size: 11,569 Bytes
21bc372 9274d96 484036b 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 b3f3c58 21bc372 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# credits original: yukki music
# kurigram versions: latest
# code by @xpushz
from pyrogram import *
from pyrogram.types import *
from pyrogram.errors import *
from akn.utils.logger import LOGS
from akn.utils.database import db
WELCOME_ROASTING = """
**Welcome Roasting Style:**
**Selamat datang di Zaman Now Code Error!**
• **Q&A?**
- Mau ngaku developer? Liat dulu, bisa buka VPS ga?
- Nanya doang? Wajib googling dulu minimal 5x gagal.
- Error pas deploy? Biasa, tanda lu beneran ngoding.
- Copas code? Gapapa, asal jangan bangga kayak bikin sendiri.
- Ngetik `npm install` doang udah pamer? OUT!
• **Ingat:**
- Di sini kita semua bukan pro, tapi setidaknya tau cara baca error.
• **Slogan grup:**
- Code jalan? Syukur. Code error? Tradisi.
"""
@Client.on_message(filters.new_chat_members, group=2)
async def welcomecheck(client, message: Message):
chat_id = message.chat.id
if await db.get_alldlbot_is_blacklist_chat(client.me.id, chat_id):
return await client.leave_chat(chat_id)
return await client.send_message(
chat_id,
f"Thank you for using my bot: {client.me.first_name}"
)
@Client.on_message(
~filters.scheduled
& filters.command(["addblacklist"])
& ~filters.forwarded
)
async def blacklist_user(c, m):
is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(m.from_user.id, c.me.id)
if not protect_own and not is_sudo:
return await m.reply_text("You are not allowed here.")
if m.chat.type.value != "supergroup":
return await m.reply_text("You can only group public not private")
await db.update_alldlbot_broadcast_in_group(c.me.id, m.chat.id, "add")
user_id = None
if not m.reply_to_message:
if len(m.command) < 2:
return await m.reply_text(
"Reply to a user or pass a user_id to blacklist"
)
try:
getuser = m.command[1]
except Exception as e:
return await m.reply_text(f"`{str(e)}`")
else:
getuser = m.reply_to_message.from_user.id
try:
user_id = (await c.get_users(getuser)).id
await db.add_alldlbot_blacklist_user(c.me.id, user_id)
await m.reply_text(f"Successfully blacklist `{user_id}` from bots.")
except Exception as e:
await m.reply_text(f"Error: {e}")
@Client.on_message(
~filters.scheduled
& filters.command(["rmblacklist"])
& ~filters.forwarded
)
async def unblacklist_user(c, m):
is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(m.from_user.id, c.me.id)
if not protect_own and not is_sudo:
return await m.reply_text("You are not allowed here.")
if m.chat.type.value != "supergroup":
return await m.reply_text("You can only group public not private")
await db.update_alldlbot_broadcast_in_group(c.me.id, m.chat.id, "add")
user_id = None
if not m.reply_to_message:
if len(m.command) < 2:
return await m.reply_text(
"Reply to a user or pass a user_id to unblacklist."
)
try:
getuser = m.command[1]
except Exception as e:
return await m.reply_text(f"`{str(e)}`")
else:
getuser = m.reply_to_message.from_user.id
try:
user_id = (await c.get_users(getuser)).id
await db.add_alldlbot_unblacklist_user(c.me.id, user_id)
await m.reply_text(f"Successfully removed blacklist `{user_id}` from bots.")
except Exception as e:
await m.reply_text(f"Error: {e}")
@Client.on_message(
~filters.scheduled
& filters.command(["addsudo"])
& ~filters.forwarded
)
async def add_sudo_func(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
if len(message.command) != 2:
return await message.reply_text("**Usage:**\n/addsudo [USER_ID]")
user_id = int(message.text.strip().split()[1])
if await db.get_alldlbot_sudouser(client.me.id, user_id):
return await message.reply_text("User is already sudo.")
if user_id == client.me.id:
return await message.reply_text("You can't add yourself as sudo.")
update_sudo = await db.update_alldlbot_sudouser(client.me.id, user_id, "add")
if update_sudo:
await message.reply_text("User has been successfully added to sudo list")
else:
await message.reply_text("Something wrong happened.")
@Client.on_message(
~filters.scheduled
& filters.command(["delsudo"])
& ~filters.forwarded
)
async def delc_sudo_func(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
if len(message.command) != 2:
return await message.reply_text("**Usage:**\n/delsudo [USER_ID]")
user_id = int(message.text.strip().split()[1])
if not await db.get_alldlbot_sudouser(client.me.id, user_id):
return await message.reply_text("User is not sudo.")
if user_id == client.me.id:
return await message.reply_text("You can't remove yourself as sudo.")
update_sudo = await db.update_alldlbot_sudouser(client.me.id, user_id, "remove")
if update_sudo:
await message.reply_text("User has been successfully removed from sudo list")
else:
await message.reply_text("Something wrong happened.")
@Client.on_message(
~filters.scheduled
& filters.command(["blacklistchat"])
& ~filters.forwarded
)
async def blacklist_chat_func(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
if len(message.command) != 2:
return await message.reply_text("**Usage:**\n/blacklistchat [CHAT_ID]")
chat_id = int(message.text.strip().split()[1])
if await db.get_alldlbot_is_blacklist_chat(client.me.id, chat_id):
return await message.reply_text("Chat is already blacklisted.")
blacklisted = await db.add_alldlbot_blacklist_chat(client.me.id, chat_id)
if blacklisted:
await message.reply_text("Chat has been successfully blacklisted")
else:
await message.reply_text("Something wrong happened.")
try:
await client.leave_chat(chat_id)
except:
pass
@Client.on_message(
~filters.scheduled
& filters.command(["whitelistchat"])
& ~filters.forwarded
)
async def white_funciton(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
if len(message.command) != 2:
return await message.reply_text("**Usage:**\n/whitelistchat [CHAT_ID]")
chat_id = int(message.text.strip().split()[1])
if not await db.get_alldlbot_is_blacklist_chat(client.me.id, chat_id):
return await message.reply_text("Chat is already whitelisted")
whitelisted = await db.alldlbot_whitelist_chat(client.me.id, chat_id)
if whitelisted:
return await message.reply_text("Chat has been successfully whitelisted")
await message.reply_text("Something wrong happened.")
@Client.on_message(
~filters.scheduled
& filters.command(["blacklistedchat"])
& ~filters.forwarded
)
async def all_chats(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
text = "**Blacklisted Chats:**\n\n"
j = 0
for count, chat_id in enumerate(await db.get_alldlbot_blacklist_chat(client.me.id), 1):
try:
title = (await client.get_chat(chat_id)).title
except Exception:
title = "Private"
j = 1
text += f"**{count}. {title}** [`{chat_id}`]\n"
if j == 0:
await message.reply_text("No Blacklisted Chats")
else:
await message.reply_text(text)
@Client.on_message(
~filters.scheduled
& filters.command(["listsudo"])
& ~filters.forwarded
)
async def list_sudo_func(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
text = "**List SudoUser:**\n\n"
j = 0
for count, user_id in enumerate(await db.get_alldlbot_allsudouser(client.me.id), 1):
try:
title = (await client.get_users(user_id)).first_name
except Exception:
title = "Private"
j = 1
text += f"**{count}. {title}** [`{user_id}`]\n"
if j == 0:
await message.reply_text("No List SudoUser")
else:
await message.reply_text(text)
@Client.on_message(
~filters.scheduled
& filters.command(["viewblacklistuser"])
& ~filters.forwarded
)
async def view_blacklist_user_func(client, message: Message):
if message.chat.type.value != "supergroup":
return await message.reply_text("This command can only be used in supergroups.")
is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
protect_own = await db.get_alldlbot_by_user_id(message.from_user.id, client.me.id)
if not protect_own and not is_sudo:
return await message.reply_text("You are not allowed here.")
text = "**Blacklisted Users:**\n\n"
j = 0
for count, user_id in enumerate(await db.get_alldlbot_allblacklist_user(client.me.id), 1):
try:
title = (await client.get_users(user_id)).first_name
except Exception:
title = "Private"
j = 1
text += f"**{count}. {title}** [`{user_id}`]\n"
if j == 0:
await message.reply_text("No Blacklisted Users")
else:
await message.reply_text(text) |