From 305c32958e0adac756b77c0ed22931217163b38b Mon Sep 17 00:00:00 2001 From: CryptoLover705 <50221455+CryptoLover705@users.noreply.github.com> Date: Mon, 16 Oct 2023 02:53:45 +0100 Subject: [PATCH 1/2] Update infochannel.py Added additional stats See screenshots below for all the ones I have added https://prnt.sc/fGwyPrHUoqM2 --- infochannel/infochannel.py | 53 +++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/infochannel/infochannel.py b/infochannel/infochannel.py index 938526f2..b0bf4e33 100644 --- a/infochannel/infochannel.py +++ b/infochannel/infochannel.py @@ -13,7 +13,6 @@ log = logging.getLogger("red.fox_v3.infochannel") - async def get_channel_counts(category, guild): # Gets count of bots bot_num = len([m for m in guild.members if m.bot]) @@ -30,6 +29,13 @@ async def get_channel_counts(category, guild): human_num = members - bot_num # count amount of premium subs/nitro subs. boosters = guild.premium_subscription_count + # New additions + emojis_count = len(guild.emojis) + news_channels_count = len([c for c in guild.channels if isinstance(c, discord.TextChannel) and c.is_news()]) + stage_channels_count = len([c for c in guild.channels if isinstance(c, discord.StageChannel)]) + voice_channels_count = len([c for c in guild.channels if isinstance(c, discord.VoiceChannel)]) + server_boost_tier = guild.premium_tier + timezones = guild.preferred_locale return { "members": members, "humans": human_num, @@ -39,9 +45,14 @@ async def get_channel_counts(category, guild): "channels": channels_num, "online": online_num, "offline": offline_num, + "emojis": emojis_count, + "news_channels": news_channels_count, + "stage_channels": stage_channels_count, + "voice_channels": voice_channels_count, + "server_boost_tier": server_boost_tier, + "timezones": timezones, } - class InfoChannel(Cog): """ Create a channel with updating server info @@ -59,19 +70,25 @@ def __init__(self, bot: Red): # self. so I can get the keys from this later self.default_channel_names = { - "members": "Members: {count}", - "humans": "Humans: {count}", - "boosters": "Boosters: {count}", - "bots": "Bots: {count}", - "roles": "Roles: {count}", - "channels": "Channels: {count}", + "members": "👤 Members: {count}", + "humans": "👤 Humans: {count}", + "boosters": "💎 Boosters: {count}", + "bots": "🤖 Bots: {count}", + "roles": "👔 Roles: {count}", + "channels": "🔧 Channels: {count}", "online": "Online: {count}", "offline": "Offline: {count}", + "emojis": "🥳 Emojis: {count}", + "news_channels": "📰 News Channels: {count}", + "stage_channels": "🎤 Stage Channels: {count}", + "voice_channels": "🔊 Voice Channels: {count}", + "server_boost_tier": "🥇 Server Boost Tier: {count}", + "timezones": "⏰ Timezone: {count}", } default_channel_ids = {k: None for k in self.default_channel_names} # Only members is enabled by default - default_enabled_counts = {k: k == "members" for k in self.default_channel_names} + default_enabled_counts = {k: k in ["members", "emojis", "news_channels", "stage_channels", "voice_channels", "server_boost_tier", "timezones"] for k in self.default_channel_names} default_guild = { "category_id": None, @@ -184,6 +201,12 @@ async def _infochannelset_togglechannel( - `channels`: Total number of channels excluding infochannels, - `online`: Total online members, - `offline`: Total offline members, + - `emojis`: Total amount of emojis + - `news_channels`: Total amount of news channels + - `stage_channels`: Total number of stage channels + - `voice_channels`: Total number of voice channels, + - `server_boost_tier`: Server boost tier, + - `timezones`: Timezones, """ guild = ctx.guild if channel_type not in self.default_channel_names.keys(): @@ -239,6 +262,12 @@ async def _infochannelset_name(self, ctx: commands.Context, channel_type: str, * - `channels`: Total number of channels excluding infochannels - `online`: Total online members - `offline`: Total offline members + - `emojis`: Total amount of emojis + - `news_channels`: Total amount of news channels + - `stage_channels`: Total number of stage channels + - `voice_channels`: Total number of voice channels, + - `server_boost_tier`: Server boost tier, + - `timezones`: Timezones, Warning: This command counts against the channel update rate limit and may be queued. """ @@ -457,6 +486,12 @@ async def update_infochannel(self, guild: discord.Guild, channel_type=None, chan channels=True, online=True, offline=True, + emojis=True, + news_channels=True, + stage_channels=True, + voice_channels=True, + server_boost_tier=True, + timezones=True, extra_roles=set(guild.roles), ) From f739af8b24cacb3d74ddb361b41c6f9c4122ce56 Mon Sep 17 00:00:00 2001 From: CryptoLover705 <50221455+CryptoLover705@users.noreply.github.com> Date: Sun, 29 Oct 2023 14:17:26 +0000 Subject: [PATCH 2/2] Made it so it actually gives a clickable link --- firstmessage/firstmessage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firstmessage/firstmessage.py b/firstmessage/firstmessage.py index 9017f616..3b9641a1 100644 --- a/firstmessage/firstmessage.py +++ b/firstmessage/firstmessage.py @@ -44,7 +44,7 @@ async def firstmessage(self, ctx: commands.Context, channel: discord.TextChannel await ctx.maybe_send_embed("Unable to read message history for that channel") return - em = discord.Embed(description=f"[First Message in {channel.mention}]({message.jump_url})") + em = discord.Embed(description=f"Jump to the [First Message]({message.jump_url}) in {channel.mention}") em.set_author(name=message.author.display_name, icon_url=message.author.avatar.url) await ctx.send(embed=em)