feat(seautils): added the cog
This commit is contained in:
parent
09ab8aa69d
commit
7bd9531b58
3 changed files with 59 additions and 0 deletions
5
seautils/__init__.py
Normal file
5
seautils/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from .seautils import SeaUtils
|
||||||
|
|
||||||
|
|
||||||
|
async def setup(bot):
|
||||||
|
await bot.add_cog(SeaUtils(bot))
|
12
seautils/info.json
Normal file
12
seautils/info.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"author" : ["SeaswimmerTheFsh (seasw.)"],
|
||||||
|
"install_msg" : "Thank you for installing SeaUtils!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
|
||||||
|
"name" : "SeaUtils",
|
||||||
|
"short" : "A collection of useful utilities.",
|
||||||
|
"description" : "A collection of useful utilities.",
|
||||||
|
"end_user_data_statement" : "This cog does not store end user data.",
|
||||||
|
"hidden": true,
|
||||||
|
"disabled": false,
|
||||||
|
"min_bot_version": "3.5.0",
|
||||||
|
"min_python_version": [3, 8, 0]
|
||||||
|
}
|
42
seautils/seautils.py
Normal file
42
seautils/seautils.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# _____ _
|
||||||
|
# / ____| (_)
|
||||||
|
# | (___ ___ __ _ _____ ___ _ __ ___ _ __ ___ ___ _ __
|
||||||
|
# \___ \ / _ \/ _` / __\ \ /\ / / | '_ ` _ \| '_ ` _ \ / _ \ '__|
|
||||||
|
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
|
||||||
|
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
|
||||||
|
|
||||||
|
import inspect
|
||||||
|
|
||||||
|
from redbot.core import commands
|
||||||
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.utils import chat_formatting as cf
|
||||||
|
|
||||||
|
|
||||||
|
class SeaUtils(commands.Cog):
|
||||||
|
"""A collection of random utilities."""
|
||||||
|
|
||||||
|
__author__ = ["SeaswimmerTheFsh"]
|
||||||
|
__version__ = "1.0.0"
|
||||||
|
|
||||||
|
def __init__(self, bot: Red):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
def format_help_for_context(self, ctx: commands.Context) -> str:
|
||||||
|
pre_processed = super().format_help_for_context(ctx) or ""
|
||||||
|
n = "\n" if "\n\n" not in pre_processed else ""
|
||||||
|
text = [
|
||||||
|
f"{pre_processed}{n}",
|
||||||
|
f"Cog Version: **{self.__version__}**",
|
||||||
|
f"Author: {cf.humanize_list(self.__author__)}"
|
||||||
|
]
|
||||||
|
return "\n".join(text)
|
||||||
|
|
||||||
|
@commands.command(aliases=["source"])
|
||||||
|
@commands.is_owner()
|
||||||
|
async def showcode(self, ctx: commands.Context, *, command: str):
|
||||||
|
"""Show the code for a particular command."""
|
||||||
|
try:
|
||||||
|
content = cf.pagify(inspect.getsource(self.bot.get_command(command).callback))
|
||||||
|
await ctx.send_interactive(content, box_lang='py')
|
||||||
|
except OSError:
|
||||||
|
await ctx.send("Command not found.")
|
Loading…
Reference in a new issue