Skip to content

Commit

Permalink
Merge pull request #22 from Honkertonken/sourcery/master
Browse files Browse the repository at this point in the history
Sourcery refactored master branch
  • Loading branch information
Honkertonken committed Apr 28, 2022
2 parents 35e9076 + 92a5e04 commit 577e496
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 42 deletions.
3 changes: 1 addition & 2 deletions amarilevel/amarilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ async def amari(self, ctx, *member: discord.Member):
token = (await self.bot.get_shared_api_tokens("amari")).get("auth")
amari = AmariClient(token)
bot_info = await self.bot.application_info()
amari_bot = ctx.guild.get_member(339254240012664832)
if amari_bot:
if amari_bot := ctx.guild.get_member(339254240012664832):
if not member:
member = ctx.author
try:
Expand Down
6 changes: 0 additions & 6 deletions autokick/autokick.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,3 @@ async def on_member_join(self, member: discord.Member):
await logs.send(
f"{member} could not be auto kicked. Please make sure i have necessary permissions and try again."
)
else:
pass
else:
pass
else:
pass
4 changes: 3 additions & 1 deletion buttoninvite/url_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ async def send_message(
embed: Optional[discord.Embed] = None,
url_button: Optional[URLButton] = None,
):
"""Send a message with a URL button, with pure dpy 1.7."""
"""
Send a message with a URL button, with pure dpy 1.7.
"""
payload = {}

if content:
Expand Down
56 changes: 26 additions & 30 deletions hiback/hiback.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,30 @@ async def on_message_without_command(self, message):
"""
Handle on_message.
"""
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
8 changes: 5 additions & 3 deletions jokes/jokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ async def jokesearch(self, ctx, *, query: str):
j = await jokes()
joke = await j.get_joke(
response_format="txt",
search_string=str(query),
search_string=query,
blacklist=["nsfw", "religious", "political", "racist", "sexist"],
)

await ctx.send(joke)

@commands.command()
Expand All @@ -101,13 +102,14 @@ async def mulitjoke(self, ctx, number: int):
10 is the max number of jokes you can get at once.
"""
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"],
)

await ctx.send(joke)
else:
await ctx.send("10 is the maximum number of jokes you can get at once.")

0 comments on commit 577e496

Please sign in to comment.