aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-20 09:11:50 +0300
committerGravatar ks129 <[email protected]>2020-05-20 09:11:50 +0300
commitb3742b8050aff7edbaccfa9d1d95843f5bf201a0 (patch)
tree1ce7e7fab010150310c803c4fdea8413b6cd910c
parentSource: Create `build_embed` function that build embed of source item (diff)
Source: Create `source` command with alias `src`
-rw-r--r--bot/cogs/source.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/cogs/source.py b/bot/cogs/source.py
index bce51aa80..af29caaaa 100644
--- a/bot/cogs/source.py
+++ b/bot/cogs/source.py
@@ -3,7 +3,7 @@ import os
from typing import Union
from discord import Embed
-from discord.ext.commands import BadArgument, Cog, Command, Context, Converter, HelpCommand
+from discord.ext.commands import BadArgument, Cog, Command, Context, Converter, HelpCommand, group
from bot.bot import Bot
from bot.constants import URLs
@@ -48,6 +48,12 @@ class Source(Cog):
def __init__(self, bot: Bot):
self.bot = bot
+ @group(name='source', aliases=('src',), invoke_without_command=True)
+ async def source_command(self, ctx: Context, *, source_item: SourceConverter) -> None:
+ """Get GitHub link and information about help command, command or Cog."""
+ url = self.get_source_link(source_item)
+ await ctx.send(embed=await self.build_embed(url, source_item, ctx))
+
@staticmethod
def get_source_link(source_item: Union[HelpCommand, Command, Cog]) -> str:
"""Build GitHub link of source item."""