Skip to content

Commit 00a5cbd

Browse files
committed
Merge
2 parents 395daa2 + 6c206cd commit 00a5cbd

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# v2.21.0
8+
9+
### Added
10+
11+
New `?plugin registry compact` command which shows a more compact view of all plugins.
12+
713
# v2.20.2
814

915
### Plugin Registry

bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = '2.20.2'
25+
__version__ = '2.21.0'
2626

2727
import asyncio
2828
import logging

cogs/modmail.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,18 @@ async def setup(self, ctx):
5252
)
5353

5454
embed = discord.Embed(
55-
title='Friendly Reminder:',
55+
title='Friendly Reminder',
5656
description=f'You may use the `{self.bot.prefix}config set log_channel_id '
5757
'<channel-id>` command to set up a custom log channel'
5858
', then you can delete the default '
5959
f'{log_channel.mention} channel.',
6060
color=self.bot.main_color
6161
)
6262

63+
embed.add_field(name='Thanks for using the bot!', value='If you like what you see, '
64+
'consider giving the [repo a star](https://github.com/kyb3r/modmail) :star: or if you are '
65+
'feeling generous, check us out on [Patreon](https://patreon.com/kyber)!')
66+
6367
embed.set_footer(text=f'Type "{self.bot.prefix}help" '
6468
'for a complete list of commands.')
6569
await log_channel.send(embed=embed)

cogs/plugins.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ async def plugin_enabled(self, ctx):
343343
)
344344
await ctx.send(embed=em)
345345

346-
@plugin.command(name='registry', aliases=['list'])
346+
@plugin.group(invoke_without_command=True, name='registry', aliases=['list'])
347347
@checks.has_permissions(PermissionLevel.OWNER)
348348
async def plugin_registry(self, ctx, *, plugin_name: str = None):
349349
"""Shows a list of all approved plugins."""
@@ -380,6 +380,7 @@ def find_index(name):
380380

381381
for name, info in registry:
382382
repo = f"https://github.com/{info['repository']}"
383+
url = f"{repo}/tree/master/{name}"
383384

384385
em = discord.Embed(
385386
color=self.bot.main_color,
@@ -392,16 +393,54 @@ def find_index(name):
392393
name='Installation',
393394
value=f'```{self.bot.prefix}plugins add {name}```')
394395

395-
em.set_author(name=info['title'], icon_url=info.get('icon_url'))
396+
em.set_author(name=info['title'], icon_url=info.get('icon_url'), url=url)
396397
if info.get('thumbnail_url'):
397398
em.set_thumbnail(url=info.get('thumbnail_url'))
399+
if info.get('image_url'):
400+
em.set_image(url=info.get('image_url'))
398401

399402
embeds.append(em)
400403

401404
paginator = PaginatorSession(ctx, *embeds)
402405
paginator.current = index
403406
await paginator.run()
404407

408+
@plugin_registry.command(name='compact')
409+
async def plugin_registry_compact(self, ctx):
410+
"""Shows a compact view of all plugins within the registry."""
411+
412+
await self.populate_registry()
413+
414+
registry = list(self.registry.items())
415+
registry.sort(key=lambda elem: elem[0])
416+
417+
pages = ['']
418+
419+
for name, info in registry:
420+
repo = f"https://github.com/{info['repository']}"
421+
url = f"{repo}/tree/master/{name}"
422+
desc = info['description'].replace('\n', '')
423+
fmt = f"[`{name}`]({url}) - {desc}"
424+
length = len(fmt) - len(url) - 4
425+
fmt = fmt[:75 + len(url)].strip() + '...' if length > 75 else fmt
426+
if len(fmt) + len(pages[-1]) >= 1024:
427+
pages.append(fmt+'\n')
428+
else:
429+
pages[-1] += fmt + '\n'
430+
431+
embeds = []
432+
433+
for page in pages:
434+
em = discord.Embed(
435+
color=self.bot.main_color,
436+
description=page,
437+
title='Plugin Registry (Compact View)',
438+
)
439+
embeds.append(em)
440+
441+
paginator = PaginatorSession(ctx, *embeds)
442+
await paginator.run()
443+
405444

406445
def setup(bot):
407446
bot.add_cog(Plugins(bot))

0 commit comments

Comments
 (0)