-
Notifications
You must be signed in to change notification settings - Fork 219
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 master branch #4
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,7 @@ | |
|
||
@Client.on_message(filters.incoming & filters.command(['start']) & filters.private) | ||
async def _start(client, message): | ||
update_channel = UPDATES_CHANNEL | ||
if update_channel: | ||
if update_channel := UPDATES_CHANNEL: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
try: | ||
user = await client.get_chat_member(update_channel, message.chat.id) | ||
if user.status == "kicked": | ||
|
@@ -39,7 +38,7 @@ async def _start(client, message): | |
except Exception: | ||
await client.send_message(message.chat.id, | ||
text=tr.START_MSG.format(message.from_user.first_name, message.from_user.id), | ||
reply_markup=InlineKeyboardMarkup( | ||
reply_markup=InlineKeyboardMarkup( | ||
[ | ||
[ | ||
InlineKeyboardButton("Join Updates Channel", url="https://t.me/UniversalBotsUpdate"), | ||
|
@@ -55,21 +54,21 @@ async def _start(client, message): | |
) | ||
return | ||
await client.send_message(message.chat.id, | ||
text=tr.START_MSG.format(message.from_user.first_name, message.from_user.id), | ||
reply_markup=InlineKeyboardMarkup( | ||
text=tr.START_MSG.format(message.from_user.first_name, message.from_user.id), | ||
reply_markup=InlineKeyboardMarkup( | ||
[ | ||
[ | ||
[ | ||
InlineKeyboardButton("Join Updates Channel", url="https://t.me/UniversalBotsUpdate"), | ||
InlineKeyboardButton("Support Group", url="https://t.me/UniversalBotsSupport") | ||
], | ||
[ | ||
InlineKeyboardButton("🧑💻Devloper🧑💻", url="https://t.me/JigarVarma2005") | ||
] | ||
InlineKeyboardButton("Join Updates Channel", url="https://t.me/UniversalBotsUpdate"), | ||
InlineKeyboardButton("Support Group", url="https://t.me/UniversalBotsSupport") | ||
], | ||
[ | ||
InlineKeyboardButton("🧑💻Devloper🧑💻", url="https://t.me/JigarVarma2005") | ||
] | ||
), | ||
parse_mode="markdown", | ||
reply_to_message_id=message.message_id | ||
) | ||
] | ||
), | ||
parse_mode="markdown", | ||
reply_to_message_id=message.message_id | ||
) | ||
|
||
|
||
@Client.on_message(filters.incoming & filters.command(['source_code']) & filters.private) | ||
|
@@ -96,8 +95,7 @@ async def _source_code(client, message): | |
|
||
@Client.on_message(filters.incoming & filters.command(['help']) & filters.private) | ||
async def _help(client, message): | ||
update_channel = UPDATES_CHANNEL | ||
if update_channel: | ||
if update_channel := UPDATES_CHANNEL: | ||
Comment on lines
-99
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
try: | ||
user = await client.get_chat_member(update_channel, message.chat.id) | ||
if user.status == "kicked": | ||
|
@@ -149,19 +147,20 @@ async def help_answer(client, callback_query): | |
|
||
|
||
def map(pos): | ||
if(pos==1): | ||
button = [ | ||
[InlineKeyboardButton(text = '-->', callback_data = "help+2")] | ||
] | ||
elif(pos==len(tr.HELP_MSG)-1): | ||
button = [ | ||
[InlineKeyboardButton(text = '<--', callback_data = f"help+{pos-1}")] | ||
if (pos==1): | ||
return [[InlineKeyboardButton(text='-->', callback_data="help+2")]] | ||
elif (pos==len(tr.HELP_MSG)-1): | ||
return [ | ||
[InlineKeyboardButton(text='<--', callback_data=f"help+{pos-1}")] | ||
] | ||
else: | ||
button = [ | ||
return [ | ||
[ | ||
InlineKeyboardButton(text = '<--', callback_data = f"help+{pos-1}"), | ||
InlineKeyboardButton(text = '-->', callback_data = f"help+{pos+1}") | ||
InlineKeyboardButton( | ||
text='<--', callback_data=f"help+{pos-1}" | ||
), | ||
InlineKeyboardButton( | ||
text='-->', callback_data=f"help+{pos+1}" | ||
), | ||
], | ||
] | ||
return button | ||
Comment on lines
-152
to
-167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ def add_channel(chat_id, channel): | |
SESSION.commit() | ||
|
||
def disapprove(chat_id): | ||
rem = SESSION.query(forceSubscribe).get(chat_id) | ||
if rem: | ||
if rem := SESSION.query(forceSubscribe).get(chat_id): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
SESSION.delete(rem) | ||
SESSION.commit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines
3-27
refactored with the following changes:collection-builtin-to-comprehension
)