Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeldrisdev #57

Merged
merged 4 commits into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
alphabet_detector
bleach
bs4
alphabet_detector==0.0.7
bleach==4.1.0
bs4==0.0.1
cachetools
emoji
emoji==1.6.3
feedparser
future
googletrans
gpytranslate
gtts
gpytranslate==1.4.0
gtts==2.2.3
hurry.filesize
jikanpy
lxml
markdown2
multicolorcaptcha
pillow
jikanpy==4.3.2
lxml==4.7.1
markdown2==2.4.2
multicolorcaptcha==1.1.3
pillow==9.0.0
pretty-errors
psutil==5.9.0
psycopg2-binary
pyrate-limiter
python-telegram-bot==13.5
python-telegram-bot==13.9.0
pytz
redis
redis==4.1.0
requests
spamwatch
spamwatch==0.3.0
speedtest-cli>=2.0.2
sqlalchemy
telethon==1.16.4
telegraph
ujson
sqlalchemy==1.4.29
telethon==1.24.0
telegraph==2.1.0
ujson==5.1.0
wget
psutil
wikipedia
wikipedia==1.4.0
35 changes: 33 additions & 2 deletions zeldris/modules/bans.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ def ban(update, context):
user = update.effective_user
message = update.effective_message
bot, args = context.bot, context.args
reason = ""
if message.reply_to_message and message.reply_to_message.sender_chat:
r = bot.ban_chat_sender_chat(
chat_id=chat.id, sender_chat_id=message.reply_to_message.sender_chat.id
)
if r:
message.reply_text(
"Finally! Channel {} was banned successfully from {}\n\n💡 He can only write with his profile but not through other channels.".format(
html.escape(message.reply_to_message.sender_chat.title),
html.escape(chat.title),
),
parse_mode="html",
)
else:
message.reply_text("Failed to ban channel")
return

if user_can_ban(chat, user, bot.id) is False:
message.reply_text("You don't have enough rights to ban users!")
Expand Down Expand Up @@ -366,8 +382,23 @@ def unban(update, context):
message = update.effective_message # type: Optional[Message]
user = update.effective_user # type: Optional[User]
chat = update.effective_chat # type: Optional[Chat]
args = context.args

log_message = ""
bot, args = context.bot, context.args
if message.reply_to_message and message.reply_to_message.sender_chat:
r = bot.unban_chat_sender_chat(
chat_id=chat.id, sender_chat_id=message.reply_to_message.sender_chat.id
)
if r:
message.reply_text(
"Finally! Channel {} was unbanned successfully from {}\n\n💡 Now this users can send the messages with they channel again".format(
html.escape(message.reply_to_message.sender_chat.title),
html.escape(chat.title),
),
parse_mode="html",
)
else:
message.reply_text("Failed to unban channel")
return
if user_can_ban(chat, user, context.bot.id) is False:
message.reply_text("You don't have enough rights to unban people here!")
return ""
Expand Down
4 changes: 2 additions & 2 deletions zeldris/modules/purge.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def purge(event):
chat = event.chat_id
msgs = []

if not await is_administrator(user_id=event.from_id, message=event):
if not await is_administrator(user_id=event.sender_id, message=event):
await event.reply("You're not an admin!")
return

Expand Down Expand Up @@ -81,7 +81,7 @@ async def purge(event):

@client.on(events.NewMessage(pattern="^/del$"))
async def delete_msg(event):
if not await is_administrator(user_id=event.from_id, message=event):
if not await is_administrator(user_id=event.sender_id, message=event):
await event.reply("You're not an admin!")
return

Expand Down