Skip to content

Instantly share code, notes, and snippets.

@RedL0tus
Created December 30, 2018 07:39
Show Gist options
  • Save RedL0tus/84be180c86798adb672477629b1d4bc9 to your computer and use it in GitHub Desktop.
Save RedL0tus/84be180c86798adb672477629b1d4bc9 to your computer and use it in GitHub Desktop.
Real time nick
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import time
FIRST_NAME = '咸鱼'
LAST_NAME = '@ %H:%M GMT' # Follow the rules of Python's strftime
START_TIME = time.time()
from pyrogram import Client, api
def update_name(client):
client.send(
api.functions.account.UpdateProfile(
first_name=time.strftime(FIRST_NAME, time.gmtime()),
last_name=time.strftime(LAST_NAME, time.gmtime()) # Change this if you want to use any other timezones
)
)
print('>>> Name updated.')
if __name__ == '__main__':
app = Client("real-time-nick")
with app:
while True:
update_name(app)
time.sleep(60.0 - ((time.time() - START_TIME) % 60.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment