diff --git a/bot.py b/bot.py index 8a847de..1e140d2 100644 --- a/bot.py +++ b/bot.py @@ -47,7 +47,7 @@ class MinearchyBot(commands.Bot): brief="Sends help.", help="Sends all the commands of the bot, or help of a specific command and module.", ), - ) + ) async def on_ready(self) -> None: self.up_ts = time.time() @@ -70,8 +70,8 @@ class MinearchyBot(commands.Bot): async with self, aiohttp.ClientSession() as session: self.session = session self.log_webhook = discord.Webhook.from_url( - self.webhook_url, session=self.session, bot_token=self.token - ) + self.webhook_url, session=self.session, bot_token=self.token + ) await self.load_extensions() await self.start(self.token, reconnect=True) diff --git a/cogs/mc_server.py b/cogs/mc_server.py index 0c2a05b..f40c94e 100644 --- a/cogs/mc_server.py +++ b/cogs/mc_server.py @@ -1,3 +1,4 @@ + from __future__ import annotations from typing import TYPE_CHECKING @@ -26,14 +27,17 @@ class MinecraftServer( f"Java edition IP: `{self.bot.mc_server.ip}`\nBedrock edition IP: `{self.bot.mc_server.bedrock_ip}`" ) - @ip.command(brief="Sends the Java edition IP.", help="Sends the Java edition IP.") + @ip.command( + brief="Sends the Java edition IP.", help="Sends the Java edition IP." + ) async def java(self, ctx: commands.Context, /) -> None: await ctx.reply( f"The IP to connect on Minecraft Java edition is `{self.bot.mc_server.ip}`" ) @ip.command( - brief="Sends the Bedrock edition IP.", help="Sends the Bedrock edition IP." + brief="Sends the Bedrock edition IP.", + help="Sends the Bedrock edition IP.", ) async def bedrock(self, ctx: commands.Context, /) -> None: await ctx.reply( @@ -59,19 +63,22 @@ class MinecraftServer( view = discord.ui.View() view.add_item( discord.ui.Button( - label="Go to the wiki!", url="https://www.landsofminearchy.com/wiki" + label="Go to the wiki!", + url="https://www.landsofminearchy.com/wiki", ) ) await ctx.reply(view=view) @commands.command( - brief="Sends the link to the store.", help="Sends the link to the store." + brief="Sends the link to the store.", + help="Sends the link to the store.", ) async def store(self, ctx: commands.Context, /) -> None: view = discord.ui.View() view.add_item( discord.ui.Button( - label="Go to the store!", url="https://www.landsofminearchy.com/store" + label="Go to the store!", + url="https://www.landsofminearchy.com/store", ) ) await ctx.reply(view=view) diff --git a/cogs/misc.py b/cogs/misc.py index 9140551..7df63b5 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -51,8 +51,18 @@ class Miscellanious( @commands.command(brief="Hello!", help="Hello!") async def hello(self, ctx: commands.Context, /) -> None: - await ctx.reply(f"Hi {es_md(ctx.author.name)}, yes the bot is running :)") + await ctx.reply( + f"Hi {es_md(ctx.author.name)}, yes the bot is running :)" + ) + @commands.command( + aliases=["server_count", "server-count"], + brief="Sends how many servers the bot is in.", + help="Sends how many servers the bot is in.", + ) + async def count(self, ctx: commands.Context, /) -> None: + await ctx.reply(f"Currently in `{len(self.bot.guilds)}` servers.") + @commands.Cog.listener() async def on_message_delete(self, message: discord.Message, /) -> None: if not message.guild: @@ -76,9 +86,11 @@ class Miscellanious( self, ctx: commands.Context, channel: discord.TextChannel = None, / ) -> None: if channel is None: - channel = ( - ctx.channel - ) # i am not checking if the channel is in the current server, since this bot is for a private server + channel = ctx.channel + + if not any(channel.id == ch.id for ch in ctx.guild.chanels): + await ctx.reply("Invalid channel.") + return logs = self.sniped[channel.id]