Skip to content

Commit

Permalink
Apply QA changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ltzmax committed Jun 23, 2023
1 parent 30af6cf commit eeac5ce
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 88 deletions.
5 changes: 2 additions & 3 deletions autopublisher/autopublisher.py
Expand Up @@ -62,12 +62,11 @@ async def red_delete_data_for_user(self, **kwargs):
@commands.Cog.listener()
async def on_message_without_command(self, message: discord.Message):
"""Publish message to news channel."""
guild = message.guild
if message.guild is None:
return
if not await self.config.guild(guild).toggle():
if not await self.config.guild(message.guild).toggle():
return
if await self.bot.cog_disabled_in_guild(self, guild):
if await self.bot.cog_disabled_in_guild(self, message.guild):
return
if (
not message.guild.me.guild_permissions.manage_messages
Expand Down
72 changes: 0 additions & 72 deletions nekosbest/embed.py

This file was deleted.

50 changes: 49 additions & 1 deletion nekosbest/nekosbest.py
Expand Up @@ -27,7 +27,55 @@
import discord
from redbot.core import commands
from redbot.core.utils.chat_formatting import box
from .embed import api_call, embedgen

NEKOS_API = "https://nekos.best/api/v2/"
ICON = "https://nekos.best/logo_short.png"


async def api_call(self, ctx, endpoint: str):
await ctx.typing()
async with self.session.get(NEKOS_API + endpoint) as response:
if response.status != 200:
return await ctx.send("Something went wrong while trying to contact API.")
url = await response.json()
return url


async def embedgen(self, ctx, url, endpoint: str):
result = url["results"][0]
artist_name = result["artist_name"]
source_url = result["source_url"]
artist_href = result["artist_href"]
image = result["url"]

emb = discord.Embed(
title=f"Here's a picture of a {endpoint}",
description=f"**Artist:** [{artist_name}]({artist_href})\n**Source:** {source_url}",
)
emb.colour = await ctx.embed_color()
emb.set_image(url=image)
emb.set_footer(text="Powered by nekos.best", icon_url=ICON)
view = discord.ui.View()
style = discord.ButtonStyle.gray
artist = discord.ui.Button(
style=style,
label="Artist",
url=artist_href,
)
source = discord.ui.Button(
style=style,
label="Source",
url=source_url,
)
image = discord.ui.Button(
style=style,
label="Open Image",
url=image,
)
view.add_item(item=artist)
view.add_item(item=source)
view.add_item(item=image)
await ctx.send(embed=emb, view=view)


class NekosBest(commands.Cog):
Expand Down
5 changes: 2 additions & 3 deletions nospoiler/nospoiler.py
Expand Up @@ -63,14 +63,13 @@ async def red_delete_data_for_user(self, **kwargs):
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
"""handle spoiler messages"""
guild = message.guild
if message.guild is None:
return
if not await self.config.guild(message.guild).enabled():
return
if not message.guild.me.guild_permissions.manage_messages:
if await self.config.guild(guild).enabled():
await self.config.guild(guild).enabled.set(False)
if await self.config.guild(message.guild).enabled():
await self.config.guild(message.guild).enabled.set(False)
log.info(
"Spoiler filter is now disabled in %s because I don't have manage_messages permission.",
guild.name,
Expand Down
10 changes: 5 additions & 5 deletions roleplaycog/roleplaycog.py
Expand Up @@ -31,7 +31,7 @@

from .core import ACTIONS, ICON, NEKOS

log = logging.getLogger("red.maxcogs.veryfun")
log = logging.getLogger("red.maxcogs.roleplaycog")


class RolePlayCog(commands.Cog):
Expand Down Expand Up @@ -125,7 +125,7 @@ async def feed(self, ctx, member: discord.Member):
"""Feeds a user!"""
await self.embedgen(ctx, member, "feed")

@commands.command() # i want `hug` as alias. but i can't cause of core have their own hug command.
@commands.command()
@commands.bot_has_permissions(embed_links=True)
async def hugs(self, ctx, member: discord.Member):
"""Hugs a user!"""
Expand Down Expand Up @@ -154,7 +154,7 @@ async def pat(self, ctx, member: discord.Member):
async def pokes(self, ctx, member: discord.Member):
# Due to conflict with pokecord cog, it has to be pokes.
# Feel free to use alias cog if you want poke only.
"""Poke a user!"""
"""Pokes at a user!"""
await self.embedgen(ctx, member, "poke")

@commands.command()
Expand Down Expand Up @@ -196,7 +196,7 @@ async def bite(self, ctx, member: discord.Member):
@commands.command()
@commands.bot_has_permissions(embed_links=True)
async def blush(self, ctx, member: discord.Member):
"""blushs!"""
"""blushes!"""
await self.embedgen(ctx, member, "blush")

@commands.command()
Expand All @@ -208,7 +208,7 @@ async def bored(self, ctx, member: discord.Member):
@commands.command()
@commands.bot_has_permissions(embed_links=True)
async def facepalm(self, ctx, member: discord.Member):
"""Facepalm a user!"""
"""Facepalm at a user!"""
await self.embedgen(ctx, member, "facepalm")

@commands.command()
Expand Down
4 changes: 2 additions & 2 deletions tcgcard/__init__.py
@@ -1,11 +1,11 @@
from redbot.core.bot import Red

from .tcgcard import Tcgcard
from .tcgcard import TCGCard

__red_end_user_data_statement__ = (
"This cog does not persistently store data about users."
)


async def setup(bot: Red):
await bot.add_cog(Tcgcard(bot))
await bot.add_cog(TCGCard(bot))
2 changes: 1 addition & 1 deletion tcgcard/tcgcard.py
Expand Up @@ -34,7 +34,7 @@
from redbot.core.utils.views import SimpleMenu


class Tcgcard(commands.Cog):
class TCGCard(commands.Cog):
"""Fetch Pokémon cards based on Pokémon Trading Card Game (a.k.a Pokémon TCG)."""

__author__ = ["<@306810730055729152>", "MAX#1000"]
Expand Down
2 changes: 1 addition & 1 deletion whosthatpokemon/view.py
Expand Up @@ -48,7 +48,7 @@ async def guess_the_pokemon(self, interaction: discord.Interaction, button):
await self.message.edit(view=self)
# Send a message indicating who guessed the Pokémon
await interaction.followup.send(
f"{self.winner.display_name} Guessed the Pokémon correctly!"
f"{self.winner.display_name} guessed the Pokémon correctly!"
)

async def on_error(self, interaction, error, item):
Expand Down
2 changes: 2 additions & 0 deletions whosthatpokemon/whosthatpokemon.py
Expand Up @@ -181,6 +181,8 @@ async def whosthatpokemon(
**Arguments:**
- `[generation]` - Where you choose any generation from gen 1 to gen 8.
"""
if generation is None:
return await ctx.send("Please specify generation from gen1 to gen8.")
await ctx.typing()
poke_id = generation or randint(1, 898)
if_guessed_right = False
Expand Down

0 comments on commit eeac5ce

Please sign in to comment.