mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 11:43:16 +02:00
🎨 - Massive code cleaning
This commit is contained in:
+9
-9
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user