From 8a43f9b67e82b132529b44e57116aae668932532 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Wed, 15 May 2019 08:14:50 -0500 Subject: [PATCH] Added send_formatted_message function and cleaned up some help messages --- GeoffreyBot/geoffrey.py | 10 ++++++++++ GeoffreyBot/geoffrey_api.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/GeoffreyBot/geoffrey.py b/GeoffreyBot/geoffrey.py index 2f91c57..5d6c88c 100644 --- a/GeoffreyBot/geoffrey.py +++ b/GeoffreyBot/geoffrey.py @@ -8,6 +8,7 @@ import time import traceback import sys from GeoffreyBot.geoffrey_api import HandledError +from GeoffreyBot.GeoffreyApiHelper import format_message logger = logging.getLogger('GeoffreyBot') @@ -135,6 +136,15 @@ class GeoffreyBot(commands.Bot): return requests.get(url=url.format(command), params=kwargs).json() + @staticmethod + async def send_formatted_message(ctx, msg_format, *args, ping_user=False): + if ping_user: + msg_format = "%s %s" % (ctx.message.author, msg_format) + + msg = format_message(msg_format, *args) + + ctx.send(msg) + @staticmethod async def send_list(ctx, send_list): msg = "" diff --git a/GeoffreyBot/geoffrey_api.py b/GeoffreyBot/geoffrey_api.py index 92cd948..67c01fb 100644 --- a/GeoffreyBot/geoffrey_api.py +++ b/GeoffreyBot/geoffrey_api.py @@ -199,7 +199,7 @@ class GeoffreyCommands(commands.Cog): @commands.command(pass_context=True) async def add_resident(self, ctx, new_resident_name, *args): """ - {}add_resident + {}add_resident """ errors = { "ResidentNotFoundError": "ain't no one in this darn database named **{}** you goob".format( @@ -281,7 +281,7 @@ class GeoffreyCommands(commands.Cog): @commands.command(pass_context=True) async def add_tunnel(self, ctx, tunnel_direction, tunnel_number: int, *args): """ - {}add_tunnel + {}add_tunnel The Name parameter is optional if you only have one location """