File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 8
8
import sys
9
9
import json
10
10
from pkg_resources import parse_version
11
+ from difflib import get_close_matches
11
12
import random
12
13
13
14
import discord
@@ -289,11 +290,15 @@ def find_index(name):
289
290
if plugin_name in self .registry :
290
291
index = find_index (plugin_name )
291
292
elif plugin_name is not None :
292
- return await ctx . send ( embed = discord .Embed (
293
+ em = discord .Embed (
293
294
color = discord .Color .red (),
294
295
description = f'Could not find a plugin with name "{ plugin_name } " within the registry.'
295
296
)
296
- )
297
+
298
+ matches = get_close_matches (plugin_name , self .registry .keys ())
299
+ if matches :
300
+ em .add_field (name = 'Perhaps you meant' , value = '\n ' .join (f'`{ m } `' for m in matches ))
301
+ return await ctx .send (embed = em )
297
302
298
303
for name , info in registry :
299
304
repo = f"https://github.com/{ info ['repository' ]} "
You can’t perform that action at this time.
0 commit comments