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

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 5 additions & 8 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
CHANNELS = os.environ['CHANNELS']
STRING_SESSION = os.environ['STRING_SESSION']

CHANNELS = [i for i in CHANNELS.split(' ')]
CHANNELS = list(CHANNELS.split(' '))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 10-10 refactored with the following changes:

MSG_ID = int(os.environ['MSG_ID'])
COUNTS_EDIT_CHANNEL = os.environ['COUNTS_EDIT_CHANNEL']

Expand Down Expand Up @@ -39,17 +39,14 @@ async def runbot():
CH_USERNAME = channel
toprint += f'<a href=https://t.me/{CH_USERNAME}>{CH_TITLE}</a>: `{CH_MCOUNT}`\n'
me = await xbot.get_me()
toprint += f'\nBy <a href=tg://user?id={str(me.id)}>{me.first_name}</a>'
toprint += f'\nBy <a href=tg://user?id={me.id}>{me.first_name}</a>'
f = await xbot.get_messages(COUNTS_EDIT_CHANNEL, MSG_ID)
if f.text.html == toprint:
print('Checked')
else:
if f.text.html != toprint:
try:
await xbot.edit_message_text(COUNTS_EDIT_CHANNEL, MSG_ID, toprint, disable_web_page_preview=True)
except FloodWait as e:
print(f'FloodWait: Sleeping for {str(e.x)} seconds')
print(f'FloodWait: Sleeping for {e.x} seconds')
await asyncio.sleep(e.x)
pass
print('Checked')
print('Checked')
Comment on lines -42 to +50
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function runbot refactored with the following changes:


xbot.run(runbot())