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 master branch #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Mar 4, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from amanqs March 4, 2023 12:52
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Due to GitHub API limits, only the first 60 comments can be shown.

if not len(message.command) == 1:
if len(message.command) != 1:
Copy link
Author

Choose a reason for hiding this comment

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

Function resume_com refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

Comment on lines -57 to +65
else:
if (
elif (
duration_seconds - (duration_played + duration_to_skip)
) <= 10:
return await message.reply_text(
_["admin_31"].format(
seconds_to_min(duration_played), duration
)
return await message.reply_text(
_["admin_31"].format(
seconds_to_min(duration_played), duration
)
)
else:
Copy link
Author

Choose a reason for hiding this comment

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

Function seek_comm refactored with the following changes:

if not len(message.command) == 1:
if len(message.command) != 1:
Copy link
Author

Choose a reason for hiding this comment

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

Function admins refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

Comment on lines -38 to +82
if not len(message.command) < 2:
if len(message.command) >= 2:
loop = await get_loop(chat_id)
if loop != 0:
return await message.reply_text(_["admin_12"])
state = message.text.split(None, 1)[1].strip()
if state.isnumeric():
state = int(state)
check = db.get(chat_id)
if check:
count = len(check)
if count > 2:
count = int(count - 1)
if 1 <= state <= count:
for x in range(state):
popped = None
try:
popped = check.pop(0)
except:
return await message.reply_text(
_["admin_16"]
)
if popped:
if (
config.AUTO_DOWNLOADS_CLEAR
== str(True)
):
await auto_clean(popped)
if not check:
try:
await message.reply_text(
_["admin_10"].format(
message.from_user.first_name
)
)
await Amang.stop_stream(chat_id)
except:
return
break
else:
return await message.reply_text(
_["admin_15"].format(count)
)
else:
return await message.reply_text(_["admin_14"])
else:
return await message.reply_text(_["queue_2"])
else:
if not state.isnumeric():
return await message.reply_text(_["admin_13"])
state = int(state)
check = db.get(chat_id)
if not check:
return await message.reply_text(_["queue_2"])
count = len(check)
if count <= 2:
return await message.reply_text(_["admin_14"])
count = int(count - 1)
if not 1 <= state <= count:
return await message.reply_text(
_["admin_15"].format(count)
)
for _ in range(state):
popped = None
try:
popped = check.pop(0)
except:
return await message.reply_text(
_["admin_16"]
)
if popped and (config.AUTO_DOWNLOADS_CLEAR == str(True)):
await auto_clean(popped)
if not check:
try:
await message.reply_text(
_["admin_10"].format(
message.from_user.first_name
)
)
await Amang.stop_stream(chat_id)
except:
return
break
else:
check = db.get(chat_id)
popped = None
try:
popped = check.pop(0)
if popped:
if popped := check.pop(0):
Copy link
Author

Choose a reason for hiding this comment

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

Function skip refactored with the following changes:

if not len(message.command) == 1:
if len(message.command) != 1:
Copy link
Author

Choose a reason for hiding this comment

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

Function stop_music refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

if not len(message.command) == 1 or message.reply_to_message:
if len(message.command) != 1 or message.reply_to_message:
Copy link
Author

Choose a reason for hiding this comment

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

Function unmute_admin refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

Comment on lines -100 to +103
else:
await CallbackQuery.edit_message_text(
helpers.HELP_5, reply_markup=keyboard
)
return await CallbackQuery.answer()
await CallbackQuery.edit_message_text(
helpers.HELP_5, reply_markup=keyboard
)
return await CallbackQuery.answer()
Copy link
Author

Choose a reason for hiding this comment

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

Function helper_cb refactored with the following changes:

@@ -20,7 +20,6 @@
@app.on_inline_query(~BANNED_USERS)
async def inline_query_handler(client, query):
text = query.query.strip().lower()
answers = []
Copy link
Author

Choose a reason for hiding this comment

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

Function inline_query_handler refactored with the following changes:

Comment on lines -200 to +203
cle = None
if await is_cleanmode_on(CallbackQuery.message.chat.id):
cle = True
cle = True if await is_cleanmode_on(CallbackQuery.message.chat.id) else None
if await is_commanddelete_on(CallbackQuery.message.chat.id):
sta = True
sug = None
if await is_suggestion(CallbackQuery.message.chat.id):
sug = True
sug = True if await is_suggestion(CallbackQuery.message.chat.id) else None
Copy link
Author

Choose a reason for hiding this comment

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

Function without_Admin_rights refactored with the following changes:

Comment on lines -337 to +323
if playmode == "Direct":
Direct = True
else:
Direct = None
Direct = True if playmode == "Direct" else None
playty = await get_playtype(CallbackQuery.message.chat.id)
if playty == "Everyone":
Playtype = None
else:
Playtype = True
Playtype = None if playty == "Everyone" else True
Copy link
Author

Choose a reason for hiding this comment

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

Function playmode_ans refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants