File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -268,14 +268,32 @@ async def plugin_enabled(self, ctx):
268
268
269
269
@plugin .command (name = 'registry' , aliases = ['list' ])
270
270
@checks .has_permissions (PermissionLevel .OWNER )
271
- async def plugin_registry (self , ctx ):
271
+ async def plugin_registry (self , ctx , plugin_name = None ):
272
272
"""Shows a list of all approved plugins."""
273
273
274
274
embeds = []
275
275
276
+
277
+
276
278
registry = list (self .registry .items ())
277
279
random .shuffle (registry )
278
280
281
+ def find_index (name ):
282
+ index = 0
283
+ for n , info in registry :
284
+ if name == n :
285
+ return index
286
+ index += 1
287
+
288
+ if plugin_name and plugin_name in self .registry :
289
+ index = find_index (plugin_name )
290
+ else :
291
+ return await ctx .send (embed = discord .Embed (
292
+ color = discord .Color .red (),
293
+ description = f'Could not find a plugin with name "{ plugin_name } " within the registry.'
294
+ )
295
+ )
296
+
279
297
for name , info in registry :
280
298
repo = f"https://github.com/{ info ['repository' ]} "
281
299
@@ -297,11 +315,10 @@ async def plugin_registry(self, ctx):
297
315
embeds .append (em )
298
316
299
317
paginator = PaginatorSession (ctx , * embeds )
318
+ paginator .current = index
300
319
await paginator .run ()
301
320
302
321
303
322
304
-
305
-
306
323
def setup (bot ):
307
324
bot .add_cog (Plugins (bot ))
You can’t perform that action at this time.
0 commit comments