Skip to content

Commit 8f39b13

Browse files
committed
feat: add version variable & version command
1 parent e7b56c3 commit 8f39b13

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ Update sesp.isadev.subdomains to use the new API schema (`record` was changed to
4141
Update sesp.isadev.subdomains to use the new API for reserved subdomains ~ now the `internal` key is used for staff subdomains instead of `reserved`.
4242

4343
#### 1.4.7
44-
Fix the message used for internal subdomains as opposed to reserved subdomains in sesp.isadev.subdomains, and fix a bug introduced in v1.4.6.
44+
Fix the message used for internal subdomains as opposed to reserved subdomains in sesp.isadev.subdomains, and fix a bug introduced in v1.4.6.
45+
46+
#### 1.5.0
47+
Added the VERSION variable in the config and updated listeners.ping_response to use it. Additionally added the version command in util.utils.

takina/cogs/listeners/ping_response.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,24 @@ async def construct_info_embed(
3333
embed = nextcord.Embed(
3434
title=f"{await fetch_random_emoji()}Takina",
3535
url="https://orangc.net/takina",
36-
description="-# Open a [bug report](https://github.com/orangci/takina/issues/new?template=bug_report.md) • Make a [feature request](https://github.com/orangci/takina/issues/new?template=feature_request.md)\n\n Takina is a multipurpose [opensource](https://github.com/orangci/takina) bot written in Python. More information is available in the [website](https://orangc.net/takina).",
36+
description="-# Open a [bug report](https://github.com/orangci/takina/issues/new?template=bug_report.md) • Make a [feature request](https://github.com/orangci/takina/issues/new?template=feature_request.md)\n\n Takina is a multipurpose [opensource](https://github.com/orangci/takina) bot written in Python by [orangc](https://orangc.net). More information is available in the [website](https://orangc.net/takina).\n",
3737
color=EMBED_COLOR,
3838
)
3939

4040
if ctx and hasattr(ctx, "guild"):
4141
guild_id = ctx.guild.id
4242
guild_data = await self.db.prefixes.find_one({"guild_id": guild_id})
4343
if guild_data and "prefix" in guild_data:
44-
self.prefix = f"`{guild_data["prefix"]}`, `takina `, `Takina `"
44+
self.prefix = f"`{guild_data["prefix"]}`, `takina`, `Takina`"
4545

46-
embed.add_field(name=":sparkles: Prefix", value=self.prefix, inline=True)
47-
embed.add_field(name=":star: Stars", value=str(self.stars), inline=True)
48-
embed.add_field(
49-
name=":alarm_clock: Uptime", value=await uptime_fetcher(), inline=True
46+
embed.description += f"\n**Prefix**: {self.prefix}"
47+
embed.description += (
48+
f"\n**Stars**: [{self.stars}](https://github.com/orangci/takina/stargazers)"
5049
)
50+
embed.description += f"\n**Uptime**: {await uptime_fetcher()}"
51+
BOT_VERSION_LINK = f"[{BOT_VERSION}](https://github.com/orangci/takina/blob/main/CHANGELOG.md#{BOT_VERSION.replace(".", "")})"
52+
embed.description += f"\n**Version**: {BOT_VERSION_LINK}"
53+
5154
orangc = await self.bot.fetch_user(961063229168164864)
5255
embed.set_author(
5356
name="orangc",

takina/cogs/sesp/isadev/subdomains.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def build_whois_embed(domain):
4343
embed = nextcord.Embed(color=ERROR_COLOR)
4444
embed.description = f":x: `{domain}.is-a.dev` has been reserved by our maintainers and cannot be registered."
4545
return embed
46-
46+
4747
if domain_data.get("internal"):
4848
embed = nextcord.Embed(color=ERROR_COLOR)
4949
embed.description = f":x: `{domain}.is-a.dev` is being used internally by our maintainers and cannot be registered."
@@ -111,7 +111,8 @@ async def fetch_staff_subdomains():
111111
non_reserved_domains = [
112112
entry["domain"][:-9]
113113
for entry in data
114-
if entry.get("owner", {}).get("username") == "is-a-dev" or entry.get("internal")
114+
if entry.get("owner", {}).get("username") == "is-a-dev"
115+
or entry.get("internal")
115116
and not entry.get("reserved")
116117
]
117118

@@ -320,7 +321,7 @@ async def build_check_embed(domain):
320321
icon_url="https://raw.githubusercontent.com/is-a-dev/register/refs/heads/main/media/logo.png",
321322
)
322323
return embed
323-
324+
324325
if domain_data.get("internal"):
325326
embed = nextcord.Embed(color=ERROR_COLOR)
326327
embed.description = f":x: Sorry, `{domain}.is-a.dev` is being used internally by our maintainers and cannot be registered."

takina/cogs/util/utils.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ async def member_count(self, ctx: commands.Context):
120120

121121
await ctx.reply(embed=embed, mention_author=False)
122122

123+
@commands.command(
124+
name="version",
125+
aliases=["v"],
126+
help=f"Fetch {BOT_NAME}'s current version.",
127+
)
128+
async def member_count(self, ctx: commands.Context):
129+
embed = nextcord.Embed(color=EMBED_COLOR)
130+
BOT_VERSION_LINK = f"[**{BOT_VERSION}**](https://github.com/orangci/takina/blob/main/CHANGELOG.md#{BOT_VERSION.replace(".", "")})"
131+
embed.description = f"{BOT_NAME} is currently on version {BOT_VERSION_LINK}."
132+
embed.set_footer(text="For more information, run the info command.")
133+
await ctx.reply(embed=embed, mention_author=False)
134+
123135

124136
class UtilsSlash(commands.Cog):
125137
def __init__(self, bot: commands.Bot) -> None:
@@ -230,6 +242,17 @@ async def slash_member_count(self, interaction: nextcord.Interaction):
230242

231243
await interaction.send(embed=embed, ephemeral=True)
232244

245+
@nextcord.slash_command(
246+
name="version",
247+
description=f"Fetch {BOT_NAME}'s current version.",
248+
)
249+
async def version(self, interaction: nextcord.Interaction):
250+
embed = nextcord.Embed(color=EMBED_COLOR)
251+
BOT_VERSION_LINK = f"[**{BOT_VERSION}**](https://github.com/orangci/takina/blob/main/CHANGELOG.md#{BOT_VERSION.replace(".", "")})"
252+
embed.description = f"{BOT_NAME} is currently on version {BOT_VERSION_LINK}."
253+
embed.set_footer(text="For more information, run the info command.")
254+
await interaction.send(embed=embed)
255+
233256

234257
def setup(bot: commands.Bot):
235258
bot.add_cog(Utils(bot))

takina/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
REDDIT_CLIENT_ID = getenv("REDDIT_CLIENT_ID")
1313
REDDIT_CLIENT_SECRET = getenv("REDDIT_CLIENT_SECRET")
1414
ERROR_COLOR = 0xFF0037
15+
BOT_VERSION = "1.5.0"
1516

1617
EMBED_COLOR_STR = getenv("EMBED_COLOR", "#2B2D31")
1718
if EMBED_COLOR_STR.startswith("#"):

0 commit comments

Comments
 (0)