-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ITS-ZAID/main
Added Many things
- Loading branch information
Showing
18 changed files
with
885 additions
and
31 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
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
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
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
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,107 @@ | ||
from telethon import events, Button | ||
from Zaid import Zaid | ||
from Zaid.status import * | ||
from telethon.tl.functions.channels import EditAdminRequest | ||
from telethon.tl.types import ChatAdminRights | ||
from telethon.tl.functions.users import GetFullUserRequest | ||
from telethon.tl.functions.messages import ExportChatInviteRequest | ||
|
||
@Zaid.on(events.callbackquery.CallbackQuery(data="admin")) | ||
async def _(event): | ||
|
||
await event.edit(ADMIN_TEXT, buttons=[[Button.inline("« Bᴀᴄᴋ", data="help")]]) | ||
|
||
@Zaid.on(events.callbackquery.CallbackQuery(data="play")) | ||
async def _(event): | ||
|
||
await event.edit(PLAY_TEXT, buttons=[[Button.inline("« Bᴀᴄᴋ", data="help")]]) | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]promote ?(.*)")) | ||
@is_admin | ||
async def promote(event, perm): | ||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups, not in PM!") | ||
return | ||
|
||
if not perm.add_admins: | ||
await event.reply("You are missing the following rights to use this command:CanAddAdmins!") | ||
return | ||
input_str = event.pattern_match.group(1) | ||
user = await event.get_reply_message() | ||
if not input_str and not user: | ||
await event.reply("Reply to a user or give its username to promote him!") | ||
return | ||
sed = await Zaid(GetFullUserRequest(id=user.sender_id or input_str)) | ||
await Stark(EditAdminRequest(event.chat_id, user.sender_id or input_str, ChatAdminRights( | ||
add_admins=False, | ||
invite_users=True, | ||
change_info=False, | ||
ban_users=True, | ||
delete_messages=True, | ||
pin_messages=True), rank="Admin")) | ||
|
||
if not input_str: | ||
await event.reply(f"Successfully Promoted [{sed.user.first_name}](tg://user?id={user.sender_id}) in {event.chat.title}!") | ||
return | ||
|
||
await event.reply(f"Succesfully Promoted {input_str} in {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]demote ?(.*)")) | ||
@is_admin | ||
async def promote(event, perm): | ||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups, not in PM!") | ||
return | ||
if not perm.add_admins: | ||
await event.reply("You are missing the following rights to use this command:CanAddAdmins!") | ||
return | ||
input_str = event.pattern_match.group(1) | ||
user = await event.get_reply_message() | ||
if not input_str and not user: | ||
await event.reply("Reply to a user or give its username to demote him!") | ||
return | ||
sed = await Zaid(GetFullUserRequest(id=user.sender_id or input_str)) | ||
await Stark(EditAdminRequest(event.chat_id, user.sender_id or input_str, ChatAdminRights( | ||
add_admins=False, | ||
invite_users=None, | ||
change_info=None, | ||
ban_users=None, | ||
delete_messages=None, | ||
pin_messages=None), rank="Not Admin")) | ||
|
||
if not input_str: | ||
await event.reply(f"Successfully Demoted [{sed.user.first_name}](tg://user?id={user.sender_id}) in {event.chat.title}!") | ||
return | ||
|
||
await event.reply(f"Succesfully Demoted {input_str} in {event.chat.title}") | ||
|
||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]invitelink")) | ||
async def invitelink(event): | ||
|
||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups, not in PM!") | ||
return | ||
link = await Zaid(ExportChatInviteRequest(event.chat_id)) | ||
await event.reply(f"Group link of {event.chat.title} is [here]({link.link})", link_preview=False) | ||
|
||
ADMIN_TEXT = """ | ||
**✘ A module from which admins of the chat can use!** | ||
‣ `?promote` - To Promote a user in the chat. | ||
‣ `?demote` - To Demote a user in the chat. | ||
‣ `?invitelink` - To get invitelink of a chat. | ||
‣ `?end` - To End music streaming. | ||
‣ `?skip` - To Skip Tracks Going on. | ||
‣ `?pause` - To Pause streaming. | ||
‣ `?resume` - to Resume Streaming. | ||
‣ `?leavevc` - force The Userbot to leave Vc Chat (Sometimes Joined). | ||
‣ `?playlist` - to check playlists. | ||
""" | ||
|
||
PLAY_TEXT = """ | ||
**✘ A module from which users of the chat can use!** | ||
‣ `?play` - To Play Audio from Else Reply to audio file. | ||
‣ `?vplay` - To Stream Videos (HEROKU_MODE > Doesn't support). | ||
""" |
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,172 @@ | ||
from Zaid import Zaid | ||
from Zaid.status import * | ||
from telethon import events, Button | ||
from telethon.tl.functions.channels import EditBannedRequest | ||
from telethon.tl.types import ChatBannedRights | ||
|
||
BANS_TEXT = """ | ||
**✘ Some people need to be publicly banned; spammers, annoyances, or just trolls.** | ||
‣ `?kickme` - To self Kick you from a chat. | ||
‣ `?kick` - To kick someone from a chat. | ||
‣ `?unban` - To unban a member from the chat. | ||
‣ `?ban` - To Ban Someone from a chat. | ||
‣ `?dban` - To delete the replied msg and bans the user. | ||
‣ `?sban` - To delete the replied msg and kicks the user. | ||
‣ `?skick` - To Delete Your msg and kicks the user | ||
‣ `?dkick` - To delete your msg and and kicks the replied user. | ||
""" | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]kick ?(.*)")) | ||
@is_admin | ||
async def kick(event, perm): | ||
|
||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups not PM") | ||
return | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
input_str = event.pattern_match.group(1) | ||
msg = await event.get_reply_message() | ||
if not input_str and not msg: | ||
await event.reply("Reply to a user or give its username to kick him") | ||
return | ||
|
||
replied_user = msg.sender_id | ||
us = msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
await Zaid.kick_participant(event.chat_id, input_str or replied_user) | ||
await event.reply(f"Succesfully Kicked [{info.first_name}](tg://user?id={replied_user}) from {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]kickme")) | ||
async def kickme(event): | ||
|
||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups not PM") | ||
return | ||
|
||
check = await Zaid.get_permissions(event.chat_id, event.sender_id) | ||
if check.is_admin: | ||
await event.reply("Sorry but I can't kick admins!") | ||
return | ||
|
||
await event.reply("Ok, as your wish") | ||
await Zaid.kick_participant(event.chat_id, event.sender_id) | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]ban ?(.*)")) | ||
@is_admin | ||
async def ban(event, perm): | ||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups not PM") | ||
return | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
input_str = event.pattern_match.group(1) | ||
msg = await event.get_reply_message() | ||
if not input_str and not msg: | ||
await event.reply("Reply to a user or give its username to ban him") | ||
return | ||
replied_user = msg.sender_id | ||
us = msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
await Zaid(EditBannedRequest(event.chat_id, replied_user, ChatBannedRights(until_date=None, view_messages=True))) | ||
await event.reply(f"Succesfully Banned [{info.first_name}](tg://user?id={replied_user}) in {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]unban ?(.*)")) | ||
@is_admin | ||
async def unban(event, perm): | ||
if event.is_private: | ||
await event.reply("This cmd is made to be used in groups not PM") | ||
return | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
input_str = event.pattern_match.group(1) | ||
msg = await event.get_reply_message() | ||
if not input_str and not msg: | ||
await event.reply("Reply to a user or give its username to unban him") | ||
return | ||
replied_user = msg.sender_id | ||
us = msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
await Zaid(EditBannedRequest(event.chat_id, replied_user, ChatBannedRights(until_date=None, view_messages=False))) | ||
await event.reply(f"Succesfully Unbanned [{info.first_name}](tg://user?id={replied_user}) in {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]skick")) | ||
@is_admin | ||
async def skick(event, perm): | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
reply_msg = await event.get_reply_message() | ||
if not reply_msg: | ||
await event.reply("Reply to someone to delete it and kick the user!") | ||
return | ||
|
||
us = reply_msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
x = (await event.get_reply_message()).sender_id | ||
zx = (await event.get_reply_message()) | ||
await event.delete() | ||
await Zaid.kick_participant(event.chat_id, x) | ||
await event.reply(f"Succesfully Kicked [{info.first_name}](tg://user?id={replied_user}) from {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]dkick")) | ||
@is_admin | ||
async def dkick(event, perm): | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
reply_msg = await event.get_reply_message() | ||
if not reply_msg: | ||
await event.reply("Reply to someone to delete it and kick the user!") | ||
return | ||
us = reply_msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
x = await event.get_reply_message() | ||
await x.delete() | ||
await Zaid.kick_participant(event.chat_id, x.sender_id) | ||
await event.reply(f"Succesfully Kicked [{info.first_name}](tg://user?id={replied_user}) from {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]dban")) | ||
@is_admin | ||
async def dban(event, perm): | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
reply_msg = await event.get_reply_message() | ||
if not reply_msg: | ||
await event.reply("Reply to someone to delete the message and ban the user!") | ||
return | ||
us = reply_msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
x = (await event.get_reply_message()).sender_id | ||
zx = (await event.get_reply_message()) | ||
await zx.delete() | ||
await Zaid(EditBannedRequest(event.chat_id, x, ChatBannedRights(until_date=None, view_messages=True))) | ||
await event.reply("Successfully Banned!") | ||
await event.reply(f"Succesfully Banned [{info.first_name}](tg://user?id={replied_user}) from {event.chat.title}") | ||
|
||
@Zaid.on(events.NewMessage(pattern="^[!?/]sban")) | ||
@is_admin | ||
async def sban(event, perm): | ||
if not perm.ban_users: | ||
await event.reply("You are missing the following rights to use this command:CanBanUsers!") | ||
return | ||
reply_msg = await event.get_reply_message() | ||
if not reply_msg: | ||
await event.reply("Reply to someone to delete the message and ban the user!") | ||
return | ||
us = reply_msg.sender.username | ||
info = await Zaid.get_entity(us) | ||
x = (await event.get_reply_message()).sender_id | ||
zx = (await event.get_reply_message()) | ||
await event.delete() | ||
await Zaid(EditBannedRequest(event.chat_id, x, ChatBannedRights(until_date=None, view_messages=True))) | ||
await event.reply(f"Succesfully Banned [{info.first_name}](tg://user?id={replied_user}) from {event.chat.title}") | ||
|
||
@Zaid.on(events.callbackquery.CallbackQuery(data="bans")) | ||
async def banhelp(event): | ||
await event.edit(BANS_TEXT, buttons=[[Button.inline("« Bᴀᴄᴋ", data="help")]]) |
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,32 @@ | ||
from telethon import events, Button | ||
from Zaid import Zaid, BOT_USERNAME | ||
|
||
btn =[ | ||
[Button.inline("Admin", data="admin"), Button.inline("Bans", data="bans")], | ||
[Button.inline("Pins", data="pins"), Button.inline("Pugres", data="purges")], | ||
[Button.inline("Play", data="play"), Button.inline("Chat Cleaner", data="zombies")], | ||
[Button.inline("Locks", data="locks"), Button.inline("Misc", data="misc")], | ||
[Button.inline("Home", data="start")]] | ||
|
||
HELP_TEXT = "Welcome To help Menu Section\n\nClick on the Buttons!" | ||
|
||
|
||
@Zaid.on(events.NewMessage(pattern="[!?/]help")) | ||
async def help(event): | ||
|
||
if event.is_group: | ||
await event.reply("Contact me in PM to get available help menu!", buttons=[ | ||
[Button.url("Help And Commands!", "t.me/{}?start=help".format(BOT_USERNAME))]]) | ||
return | ||
|
||
await event.reply(HELP_TEXT, buttons=btn) | ||
|
||
@Zaid.on(events.NewMessage(pattern="^/start help")) | ||
async def _(event): | ||
|
||
await event.reply(HELP_TEXT, buttons=btn) | ||
|
||
@Zaid.on(events.callbackquery.CallbackQuery(data="help")) | ||
async def _(event): | ||
|
||
await event.edit(HELP_TEXT, buttons=btn) |
Oops, something went wrong.