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 Starbot ⭐ refactored kuba2k2/espionage-bot #1

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

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

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

git fetch https://github.com/sourcery-ai-bot/espionage-bot master
git merge --ff-only FETCH_HEAD
git reset HEAD^

for name in files.keys():
for name in files:
Copy link
Author

Choose a reason for hiding this comment

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

Function Espionage.__init__ refactored with the following changes:

Comment on lines -90 to +92
cmd=ESPIONAGE_FILE if not member.guild.voice_client else None,
cmd=None if member.guild.voice_client else ESPIONAGE_FILE,
)

Copy link
Author

Choose a reason for hiding this comment

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

Function Espionage.on_voice_state_update refactored with the following changes:

pack = "pack" in cmd and cmd["pack"]
if pack:
if pack := "pack" in cmd and cmd["pack"]:
Copy link
Author

Choose a reason for hiding this comment

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

Function Music.loop refactored with the following changes:

Comment on lines -90 to +92
f"Speed changing is not possible - missing file metadata.",
"Speed changing is not possible - missing file metadata.",
delete_after=10,
)

Copy link
Author

Choose a reason for hiding this comment

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

Function Music.speed refactored with the following changes:

version = file["version"] if "version" in file else 1
version = file.get("version", 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 migrate refactored with the following changes:

  • Simplify dictionary access using default get (default-get)

Comment on lines -166 to +153
if not voice:
return False
return len(voice.channel.voice_states) <= 1
return len(voice.channel.voice_states) <= 1 if voice else False
Copy link
Author

Choose a reason for hiding this comment

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

Function is_alone refactored with the following changes:

Comment on lines -178 to +163
await ctx.send(f"User is not connected to a voice channel.", delete_after=3)
await ctx.send("User is not connected to a voice channel.", delete_after=3)
Copy link
Author

Choose a reason for hiding this comment

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

Function ensure_voice refactored with the following changes:

Comment on lines -192 to +180
f"Only the author of the file or an admin can modify/remove it.",
"Only the author of the file or an admin can modify/remove it.",
delete_after=3,
)

Copy link
Author

Choose a reason for hiding this comment

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

Function ensure_can_modify refactored with the following changes:

Comment on lines -229 to +221
soundfont = "audio/x-sfbk" == mime_type or "SoundFont/Bank" in mime_text
soundfont = mime_type == "audio/x-sfbk" or "SoundFont/Bank" in mime_text
if soundfont:
return False, False, True, False, False
audio = mime_type.startswith("audio/")
video = mime_type.startswith("video/")
archive = mime_type in archive_mimetypes
midi = "audio/midi" == mime_type
midi = mime_type == "audio/midi"
Copy link
Author

Choose a reason for hiding this comment

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

Function check_file refactored with the following changes:

Comment on lines -250 to +236
if not "streams" in data:
if "streams" not in data:
Copy link
Author

Choose a reason for hiding this comment

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

Function get_audio_info refactored with the following changes:

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

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.

1 participant