fixed sending input unsafe
This commit is contained in:
@@ -33,7 +33,6 @@ client = discord.Client()
|
|||||||
|
|
||||||
SENT = {}
|
SENT = {}
|
||||||
|
|
||||||
|
|
||||||
def debug(message, txt):
|
def debug(message, txt):
|
||||||
"""
|
"""
|
||||||
Print a log with the context of the current event
|
Print a log with the context of the current event
|
||||||
@@ -126,10 +125,16 @@ async def on_message(message):
|
|||||||
left_wmark_text = None
|
left_wmark_text = None
|
||||||
if len(args) > 1 and message.author.display_name is not None:
|
if len(args) > 1 and message.author.display_name is not None:
|
||||||
left_wmark_text = f"By {message.author.display_name}"
|
left_wmark_text = f"By {message.author.display_name}"
|
||||||
|
logging.info(args[0])
|
||||||
|
meme_id = re.sub(r'[^\w ]', "", args[0])
|
||||||
|
args[0] = meme_id
|
||||||
img = meme_otron.compute(*args, left_wmark_text=left_wmark_text)
|
img = meme_otron.compute(*args, left_wmark_text=left_wmark_text)
|
||||||
if img is None:
|
if img is None:
|
||||||
hint = db.find_nearest(args[0])
|
if len(meme_id) == 0:
|
||||||
response = f":warning: Template `{args[0]}` not found\n"
|
response = f":warning: Template not found\n"
|
||||||
|
else:
|
||||||
|
hint = db.find_nearest(meme_id)
|
||||||
|
response = f":warning: Template `{meme_id}` not found\n"
|
||||||
if hint is not None:
|
if hint is not None:
|
||||||
response += f"Did you mean `{hint}`?\n"
|
response += f"Did you mean `{hint}`?\n"
|
||||||
response += f"You can find a more detailed help and a list of templates at:\n" \
|
response += f"You can find a more detailed help and a list of templates at:\n" \
|
||||||
@@ -140,7 +145,7 @@ async def on_message(message):
|
|||||||
img.save(output, format="JPEG")
|
img.save(output, format="JPEG")
|
||||||
response = None
|
response = None
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
meme = db.get_meme(args[0])
|
meme = db.get_meme(meme_id)
|
||||||
response = f"Template `{meme.id}`:"
|
response = f"Template `{meme.id}`:"
|
||||||
if len(meme.aliases) > 0:
|
if len(meme.aliases) > 0:
|
||||||
response += f"\n- Aliases: `{'`, `'.join(meme.aliases)}`"
|
response += f"\n- Aliases: `{'`, `'.join(meme.aliases)}`"
|
||||||
|
|||||||
Reference in New Issue
Block a user