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 #22
Conversation
29308f5
to
3572f73
Compare
3572f73
to
ccbe202
Compare
amari_bot = ctx.guild.get_member(339254240012664832) | ||
if amari_bot: | ||
if amari_bot := ctx.guild.get_member(339254240012664832): |
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.
Function AmariLevel.amari
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
else: | ||
pass | ||
else: | ||
pass | ||
else: | ||
pass |
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.
Function AutoKick.on_member_join
refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass
)
if await self.config.guild(message.guild).enabled(): | ||
if ( | ||
not isinstance(message.channel, discord.TextChannel) | ||
or message.type != discord.MessageType.default | ||
or message.author.id == self.bot.user.id | ||
or message.author.bot | ||
or message.clean_content is None | ||
or message.author.id in await self.config.guild(message.guild).blacklisted_ids() | ||
if not await self.config.guild(message.guild).enabled(): | ||
return | ||
if ( | ||
not isinstance(message.channel, discord.TextChannel) | ||
or message.type != discord.MessageType.default | ||
or message.author.id == self.bot.user.id | ||
or message.author.bot | ||
or message.clean_content is None | ||
or message.author.id in await self.config.guild(message.guild).blacklisted_ids() | ||
): | ||
return | ||
content = message.clean_content | ||
dad = ", im dad" if await self.config.guild(message.guild).dad() else " " | ||
if search.search(content): | ||
try: | ||
back = search.search(content).group(1) | ||
await message.reply( | ||
f"Hi {back}{dad}", | ||
allowed_mentions=discord.AllowedMentions( | ||
everyone=False, roles=False, users=False | ||
), | ||
) | ||
except ( | ||
discord.HTTPException, | ||
discord.Forbidden, | ||
): | ||
return | ||
content = message.clean_content | ||
if await self.config.guild(message.guild).dad(): | ||
dad = ", im dad" | ||
else: | ||
dad = " " | ||
if search.search(content): | ||
try: | ||
back = search.search(content).group(1) | ||
await message.reply( | ||
f"Hi {back}{dad}", | ||
allowed_mentions=discord.AllowedMentions( | ||
everyone=False, roles=False, users=False | ||
), | ||
) | ||
except ( | ||
discord.HTTPException, | ||
discord.Forbidden, | ||
): | ||
pass | ||
else: | ||
pass | ||
pass |
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.
Function HiBack.on_message_without_command
refactored with the following changes:
- Add guard clause (
last-if-guard
) - Replace if statement with if expression (
assign-if-exp
) - Remove redundant pass statement (
remove-redundant-pass
)
search_string=str(query), | ||
search_string=query, | ||
blacklist=["nsfw", "religious", "political", "racist", "sexist"], | ||
) | ||
|
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.
Function Jokes.jokesearch
refactored with the following changes:
- Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
if int(number) < 10: | ||
if number < 10: | ||
j = await jokes() | ||
joke = await j.get_joke( | ||
response_format="txt", | ||
amount=int(number), | ||
amount=number, | ||
blacklist=["nsfw", "religious", "political", "racist", "sexist"], | ||
) | ||
|
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.
Function Jokes.mulitjoke
refactored with the following changes:
- Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 1.64%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Code Climate has analyzed commit 92a5e04 and detected 0 issues on this pull request. View more on Code Climate. |
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:Help us improve this pull request!