remove gap when changing avatar
This commit is contained in:
@ -54,9 +54,10 @@ async def main():
|
||||
index = index + 1440
|
||||
elif index >= 1440:
|
||||
index = index - 1440
|
||||
prev_avatar = await client.get_profile_photos('me')
|
||||
filename = config.IMG_DIR + f'/{index:04}.' + config.IMG_EXT
|
||||
await client(DeletePhotosRequest(await client.get_profile_photos('me')))
|
||||
await client(UploadProfilePhotoRequest(await client.upload_file(filename)))
|
||||
await client(DeletePhotosRequest(prev_avatar))
|
||||
print('Avatar changed: ' + filename)
|
||||
|
||||
|
||||
|
@ -25,8 +25,8 @@ Cache="/var/cache/tg-avatar-alteration"
|
||||
|
||||
if [[ $(whoami) == "$TgAaUser" ]]; then
|
||||
/usr/bin/python3 "$App" "$Conf" "$Cache"
|
||||
elif [[ -n $(groups "${USER}" | grep -Fo 'wheel') ]] || [[ "${EUID}" -eq 0 ]]; then
|
||||
sudo -u "${TgAaUser}" -s -- /usr/bin/tg-avatar-alteration
|
||||
elif [[ -n $(groups "$USER" | grep -Fo 'wheel') ]] || [[ "$EUID" -eq 0 ]]; then
|
||||
sudo -u "$TgAaUser" -s -- /usr/bin/tg-avatar-alteration
|
||||
else
|
||||
echo "You must be ${TgAaUser}, root or sudo-user to run this command"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user