Merge pull request #4 from paris-ci/patch-2

Todo
This commit is contained in:
Maël 2017-06-13 18:07:04 -04:00 committed by GitHub
commit 0df42672ae

View file

@ -1,10 +1,8 @@
from discord.ext import commands from discord.ext import commands
from random import choice, shuffle
import aiohttp import aiohttp
import asyncio import asyncio
import time import time
import discord import discord
import platform
from .utils import checks from .utils import checks
class Admin: class Admin:
@ -33,7 +31,7 @@ class Admin:
self.bot.unload_extension(module) self.bot.unload_extension(module)
self.bot.load_extension(module) self.bot.load_extension(module)
await self.bot.say("Nice !") await self.bot.say("Nice !")
except Exception as e: except Exception as e: #TODO : A virer dans l'event on_error
await self.bot.say(':( Erreur :') await self.bot.say(':( Erreur :')
await self.bot.say('{}: {}'.format(type(e).__name__, e)) await self.bot.say('{}: {}'.format(type(e).__name__, e))
else: else:
@ -46,17 +44,16 @@ class Admin:
number = number + 1 number = number + 1
await self.bot.purge_from(ctx.message.channel, limit=number) await self.bot.purge_from(ctx.message.channel, limit=number)
await self.bot.say("Hello World !") await self.bot.say("Hello World !")
except Exception as e: except Exception as e: #TODO : A virer dans l'event on_error
await self.bot.say(':sob: Une erreur est survenue : \n {}: {}'.format(type(e).__name__, e)) await self.bot.say(':sob: Une erreur est survenue : \n {}: {}'.format(type(e).__name__, e))
@checks.is_owner() @checks.is_owner()
@commands.command(name='say', pass_context=True, hidden=True) @commands.command(name='say', pass_context=True, hidden=True)
async def _say(self, ctx, dire): async def _say(self, ctx, *dire:str):
try: try:
arg = ctx.message.content.split("say ") await self.bot.say(dire)
await self.bot.say(arg[1])
await self.bot.delete_message(ctx.message) await self.bot.delete_message(ctx.message)
except Exception as e: except Exception as e: #TODO : A virer dans l'event on_error
await self.bot.say(':sob: Une erreur est survenue : \n {}: {}'.format(type(e).__name__, e)) await self.bot.say(':sob: Une erreur est survenue : \n {}: {}'.format(type(e).__name__, e))
@checks.is_owner() @checks.is_owner()