From a13e1c9af255b6c67dd33fe13898473c15e7dbcc Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 22 Jul 2018 19:01:49 -0500 Subject: [PATCH] Fixed issue in sending error messages. --- Commands.py | 6 ------ Geoffrey.py | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Commands.py b/Commands.py index 649a699..c26baf9 100644 --- a/Commands.py +++ b/Commands.py @@ -44,9 +44,6 @@ class Commands: base = self.interface.add_base(session, player, base_name, x_pos, z_pos) base_name = base.name - except EntryNameNotUniqueError: - session.rollback() - raise EntryNameNotUniqueError finally: session.close() @@ -81,9 +78,6 @@ class Commands: tunnel = self.interface.add_tunnel(session, player, tunnel_color, tunnel_number, location_name) tunnel_info = tunnel.__str__() - except EntryNameNotUniqueError: - session.rollback() - raise EntryNameNotUniqueError finally: session.close() diff --git a/Geoffrey.py b/Geoffrey.py index 3030256..caa9348 100644 --- a/Geoffrey.py +++ b/Geoffrey.py @@ -44,11 +44,12 @@ async def on_command_error(error, ctx): elif isinstance(error.original, EntryNameNotUniqueError): error_str = 'An entry in the database already has that name ding dong.' elif isinstance(error.original, DatabaseValueError): - error_str = 'Use a shorter name or a smaller value, dong ding.' + error_str = 'Use a shorter name or a smaller value, dong ding.' else: error_str = bad_error_message.format(ctx.invoked_with, error) - bot.send_message(ctx.message.channel, '**Error Running Command:** {}'.format(error_str)) + await bot.send_message(ctx.message.channel, '{} **Error Running Command:** {}'.format(ctx.message.author.mention, + error_str)) @bot.command()