Added send_formatted_message function and cleaned up some help messages

master
Joey Hines 2019-05-15 08:14:50 -05:00
parent 3946d29c2a
commit 8a43f9b67e
2 changed files with 12 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import time
import traceback import traceback
import sys import sys
from GeoffreyBot.geoffrey_api import HandledError from GeoffreyBot.geoffrey_api import HandledError
from GeoffreyBot.GeoffreyApiHelper import format_message
logger = logging.getLogger('GeoffreyBot') logger = logging.getLogger('GeoffreyBot')
@ -135,6 +136,15 @@ class GeoffreyBot(commands.Bot):
return requests.get(url=url.format(command), params=kwargs).json() 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 @staticmethod
async def send_list(ctx, send_list): async def send_list(ctx, send_list):
msg = "" msg = ""

View File

@ -199,7 +199,7 @@ class GeoffreyCommands(commands.Cog):
@commands.command(pass_context=True) @commands.command(pass_context=True)
async def add_resident(self, ctx, new_resident_name, *args): async def add_resident(self, ctx, new_resident_name, *args):
""" """
{}add_resident <New Residents's Name> <Town Name> {}add_resident <New Residents's MC Username> <Town Name>
""" """
errors = { errors = {
"ResidentNotFoundError": "ain't no one in this darn database named **{}** you goob".format( "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) @commands.command(pass_context=True)
async def add_tunnel(self, ctx, tunnel_direction, tunnel_number: int, *args): async def add_tunnel(self, ctx, tunnel_direction, tunnel_number: int, *args):
""" """
{}add_tunnel <Tunnel Direction> <X/Z Tunnel Number> <Location Name> {}add_tunnel <Tunnel Direction> <X or Z Tunnel Number> <Location Name>
The Name parameter is optional if you only have one location The Name parameter is optional if you only have one location
""" """