2222SOFTWARE.
2323"""
2424
25- __version__ = '2.20.0 '
25+ __version__ = '2.20.1 '
2626
2727import asyncio
2828import logging
3232import typing
3333
3434from datetime import datetime
35- from pkg_resources import parse_version
3635from types import SimpleNamespace
3736
3837import discord
4544from colorama import init , Fore , Style
4645from emoji import UNICODE_EMOJI
4746from motor .motor_asyncio import AsyncIOMotorClient
47+ from pkg_resources import parse_version
4848
4949from core .changelog import Changelog
5050from core .clients import ApiClient , PluginDatabaseClient
@@ -240,7 +240,7 @@ def run(self, *args, **kwargs):
240240 async def is_owner (self , user : discord .User ) -> bool :
241241 raw = str (self .config .get ('owners' , '0' )).split (',' )
242242 allowed = {int (x ) for x in raw }
243- return (user .id in allowed ) or await super ().is_owner (user )
243+ return (user .id in allowed ) or await super ().is_owner (user )
244244
245245 @property
246246 def log_channel (self ) -> typing .Optional [discord .TextChannel ]:
@@ -518,8 +518,8 @@ async def process_modmail(self, message: discord.Message) -> None:
518518
519519 try :
520520 min_account_age = message .author .created_at + account_age
521- except ValueError as e :
522- logger .warning (e .args [0 ])
521+ except ValueError as exc :
522+ logger .warning (exc .args [0 ])
523523 del self .config .cache ['account_age' ]
524524 await self .config .update ()
525525 min_account_age = now
@@ -530,8 +530,8 @@ async def process_modmail(self, message: discord.Message) -> None:
530530 min_guild_age = member .joined_at + guild_age
531531 else :
532532 min_guild_age = now
533- except ValueError as e :
534- logger .warning (e .args [0 ])
533+ except ValueError as exc :
534+ logger .warning (exc .args [0 ])
535535 del self .config .cache ['guild_age' ]
536536 await self .config .update ()
537537 min_guild_age = now
@@ -641,11 +641,6 @@ async def get_context(self, message, *, cls=commands.Context):
641641 ctx .prefix = self .prefix # Sane prefix (No mentions)
642642 ctx .command = self .all_commands .get (invoker )
643643
644- has_ai = hasattr (ctx , '_alias_invoked' )
645- if ctx .command is self .get_command ('eval' ) and has_ai :
646- # ctx.command.checks = None # Let anyone use the command.
647- pass
648-
649644 return ctx
650645
651646 async def update_perms (self , name : typing .Union [PermissionLevel , str ],
@@ -691,7 +686,7 @@ async def on_message(self, message):
691686 if thread :
692687 snippet = snippet .format (recipient = thread .recipient )
693688 message .content = f'{ prefix } reply { snippet } '
694-
689+
695690 ctx = await self .get_context (message )
696691 if ctx .command :
697692 return await self .invoke (ctx )
@@ -853,29 +848,29 @@ async def on_error(self, event_method, *args, **kwargs):
853848 logger .error (error ('Ignoring exception in {}' .format (event_method )))
854849 logger .error (error ('Unexpected exception:' ), exc_info = sys .exc_info ())
855850
856- async def on_command_error (self , ctx , exception ):
851+ async def on_command_error (self , context , exception ):
857852 if isinstance (exception , commands .BadUnionArgument ):
858853 msg = 'Could not find the specified ' + human_join ([c .__name__ for c in exception .converters ])
859- await ctx .trigger_typing ()
860- await ctx .send (embed = discord .Embed (
861- color = discord .Color .red (),
854+ await context .trigger_typing ()
855+ await context .send (embed = discord .Embed (
856+ color = discord .Color .red (),
862857 description = msg
863858 ))
864859
865860 elif isinstance (exception , commands .BadArgument ):
866- await ctx .trigger_typing ()
867- await ctx .send (embed = discord .Embed (
868- color = discord .Color .red (),
861+ await context .trigger_typing ()
862+ await context .send (embed = discord .Embed (
863+ color = discord .Color .red (),
869864 description = str (exception )
870865 ))
871866 elif isinstance (exception , commands .CommandNotFound ):
872867 logger .warning (error ('CommandNotFound: ' + str (exception )))
873868 elif isinstance (exception , commands .MissingRequiredArgument ):
874- await ctx .send_help (ctx .command )
869+ await context .send_help (context .command )
875870 elif isinstance (exception , commands .CheckFailure ):
876- for check in ctx .command .checks :
877- if not await check (ctx ) and hasattr (check , 'fail_msg' ):
878- await ctx .send (embed = discord .Embed (
871+ for check in context .command .checks :
872+ if not await check (context ) and hasattr (check , 'fail_msg' ):
873+ await context .send (embed = discord .Embed (
879874 color = discord .Color .red (),
880875 description = check .fail_msg
881876 ))
0 commit comments