Skip to content

Commit 6c206cd

Browse files
authored
Updating bot
2 parents 5c1280b + 04df6ea commit 6c206cd

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-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: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async def plugin_enabled(self, ctx):
269269
else:
270270
await ctx.send('No plugins installed.')
271271

272-
@plugin.command(name='registry', aliases=['list'])
272+
@plugin.group(invoke_without_command=True, name='registry', aliases=['list'])
273273
@checks.has_permissions(PermissionLevel.OWNER)
274274
async def plugin_registry(self, ctx, *, plugin_name:str=None):
275275
"""Shows a list of all approved plugins."""
@@ -304,6 +304,7 @@ def find_index(name):
304304

305305
for name, info in registry:
306306
repo = f"https://github.com/{info['repository']}"
307+
url = f"{repo}/tree/master/{name}"
307308

308309
em = discord.Embed(
309310
color=self.bot.main_color,
@@ -316,16 +317,57 @@ def find_index(name):
316317
name='Installation',
317318
value=f'```{self.bot.prefix}plugins add {name}```')
318319

319-
em.set_author(name=info['title'], icon_url=info.get('icon_url'))
320+
em.set_author(name=info['title'], icon_url=info.get('icon_url'), url=url)
320321
if info.get('thumbnail_url'):
321322
em.set_thumbnail(url=info.get('thumbnail_url'))
323+
if info.get('image_url'):
324+
em.set_image(url=info.get('image_url'))
322325

323326
embeds.append(em)
324327

325328
paginator = PaginatorSession(ctx, *embeds)
326329
paginator.current = index
327330
await paginator.run()
328331

332+
@plugin_registry.command(name='compact')
333+
async def plugin_registry_compact(self, ctx):
334+
"""Shows a compact view of all plugins within the registry."""
335+
336+
await self.populate_registry()
337+
338+
registry = list(self.registry.items())
339+
registry.sort(key=lambda elem: elem[0])
340+
341+
pages = ['']
342+
343+
for name, info in registry:
344+
repo = f"https://github.com/{info['repository']}"
345+
url = f"{repo}/tree/master/{name}"
346+
desc = info['description'].replace('\n', '')
347+
fmt = f"[`{name}`]({url}) - {desc}"
348+
length = len(fmt) - len(url) - 4
349+
fmt = fmt[:75 + len(url)].strip() + '...' if length > 75 else fmt
350+
if len(fmt) + len(pages[-1]) >= 1024:
351+
pages.append(fmt+'\n')
352+
else:
353+
pages[-1] += fmt + '\n'
354+
355+
embeds = []
356+
357+
for page in pages:
358+
em = discord.Embed(
359+
color=self.bot.main_color,
360+
description=page,
361+
title='Plugin Registry (Compact View)',
362+
)
363+
embeds.append(em)
364+
365+
paginator = PaginatorSession(ctx, *embeds)
366+
await paginator.run()
367+
368+
369+
370+
329371

330372

331373
def setup(bot):

0 commit comments

Comments
 (0)