Skip to content

Commit

Permalink
Update to v2.0.4 #patch
Browse files Browse the repository at this point in the history
This release fixes up any remaining issues, and ensures that everything is up to date. For more info, please check out the chagnelog
  • Loading branch information
No767 authored Sep 11, 2023
2 parents 57bd7ac + 6d307d1 commit fe723a8
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 39 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ The modern all-in-one toolkit for LGBTQ+ folks
Catherine-Chan is the all in one tookit for LGBTQ+ folks and allies. Catherine-Chan provides a wide varity of features, such as creating pride profiles, definitions for the LGBTQ+ community, and many others.

> [!IMPORTANT]
> I would prefer if you do not run instances of Catherine-Chan. Just use the `>invite` command or use the Top.gg invite to have the bot on your server instead. The code provided is for educational use and for others to provide suggestions, catch issues, and feedback only.
> I would prefer if you do not run instances of Catherine-Chan. Just use the `/invite` command or use the Top.gg invite to have the bot on your server instead. The code provided is for educational use and for others to provide suggestions, catch issues, and feedback only.
## Features

- [x] Pronouns Tester
Expand All @@ -24,12 +25,11 @@ Catherine-Chan is the all in one tookit for LGBTQ+ folks and allies. Catherine-C
- [x] Resources for support
- [x] ToneTags support

And so much more! If you want to suggest a feature, please open up an feature requests report on GitHub!
And so much more! If you want to suggest a feature, please open up a feature requests report on GitHub!

## Inviting the Bot

Currently Catherine-Chan is still in development, but generally should be stable enough to run. Catherine is not fully production ready so there may be bugs that need to be ironed out.

Catherine-Chan is live! You can invite her into your server with the following link: [Invite Link](https://discord.com/oauth2/authorize?client_id=1142620675517984808&scope=bot+applications.commands)
## Support

If you would like to support me as a developer, please consider supporting me on [KoFi](https://ko-fi.com/no767). The money will go towards to hosting Catherine-Chan and all other server-related costs so you can expect the bot to be up 24/7!
Expand Down
4 changes: 3 additions & 1 deletion bot/catherinebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@

TOKEN = os.environ["TOKEN"]
DEV_MODE = os.getenv("DEV_MODE") in ("True", "TRUE")
ENABLE_MESSAGE_CONTENT = os.getenv("ENABLE_MESSAGE_CONTENT") in ("True", "TRUE")
IPC_SECRET_KEY = os.environ["IPC_SECRET_KEY"]
IPC_HOST = os.environ["IPC_HOST"]
POSTGRES_URI = os.environ["POSTGRES_URI"]


intents = discord.Intents.default()
intents.message_content = True
if DEV_MODE is True or ENABLE_MESSAGE_CONTENT is True:
intents.message_content = True


async def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion bot/cogs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ def __str__(self) -> str:


EXTENSIONS = [module.name for module in iter_modules(__path__, f"{__package__}.")]
VERSION: VersionInfo = VersionInfo(major=0, minor=2, micro=3, releaselevel="final")
VERSION: VersionInfo = VersionInfo(major=0, minor=2, micro=4, releaselevel="final")
71 changes: 58 additions & 13 deletions bot/cogs/meta.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
import datetime
import itertools
import platform

import discord
import psutil
import pygit2
from catherinecore import Catherine
from discord import app_commands
from discord.ext import commands
from discord.utils import oauth_url
from libs.utils import human_timedelta
from discord.utils import format_dt, oauth_url
from libs.utils import Embed, human_timedelta


class Meta(commands.Cog):
"""Commands for getting info about the bot"""

def __init__(self, bot: Catherine) -> None:
self.bot = bot
self.process = psutil.Process()

def get_bot_uptime(self, *, brief: bool = False) -> str:
return human_timedelta(
self.bot.uptime, accuracy=None, brief=brief, suffix=False
)

def format_commit(self, commit: pygit2.Commit) -> str:
short, _, _ = commit.message.partition("\n")
short_sha2 = commit.hex[0:6]
commit_tz = datetime.timezone(
datetime.timedelta(minutes=commit.commit_time_offset)
)
commit_time = datetime.datetime.fromtimestamp(commit.commit_time).astimezone(
commit_tz
)

# [`hash`](url) message (offset)
offset = format_dt(commit_time.astimezone(datetime.timezone.utc), "R")
return f"[`{short_sha2}`](https://github.com/No767/Catherine-Chan/commit/{commit.hex}) {short} ({offset})"

def get_last_commits(self, count: int = 5):
repo = pygit2.Repository(".git")
commits = list(
itertools.islice(
repo.walk(repo.head.target, pygit2.GIT_SORT_TOPOLOGICAL), count
)
)
return "\n".join(self.format_commit(c) for c in commits)

@app_commands.command(name="uptime")
async def uptime(self, interaction: discord.Interaction) -> None:
"""Displays the bot's uptime"""
Expand All @@ -31,23 +59,40 @@ async def version(self, interaction: discord.Interaction) -> None:
version_message = f"Version: {self.bot.version}"
await interaction.response.send_message(version_message)

@app_commands.command(name="info")
async def info(self, interaction: discord.Interaction) -> None:
@app_commands.command(name="about")
async def about(self, interaction: discord.Interaction) -> None:
"""Shows some basic info about Catherine-Chan"""
embed = discord.Embed()
embed.title = f"{self.bot.user.name} Info" # type: ignore
embed.set_thumbnail(url=self.bot.user.display_avatar.url) # type: ignore
embed.add_field(name="Server Count", value=len(self.bot.guilds), inline=True)
embed.add_field(name="User Count", value=len(self.bot.users), inline=True)
embed.add_field(
name="Python Version", value=platform.python_version(), inline=True
total_members = 0
total_unique = len(self.bot.users)

for guild in self.bot.guilds:
total_members += guild.member_count or 0

# For Kumiko, it's done differently
# R. Danny's way of doing it is probably clos enough anyways
memory_usage = self.process.memory_full_info().uss / 1024**2
cpu_usage = self.process.cpu_percent() / psutil.cpu_count()

revisions = self.get_last_commits()
embed = Embed()
embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.display_avatar.url) # type: ignore
embed.title = "Bot Invite"
embed.url = "https://discord.com/oauth2/authorize?client_id=1142620675517984808&scope=bot+applications.commands"
embed.description = f"Latest Changes (Stable):\n {revisions}"
embed.set_footer(
text=f"Made with discord.py v{discord.__version__}",
icon_url="https://cdn.discordapp.com/emojis/596577034537402378.png?size=128",
)
embed.add_field(name="Servers Count", value=len(self.bot.guilds))
embed.add_field(
name="Discord.py Version", value=discord.__version__, inline=True
name="User Count", value=f"{total_members} total\n{total_unique} unique"
)
embed.add_field(
name="Catherine Build Version", value=str(self.bot.version), inline=True
name="Process", value=f"{memory_usage:.2f} MiB\n{cpu_usage:.2f}% CPU"
)
embed.add_field(name="Python verson", value=platform.python_version())
embed.add_field(name="Catherine-Chan Version", value=str(self.bot.version))
embed.add_field(name="Uptime", value=self.get_bot_uptime(brief=True))
await interaction.response.send_message(embed=embed)

@app_commands.command(name="invite")
Expand Down
2 changes: 1 addition & 1 deletion bot/cogs/pronouns.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from libs.utils import Embed
from yarl import URL

APPROVAL_CHANNEL_ID = 1145189567331315803
APPROVAL_CHANNEL_ID = 1150575176006782976


class Pronouns(commands.GroupCog, name="pronouns"):
Expand Down
2 changes: 1 addition & 1 deletion bot/cogs/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def pride_servers(self, interaction: discord.Interaction) -> None:
Enby_eautiful - https://discord.gg/j8MCnEC64S
"""
embed.set_footer(
text="If you are enjoying Catherine-Chan, please consider to tell your friends about this bot! If you can't, then you can still show your support by upvoting on Top.gg! [insert topgg link]",
text="If you are enjoying Catherine-Chan, please consider to tell your friends about this bot! If you can't, then you can still show your support by upvoting on Top.gg!",
icon_url="https://cdn.discordapp.com/emojis/1096897624432443392.webp?size=128&quality=lossless",
)
await interaction.response.send_message(embed=embed)
Expand Down
12 changes: 7 additions & 5 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# 🛠️ Catherine-Chan 0.2.3 🛠️

Apparently forgetting to update the prod.txt requirements...
# 🛠️ Catherine-Chan 0.2.4 🛠️

Smaller bugfix update to fix any incosisentity
## ✨ TD;LR

- Updated prod.txt requirements
- Fixed small issues

## 🛠️ Changes

- Updated prod.txt requirements
- Renamed the `/info` command to `/about` and include more information
- Only allow `message_content` intents on development or if enabled
- Added invite links for the official bot
- Update docs as per usual

## ✨ Additions

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Features
* Pride Profile creator (create profiles to let others know about your pronouns and more)
* Full pronouns.page integration
* Resources for support
* ToneTags support

If there is a feature that you would like to see, please either suggest it within the `Discord Server <https://discord.gg/ns3e74frqn>`_ or preferably make a `feature request ticket <https://github.com/No767/Catherine-Chan/issues/>`_ on GitHub.

Expand Down
Loading

0 comments on commit fe723a8

Please sign in to comment.