- Spellchecker for wrong commands

This commit is contained in:
Florian SYLVAIN
2021-03-11 20:33:38 +01:00
parent faf1e888d5
commit 7c5a6dbf14
3 changed files with 38 additions and 2 deletions
+5 -1
View File
@@ -2,6 +2,7 @@ from private import TOKEN_BOT
from time import time
from datetime import datetime
from discord.ext import commands
from miscellaneous import spellchecker
import discord
@@ -22,7 +23,10 @@ async def on_ready():
@bot.event
async def on_command_error(ctx, error):
print(datetime.now().strftime("[%H:%M:%S]") + ' \'' + str(error) + '\' from ' + str(ctx.author) + ' on ' + ctx.message.guild.name + '.')
await ctx.send(error)
if isinstance(error, commands.CommandNotFound):
await ctx.send(spellchecker(str(ctx.message.content)[1:]))
else:
await ctx.send(error)
@bot.command(hidden=True, ignore_extra=False)