🎨 - Massive code cleaning

This commit is contained in:
Florian Sylvain
2021-04-01 23:15:43 +02:00
parent 37115cb362
commit 53ccad4f1e
9 changed files with 102 additions and 100 deletions
+9 -9
View File
@@ -1,11 +1,10 @@
from private import TOKEN_BOT
from time import time
from datetime import datetime
import logging
import discord
from discord.ext import commands
from miscellaneous import spellchecker
import logging
import os, sys
import discord
from private import TOKEN_BOT
print('Loading started')
@@ -25,19 +24,20 @@ logger.setLevel(logging.INFO)
commandlist = []
@bot.event
async def on_ready():
default_activity = discord.Activity(type=discord.ActivityType.listening, name='$help')
await bot.change_presence(activity=default_activity)
print('Logged in as ' + str(bot.user) +
' in ' + str(round(time() - time_s, 2)) + 's.')
' in ' + str(round(time() - time_s, 2)) + 's.')
@bot.event
async def on_command_error(ctx, error):
logger.info(datetime.now().strftime("[%d-%m-%y][%H:%M:%S]") +
' \'' + str(error) + '\' from ' +str(ctx.author) + ' on ' +
(ctx.message.guild.name if ctx.message.guild is not None else 'DMs') + '.')
' \'' + str(error) + '\' from ' + str(ctx.author) + ' on ' +
(ctx.message.guild.name if ctx.message.guild is not None else 'DMs') + '.')
if isinstance(error, commands.CommandNotFound):
await ctx.send(spellchecker(str(ctx.message.content)[1:], commandlist))
else:
@@ -48,10 +48,10 @@ def init():
for extension in startup_extensions:
bot.load_extension('ext.' + extension)
print('Extension "' + str(extension) + '" loaded.')
ignore = list(map(lambda cmd : cmd.name, bot.cogs["Owner commands"].get_commands()))
ignore = list(map(lambda cmd: cmd.name, bot.cogs["Owner commands"].get_commands()))
for command in bot.commands:
name = command.name
if not name in ignore:
if name not in ignore:
commandlist.append(name)