Skip to content
Open
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
9 changes: 3 additions & 6 deletions AsunaRobot/modules/blacklist_stickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ def blackliststicker(update: Update, context: CallbackContext):

split_text = split_message(sticker_list)
for text in split_text:
if (
sticker_list
== "<b>List blacklisted stickers currently in {}:</b>\n".format(
chat_name,
).format(html.escape(chat_name))
):
if sticker_list == "<b>List blacklisted stickers currently in {}:</b>\n".format(
chat_name,
).format(html.escape(chat_name)):
send_message(
update.effective_message,
"There are no blacklist stickers in <b>{}</b>!".format(
Expand Down
9 changes: 3 additions & 6 deletions AsunaRobot/modules/gettime.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ def generate_time(to_find: str, findtype: List[str]) -> str:
time_fmt = r"%H:%M:%S"
day_fmt = r"%A"
gmt_offset = zone["gmtOffset"]
timestamp = (
datetime.datetime.now(
datetime.timezone.utc,
)
+ datetime.timedelta(seconds=gmt_offset)
)
timestamp = datetime.datetime.now(
datetime.timezone.utc,
) + datetime.timedelta(seconds=gmt_offset)
current_date = timestamp.strftime(date_fmt)
current_time = timestamp.strftime(time_fmt)
current_day = timestamp.strftime(day_fmt)
Expand Down
4 changes: 2 additions & 2 deletions AsunaRobot/modules/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def del_lockables(update, context):
if lockable == "rtl":
if sql.is_locked(chat.id, lockable) and can_delete(chat, context.bot.id):
if message.caption:
check = ad.detect_alphabet(u"{}".format(message.caption))
check = ad.detect_alphabet("{}".format(message.caption))
if "ARABIC" in check:
try:
message.delete()
Expand All @@ -383,7 +383,7 @@ def del_lockables(update, context):
LOGGER.exception("ERROR in lockables")
break
if message.text:
check = ad.detect_alphabet(u"{}".format(message.text))
check = ad.detect_alphabet("{}".format(message.text))
if "ARABIC" in check:
try:
message.delete()
Expand Down
22 changes: 8 additions & 14 deletions AsunaRobot/modules/purge.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ async def purge_messages(event):
if event.from_id is None:
return

if (
not await user_is_admin(
user_id=event.sender_id,
message=event,
)
and event.from_id not in [1087968824]
):
if not await user_is_admin(
user_id=event.sender_id,
message=event,
) and event.from_id not in [1087968824]:
await event.reply("Only Admins are allowed to use this command")
return

Expand Down Expand Up @@ -55,13 +52,10 @@ async def delete_messages(event):
if event.from_id is None:
return

if (
not await user_is_admin(
user_id=event.sender_id,
message=event,
)
and event.from_id not in [1087968824]
):
if not await user_is_admin(
user_id=event.sender_id,
message=event,
) and event.from_id not in [1087968824]:
await event.reply("Only Admins are allowed to use this command")
return

Expand Down
2 changes: 1 addition & 1 deletion AsunaRobot/services/telethonbasics.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def humanbytes(size):
if not size:
return ""
# 2 ** 10 = 1024
power = 2 ** 10
power = 2**10
raised_to_pow = 0
dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"}
while size > power:
Expand Down
2 changes: 1 addition & 1 deletion AsunaRobot/utils/pluginhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def delete_or_pass(message):
def humanbytes(size):
if not size:
return ""
power = 2 ** 10
power = 2**10
raised_to_pow = 0
dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"}
while size > power:
Expand Down
4 changes: 2 additions & 2 deletions AsunaRobot/utils/uputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def progress(current, total, event, start, type_of_ps):


def convert_from_bytes(size):
power = 2 ** 10
power = 2**10
n = 0
units = {0: "", 1: "kilobytes", 2: "megabytes", 3: "gigabytes", 4: "terabytes"}
while size > power:
Expand All @@ -41,7 +41,7 @@ def humanbytes(size):
if not size:
return ""
# 2 ** 10 = 1024
power = 2 ** 10
power = 2**10
raised_to_pow = 0
dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"}
while size > power:
Expand Down