|
@@ -198,7 +198,12 @@ async def make_message_shot(bot, message):
|
|
|
await proc.communicate(input=data)
|
|
|
|
|
|
await remove(avatar_path)
|
|
|
-
|
|
|
+
|
|
|
+ pproc = await create_subprocess_shell(
|
|
|
+ f'pngcrush -reduce -brute -ow {output_path} {output_path}'
|
|
|
+ )
|
|
|
+ await pproc.communicate()
|
|
|
+
|
|
|
return output_path
|
|
|
|
|
|
async def save_handler(bot, event, command):
|
|
@@ -222,7 +227,7 @@ async def save_handler(bot, event, command):
|
|
|
|
|
|
try:
|
|
|
file = await add_sticker(bot, path, emoji)
|
|
|
-
|
|
|
+
|
|
|
await bot.send_file(
|
|
|
message.peer_id,
|
|
|
file=file,
|
|
@@ -262,8 +267,15 @@ async def bday_handler(bot, event, command):
|
|
|
birthdays = sorted(birthdays, key=lambda birthday: birthday[1].days_until)
|
|
|
|
|
|
birthdays_list = ''
|
|
|
- for user_id, age in birthdays:
|
|
|
- birthdays_list += get_user_name(await bot.get_entity(user_id))
|
|
|
+ for user_id, age in birthdays:
|
|
|
+ try:
|
|
|
+ entity = await bot.get_entity(user_id)
|
|
|
+ except ValueError:
|
|
|
+ birthdays_list += 'Ошибка!\n'
|
|
|
+
|
|
|
+ continue
|
|
|
+
|
|
|
+ birthdays_list += get_user_name(entity)
|
|
|
birthdays_list += ' — '
|
|
|
birthdays_list += age.date_string
|
|
|
birthdays_list += f' (через {get_word_for("день", age.days_until)} исполнится {get_word_for("год", age.age)}; сейчас {get_word_for("год", age.age_now)})\n'
|