Compare commits
3 commits
d5a248733a
...
0f47a15291
Author | SHA1 | Date | |
---|---|---|---|
0f47a15291 | |||
7f2a81e350 | |||
5c5a2f28b2 |
4 changed files with 52 additions and 49 deletions
|
@ -27,7 +27,7 @@ class Bible(commands.Cog):
|
||||||
|
|
||||||
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
||||||
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
||||||
__version__ = "1.1.2"
|
__version__ = "1.1.3"
|
||||||
__documentation__ = "https://seacogs.coastalcommits.com/pterodactyl/"
|
__documentation__ = "https://seacogs.coastalcommits.com/pterodactyl/"
|
||||||
|
|
||||||
def __init__(self, bot: Red):
|
def __init__(self, bot: Red):
|
||||||
|
@ -97,14 +97,14 @@ class Bible(commands.Cog):
|
||||||
if response.status == 503:
|
if response.status == 503:
|
||||||
raise bible.errors.ServiceUnavailableError()
|
raise bible.errors.ServiceUnavailableError()
|
||||||
return Version(
|
return Version(
|
||||||
bible_id,
|
bible_id=bible_id,
|
||||||
data["data"]["abbreviation"],
|
abbreviation=data["data"]["abbreviation"],
|
||||||
data["data"]["language"]["name"],
|
language=data["data"]["language"]["name"],
|
||||||
data["data"]["abbreviationLocal"],
|
abbreviation_local=data["data"]["abbreviationLocal"],
|
||||||
data["data"]["language"]["nameLocal"],
|
language_local=data["data"]["language"]["nameLocal"],
|
||||||
data["data"]["description"],
|
description=data["data"]["description"],
|
||||||
data["data"]["descriptionLocal"],
|
description_local=data["data"]["descriptionLocal"],
|
||||||
data["data"]["copyright"],
|
version_copyright=data["data"]["copyright"],
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _get_passage(
|
async def _get_passage(
|
||||||
|
@ -270,7 +270,7 @@ class Bible(commands.Cog):
|
||||||
description=passage["content"].replace("¶ ", ""),
|
description=passage["content"].replace("¶ ", ""),
|
||||||
color=await ctx.embed_color(),
|
color=await ctx.embed_color(),
|
||||||
)
|
)
|
||||||
embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible - {version.abbreviationLocal} ({version.languageLocal}, {version.descriptionLocal})", icon_url="attachment://icon.png")
|
embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible - {version.abbreviation_local} ({version.language_local}, {version.description_local})", icon_url="attachment://icon.png")
|
||||||
await ctx.send(embed=embed, file=icon)
|
await ctx.send(embed=embed, file=icon)
|
||||||
else:
|
else:
|
||||||
await ctx.send(f"## {passage['reference']}\n{passage['content']}")
|
await ctx.send(f"## {passage['reference']}\n{passage['content']}")
|
||||||
|
@ -309,7 +309,7 @@ class Bible(commands.Cog):
|
||||||
description=passage["content"].replace("¶ ", ""),
|
description=passage["content"].replace("¶ ", ""),
|
||||||
color=await ctx.embed_color(),
|
color=await ctx.embed_color(),
|
||||||
)
|
)
|
||||||
embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible - {version.abbreviationLocal} ({version.languageLocal}, {version.descriptionLocal})", icon_url="attachment://icon.png")
|
embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible - {version.abbreviation_local} ({version.language_local}, {version.description_local})", icon_url="attachment://icon.png")
|
||||||
await ctx.send(embed=embed, file=icon)
|
await ctx.send(embed=embed, file=icon)
|
||||||
else:
|
else:
|
||||||
await ctx.send(f"## {passage['reference']}\n{passage['content']}")
|
await ctx.send(f"## {passage['reference']}\n{passage['content']}")
|
||||||
|
|
|
@ -4,23 +4,23 @@ class Version:
|
||||||
bible_id,
|
bible_id,
|
||||||
abbreviation,
|
abbreviation,
|
||||||
language,
|
language,
|
||||||
abbreviationLocal,
|
abbreviation_local,
|
||||||
languageLocal,
|
language_local,
|
||||||
description,
|
description,
|
||||||
descriptionLocal,
|
description_local,
|
||||||
version_copyright,
|
version_copyright,
|
||||||
):
|
):
|
||||||
self.bible_id = bible_id
|
self.bible_id = bible_id
|
||||||
self.abbreviation = abbreviation
|
self.abbreviation = abbreviation
|
||||||
self.language = language
|
self.language = language
|
||||||
self.abbreviationLocal = abbreviationLocal
|
self.abbreviation_local = abbreviation_local
|
||||||
self.languageLocal = languageLocal
|
self.language_local = language_local
|
||||||
self.description = description
|
self.description = description
|
||||||
self.descriptionLocal = descriptionLocal
|
self.description_local = description_local
|
||||||
self.copyright = version_copyright
|
self.copyright = version_copyright
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.abbreviationLocal
|
return self.abbreviation_local
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'bible.models.Version("{self.bible_id}", "{self.abbreviation}", "{self.language}", "{self.abbreviationLocal}", "{self.languageLocal}", "{self.description}", "{self.descriptionLocal}", "{self.copyright}")'
|
return f'bible.models.Version("{self.bible_id}", "{self.abbreviation}", "{self.language}", "{self.abbreviation_local}", "{self.language_local}", "{self.description}", "{self.description_local}", "{self.copyright}")'
|
||||||
|
|
|
@ -16,13 +16,13 @@ class EmojiInfo(commands.Cog):
|
||||||
|
|
||||||
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
||||||
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.0.2"
|
||||||
__documentation__ = "https://seacogs.coastalcommits.com/emojiinfo/"
|
__documentation__ = "https://seacogs.coastalcommits.com/emojiinfo/"
|
||||||
|
|
||||||
def __init__(self, bot: Red) -> None:
|
def __init__(self, bot: Red) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.bot: Red = bot
|
self.bot: Red = bot
|
||||||
self.logger: RedTraceLogger = getLogger(name="red.SeaCogs.Emoji")
|
self.logger: RedTraceLogger = getLogger(name="red.SeaCogs.EmojiInfo")
|
||||||
|
|
||||||
def format_help_for_context(self, ctx: commands.Context) -> str:
|
def format_help_for_context(self, ctx: commands.Context) -> str:
|
||||||
pre_processed = super().format_help_for_context(ctx) or ""
|
pre_processed = super().format_help_for_context(ctx) or ""
|
||||||
|
@ -35,7 +35,6 @@ class EmojiInfo(commands.Cog):
|
||||||
]
|
]
|
||||||
return "\n".join(text)
|
return "\n".join(text)
|
||||||
|
|
||||||
|
|
||||||
async def fetch_twemoji(self, unicode_emoji) -> str:
|
async def fetch_twemoji(self, unicode_emoji) -> str:
|
||||||
base_url = "https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/72x72/"
|
base_url = "https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/72x72/"
|
||||||
emoji_codepoint = "-".join([hex(ord(char))[2:] for char in unicode_emoji])
|
emoji_codepoint = "-".join([hex(ord(char))[2:] for char in unicode_emoji])
|
||||||
|
@ -76,35 +75,26 @@ class EmojiInfo(commands.Cog):
|
||||||
aliases = f"{bold('Aliases:')} {', '.join(emoji.aliases)}\n" if emoji.aliases else ""
|
aliases = f"{bold('Aliases:')} {', '.join(emoji.aliases)}\n" if emoji.aliases else ""
|
||||||
group = f"{bold('Group:')} {emoji.group}\n"
|
group = f"{bold('Group:')} {emoji.group}\n"
|
||||||
|
|
||||||
return (
|
return (f"{name}{emoji_id}{bold('Native:')} {emoji.is_unicode_emoji()}\n{group}{aliases}{bold('Animated:')} {emoji.animated}\n{bold('Markdown:')} {markdown}\n{bold('URL:')} [Click Here]({emoji_url})"), emoji_url
|
||||||
f"{name}"
|
|
||||||
f"{emoji_id}"
|
|
||||||
f"{bold('Native:')} {emoji.is_unicode_emoji()}\n"
|
|
||||||
f"{group}"
|
|
||||||
f"{aliases}"
|
|
||||||
f"{bold('Animated:')} {emoji.animated}\n"
|
|
||||||
f"{bold('Markdown:')} {markdown}\n"
|
|
||||||
f"{bold('URL:')} [Click Here]({emoji_url})"
|
|
||||||
), emoji_url
|
|
||||||
|
|
||||||
@app_commands.command(name="emoji")
|
@app_commands.command(name="emoji")
|
||||||
@app_commands.describe(
|
@app_commands.describe(emoji="What emoji would you like to get information on?", ephemeral="Would you like the response to be hidden?")
|
||||||
emoji="What emoji would you like to get information on?",
|
|
||||||
ephemeral="Would you like the response to be hidden?"
|
|
||||||
)
|
|
||||||
async def emoji_slash(self, interaction: discord.Interaction, emoji: str, ephemeral: bool = True) -> None:
|
async def emoji_slash(self, interaction: discord.Interaction, emoji: str, ephemeral: bool = True) -> None:
|
||||||
"""Retrieve information about an emoji."""
|
"""Retrieve information about an emoji."""
|
||||||
await interaction.response.defer(ephemeral=ephemeral)
|
await interaction.response.defer(ephemeral=ephemeral)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
||||||
string, emoji_url, = await self.get_emoji_info(emoji)
|
(
|
||||||
|
string,
|
||||||
|
emoji_url,
|
||||||
|
) = await self.get_emoji_info(emoji)
|
||||||
self.logger.verbose(f"Emoji:\n{string}")
|
self.logger.verbose(f"Emoji:\n{string}")
|
||||||
except (IndexError, UnboundLocalError):
|
except (IndexError, UnboundLocalError):
|
||||||
return await interaction.followup.send("Please provide a valid emoji!")
|
return await interaction.followup.send("Please provide a valid emoji!")
|
||||||
|
|
||||||
if await self.bot.embed_requested(channel=interaction.channel):
|
if await self.bot.embed_requested(channel=interaction.channel):
|
||||||
embed = embed = discord.Embed(title="Emoji Information", description=string, color = await self.fetch_primary_color(emoji_url) or await self.bot.get_embed_color(interaction.channel))
|
embed = discord.Embed(title="Emoji Information", description=string, color=await self.fetch_primary_color(emoji_url) or await self.bot.get_embed_color(interaction.channel))
|
||||||
embed.set_thumbnail(url=emoji_url)
|
embed.set_thumbnail(url=emoji_url)
|
||||||
|
|
||||||
await interaction.followup.send(embed=embed)
|
await interaction.followup.send(embed=embed)
|
||||||
|
@ -116,13 +106,16 @@ class EmojiInfo(commands.Cog):
|
||||||
"""Retrieve information about an emoji."""
|
"""Retrieve information about an emoji."""
|
||||||
try:
|
try:
|
||||||
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
||||||
string, emoji_url, = await self.get_emoji_info(emoji)
|
(
|
||||||
|
string,
|
||||||
|
emoji_url,
|
||||||
|
) = await self.get_emoji_info(emoji)
|
||||||
self.logger.verbose(f"Emoji:\n{string}")
|
self.logger.verbose(f"Emoji:\n{string}")
|
||||||
except (IndexError, UnboundLocalError):
|
except (IndexError, UnboundLocalError):
|
||||||
return await ctx.send("Please provide a valid emoji!")
|
return await ctx.send("Please provide a valid emoji!")
|
||||||
|
|
||||||
if await ctx.embed_requested():
|
if await ctx.embed_requested():
|
||||||
embed = embed = discord.Embed(title="Emoji Information", description=string, color = await self.fetch_primary_color(emoji_url) or await ctx.embed_color)
|
embed = discord.Embed(title="Emoji Information", description=string, color=await self.fetch_primary_color(emoji_url) or await ctx.embed_color)
|
||||||
embed.set_thumbnail(url=emoji_url)
|
embed.set_thumbnail(url=emoji_url)
|
||||||
|
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
name = "seacogs"
|
name = "seacogs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "My assorted cogs for Red-DiscordBot."
|
description = "My assorted cogs for Red-DiscordBot."
|
||||||
authors = [{name = "cswimr", email = "seaswimmerthefsh@gmail.com"}]
|
authors = [{ name = "cswimr", email = "seaswimmerthefsh@gmail.com" }]
|
||||||
license = {file="LICENSE"}
|
license = { file = "LICENSE" }
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
@ -33,11 +33,7 @@ documentation = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.uv]
|
[tool.uv]
|
||||||
dev-dependencies = [
|
dev-dependencies = ["pylint>=3.3.1", "ruff>=0.6.9", "sqlite-web>=0.6.4"]
|
||||||
"pylint>=3.3.1",
|
|
||||||
"ruff>=0.6.9",
|
|
||||||
"sqlite-web>=0.6.4",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
py-dactyl = { git = "https://github.com/cswimr/pydactyl" }
|
py-dactyl = { git = "https://github.com/cswimr/pydactyl" }
|
||||||
|
@ -84,8 +80,22 @@ target-version = "py311"
|
||||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||||
# McCabe complexity (`C901`) by default.
|
# McCabe complexity (`C901`) by default.
|
||||||
select = ["I", "N", "F", "W", "E", "G", "INP", "T20", "PLC", "PLE", "PLW", "PLR", "LOG"]
|
select = [
|
||||||
ignore = ["PLR0912", "PLR0915", "PLR2004"]
|
"I",
|
||||||
|
"N",
|
||||||
|
"F",
|
||||||
|
"W",
|
||||||
|
"E",
|
||||||
|
"G",
|
||||||
|
"INP",
|
||||||
|
"T20",
|
||||||
|
"PLC",
|
||||||
|
"PLE",
|
||||||
|
"PLW",
|
||||||
|
"PLR",
|
||||||
|
"LOG",
|
||||||
|
]
|
||||||
|
ignore = ["PLR0912", "PLR0915", "PLR2004", "PLR0913"]
|
||||||
|
|
||||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||||
fixable = ["ALL"]
|
fixable = ["ALL"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue