add core cog

This commit is contained in:
mudkipdev
2023-05-07 15:58:01 -06:00
parent d2f0f3230c
commit 9177d67f79
2 changed files with 29 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import subprocess
from discord.ext import commands
import discord
from utils import Config
@@ -20,3 +21,29 @@ class Bot(commands.Bot):
async def setup_hook(self) -> None:
for extension in self.config.extensions:
await self.load_extension(extension)
await self.add_cog(CoreCog(self))
class CoreCog(commands.Cog, name="Core"):
def __init__(self, bot: Bot) -> None:
self.bot = bot
def _get_version(self) -> str:
return (
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
.decode("ascii")
.strip()
)
@commands.hybrid_command(description="Shows you some info about the bot.")
async def info(self, ctx: commands.Context) -> None:
embed = discord.Embed(
color=self.bot.config.embed_color,
description="SCNewsBot is a Discord bot created for the r/starcitizen\n Discord server to help with writing news posts.",
)
embed.add_field(name="Version", value=f"v0.0.0+{self._get_version()}")
embed.add_field(
name="Library", value=f"discord.py v{discord.__version__}", inline=False
)
await ctx.reply(embed=embed)

View File

@@ -308,7 +308,7 @@ class AnnouncementBuilderView(discord.ui.View):
"You cannot use this menu.", ephemeral=True
)
return
self.announcement_builder.announcement.is_private = (
not self.announcement_builder.announcement.is_private
)
@@ -330,7 +330,7 @@ class AnnouncementBuilderView(discord.ui.View):
"You cannot use this menu.", ephemeral=True
)
return
self.announcement_builder.announcement.will_notify = (
not self.announcement_builder.announcement.will_notify
)