forked from Shiv-x/LaylaRobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
22,990 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
from telethon.tl.functions.photos import GetUserPhotosRequest | ||
from telethon.tl.functions.users import GetFullUserRequest | ||
from telethon.tl.types import MessageEntityMentionName | ||
from telethon.utils import get_input_location | ||
import flag | ||
import html, os | ||
from countryinfo import CountryInfo | ||
from LaylaRobot import telethn as borg | ||
from LaylaRobot.events import register | ||
|
||
|
||
@register(pattern="^/country (.*)") | ||
async def msg(event): | ||
if event.fwd_from: | ||
return | ||
input_str = event.pattern_match.group(1) | ||
lol = input_str | ||
country = CountryInfo(lol) | ||
try: | ||
a = country.info() | ||
except: | ||
await event.reply("Country Not Avaiable Currently") | ||
name = a.get("name") | ||
bb= a.get("altSpellings") | ||
hu = '' | ||
for p in bb: | ||
hu += p+", " | ||
|
||
area = a.get("area") | ||
borders = "" | ||
hell = a.get("borders") | ||
for fk in hell: | ||
borders += fk+", " | ||
|
||
call = "" | ||
WhAt = a.get("callingCodes") | ||
for what in WhAt: | ||
call+= what+" " | ||
|
||
capital = a.get("capital") | ||
currencies = "" | ||
fker = a.get("currencies") | ||
for FKer in fker: | ||
currencies += FKer+", " | ||
|
||
HmM = a.get("demonym") | ||
geo = a.get("geoJSON") | ||
pablo = geo.get("features") | ||
Pablo = pablo[0] | ||
PAblo = Pablo.get("geometry") | ||
EsCoBaR= PAblo.get("type") | ||
iso = "" | ||
iSo = a.get("ISO") | ||
for hitler in iSo: | ||
po = iSo.get(hitler) | ||
iso += po+", " | ||
fla = iSo.get("alpha2") | ||
nox = fla.upper() | ||
okie = flag.flag(nox) | ||
|
||
languages = a.get("languages") | ||
lMAO="" | ||
for lmao in languages: | ||
lMAO += lmao+", " | ||
|
||
nonive = a.get("nativeName") | ||
waste = a.get("population") | ||
reg = a.get("region") | ||
sub = a.get("subregion") | ||
tik = a.get("timezones") | ||
tom ="" | ||
for jerry in tik: | ||
tom+=jerry+", " | ||
|
||
GOT = a.get("tld") | ||
lanester = "" | ||
for targaryen in GOT: | ||
lanester+=targaryen+", " | ||
|
||
wiki = a.get("wiki") | ||
|
||
caption = f"""<b><u>Information Gathered Successfully</b></u> | ||
<b> | ||
Country Name:- {name} | ||
Alternative Spellings:- {hu} | ||
Country Area:- {area} square kilometers | ||
Borders:- {borders} | ||
Calling Codes:- {call} | ||
Country's Capital:- {capital} | ||
Country's currency:- {currencies} | ||
Country's Flag:- {okie} | ||
Demonym:- {HmM} | ||
Country Type:- {EsCoBaR} | ||
ISO Names:- {iso} | ||
Languages:- {lMAO} | ||
Native Name:- {nonive} | ||
population:- {waste} | ||
Region:- {reg} | ||
Sub Region:- {sub} | ||
Time Zones:- {tom} | ||
Top Level Domain:- {lanester} | ||
wikipedia:- {wiki}</b> | ||
Gathered By Yone.</b> | ||
""" | ||
|
||
|
||
await borg.send_message( | ||
event.chat_id, | ||
caption, | ||
parse_mode="HTML", | ||
) | ||
|
||
await event.delete() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from LaylaRobot import telethn as tbot | ||
import os | ||
from LaylaRobot.events import register | ||
import secureme | ||
|
||
@register(pattern="^/encrypt ?(.*)") | ||
async def hmm(event): | ||
if event.reply_to_msg_id: | ||
lel = await event.get_reply_message() | ||
cmd = lel.text | ||
else: | ||
cmd = event.pattern_match.group(1) | ||
Text = cmd | ||
k = secureme.encrypt(Text) | ||
await event.reply(k) | ||
|
||
@register(pattern="^/decrypt ?(.*)") | ||
async def hmm(event): | ||
if event.reply_to_msg_id: | ||
lel = await event.get_reply_message() | ||
ok = lel.text | ||
else: | ||
ok = event.pattern_match.group(1) | ||
Text = ok | ||
k = secureme.decrypt(Text) | ||
await event.reply(k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
# credits @InukaAsith, @Mr_dark_prince | ||
|
||
import logging | ||
import time | ||
|
||
from pyrogram import filters | ||
from pyrogram.errors.exceptions.bad_request_400 import ( | ||
ChatAdminRequired, | ||
PeerIdInvalid, | ||
UsernameNotOccupied, | ||
UserNotParticipant, | ||
) | ||
from pyrogram.types import ChatPermissions, InlineKeyboardButton, InlineKeyboardMarkup | ||
|
||
from LaylaRobot import DRAGONS as SUDO_USERS | ||
from LaylaRobot import pbot | ||
from LaylaRobot.modules.sql_extended import forceSubscribe_sql as sql | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
static_data_filter = filters.create( | ||
lambda _, __, query: query.data == "onUnMuteRequest" | ||
) | ||
|
||
|
||
@pbot.on_callback_query(static_data_filter) | ||
def _onUnMuteRequest(client, cb): | ||
user_id = cb.from_user.id | ||
chat_id = cb.message.chat.id | ||
chat_db = sql.fs_settings(chat_id) | ||
if chat_db: | ||
channel = chat_db.channel | ||
chat_member = client.get_chat_member(chat_id, user_id) | ||
if chat_member.restricted_by: | ||
if chat_member.restricted_by.id == (client.get_me()).id: | ||
try: | ||
client.get_chat_member(channel, user_id) | ||
client.unban_chat_member(chat_id, user_id) | ||
cb.message.delete() | ||
# if cb.message.reply_to_message.from_user.id == user_id: | ||
# cb.message.delete() | ||
except UserNotParticipant: | ||
client.answer_callback_query( | ||
cb.id, | ||
text=f"❗ Join our @{channel} channel and press 'UnMute Me' button.", | ||
show_alert=True, | ||
) | ||
else: | ||
client.answer_callback_query( | ||
cb.id, | ||
text="❗ You have been muted by admins due to some other reason.", | ||
show_alert=True, | ||
) | ||
else: | ||
if ( | ||
not client.get_chat_member(chat_id, (client.get_me()).id).status | ||
== "administrator" | ||
): | ||
client.send_message( | ||
chat_id, | ||
f"❗ **{cb.from_user.mention} is trying to UnMute himself but i can't unmute him because i am not an admin in this chat add me as admin again.**\n__#Leaving this chat...__", | ||
) | ||
|
||
else: | ||
client.answer_callback_query( | ||
cb.id, | ||
text="❗ Warning! Don't press the button when you cn talk.", | ||
show_alert=True, | ||
) | ||
|
||
|
||
@pbot.on_message(filters.text & ~filters.private & ~filters.edited, group=1) | ||
def _check_member(client, message): | ||
chat_id = message.chat.id | ||
chat_db = sql.fs_settings(chat_id) | ||
if chat_db: | ||
user_id = message.from_user.id | ||
if ( | ||
not client.get_chat_member(chat_id, user_id).status | ||
in ("administrator", "creator") | ||
and not user_id in SUDO_USERS | ||
): | ||
channel = chat_db.channel | ||
try: | ||
client.get_chat_member(channel, user_id) | ||
except UserNotParticipant: | ||
try: | ||
sent_message = message.reply_text( | ||
"Welcome {} 🙏 \n **You havent joined our @{} Channel yet** 😭 \n \nPlease Join [Our Channel](https://t.me/{}) and hit the **UNMUTE ME** Button. \n \n ".format( | ||
message.from_user.mention, channel, channel | ||
), | ||
disable_web_page_preview=True, | ||
reply_markup=InlineKeyboardMarkup( | ||
[ | ||
[ | ||
InlineKeyboardButton( | ||
"Join Channel", | ||
url="https://t.me/{}".format(channel), | ||
) | ||
], | ||
[ | ||
InlineKeyboardButton( | ||
"UnMute Me", callback_data="onUnMuteRequest" | ||
) | ||
], | ||
] | ||
), | ||
) | ||
client.restrict_chat_member( | ||
chat_id, user_id, ChatPermissions(can_send_messages=False) | ||
) | ||
except ChatAdminRequired: | ||
sent_message.edit( | ||
"❗ **Daisy is not admin here..**\n__Give me ban permissions and retry.. \n#Ending FSub...__" | ||
) | ||
|
||
except ChatAdminRequired: | ||
client.send_message( | ||
chat_id, | ||
text=f"❗ **I not an admin of @{channel} channel.**\n__Give me admin of that channel and retry.\n#Ending FSub...__", | ||
) | ||
|
||
|
||
@pbot.on_message(filters.command(["forcesubscribe", "fsub"]) & ~filters.private) | ||
def config(client, message): | ||
user = client.get_chat_member(message.chat.id, message.from_user.id) | ||
if user.status is "creator" or user.user.id in SUDO_USERS: | ||
chat_id = message.chat.id | ||
if len(message.command) > 1: | ||
input_str = message.command[1] | ||
input_str = input_str.replace("@", "") | ||
if input_str.lower() in ("off", "no", "disable"): | ||
sql.disapprove(chat_id) | ||
message.reply_text("❌ **Force Subscribe is Disabled Successfully.**") | ||
elif input_str.lower() in ("clear"): | ||
sent_message = message.reply_text( | ||
"**Unmuting all members who are muted by me...**" | ||
) | ||
try: | ||
for chat_member in client.get_chat_members( | ||
message.chat.id, filter="restricted" | ||
): | ||
if chat_member.restricted_by.id == (client.get_me()).id: | ||
client.unban_chat_member(chat_id, chat_member.user.id) | ||
time.sleep(1) | ||
sent_message.edit("✅ **UnMuted all members who are muted by me.**") | ||
except ChatAdminRequired: | ||
sent_message.edit( | ||
"❗ **I am not an admin in this chat.**\n__I can't unmute members because i am not an admin in this chat make me admin with ban user permission.__" | ||
) | ||
else: | ||
try: | ||
client.get_chat_member(input_str, "me") | ||
sql.add_channel(chat_id, input_str) | ||
message.reply_text( | ||
f"✅ **Force Subscribe is Enabled**\n__Force Subscribe is enabled, all the group members have to subscribe this [channel](https://t.me/{input_str}) in order to send messages in this group.__", | ||
disable_web_page_preview=True, | ||
) | ||
except UserNotParticipant: | ||
message.reply_text( | ||
f"❗ **Not an Admin in the Channel**\n__I am not an admin in the [channel](https://t.me/{input_str}). Add me as a admin in order to enable ForceSubscribe.__", | ||
disable_web_page_preview=True, | ||
) | ||
except (UsernameNotOccupied, PeerIdInvalid): | ||
message.reply_text(f"❗ **Invalid Channel Username.**") | ||
except Exception as err: | ||
message.reply_text(f"❗ **ERROR:** ```{err}```") | ||
else: | ||
if sql.fs_settings(chat_id): | ||
message.reply_text( | ||
f"✅ **Force Subscribe is enabled in this chat.**\n__For this [Channel](https://t.me/{sql.fs_settings(chat_id).channel})__", | ||
disable_web_page_preview=True, | ||
) | ||
else: | ||
message.reply_text("❌ **Force Subscribe is disabled in this chat.**") | ||
else: | ||
message.reply_text( | ||
"❗ **Group Creator Required**\n__You have to be the group creator to do that.__" | ||
) | ||
|
||
|
||
__help__ = """ | ||
*Force Subscribe:* | ||
❍ Yone can mute members who are not subscribed your channel until they subscribe | ||
❍ When enabled I will mute unsubscribed members and show them a unmute button. When they pressed the button I will unmute them | ||
*Setup* | ||
*Only creator* | ||
❍ Add me in your group as admin | ||
❍ Add me in your channel as admin | ||
*Commmands* | ||
❍ /fsub {channel username} - To turn on and setup the channel. | ||
💡Do this first... | ||
❍ /fsub - To get the current settings. | ||
❍ /fsub disable - To turn of ForceSubscribe.. | ||
💡If you disable fsub, you need to set again for working.. /fsub {channel username} | ||
❍ /fsub clear - To unmute all members who muted by me. | ||
""" | ||
__mod_name__ = "F-Sub" |
Oops, something went wrong.