Skip to content

Commit

Permalink
Handle id to del being empty on quote del
Browse files Browse the repository at this point in the history
  • Loading branch information
iranzo committed Jul 5, 2017
1 parent c7f825f commit 9727602
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions stampy/plugin/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,17 @@ def quotecommands(message):
break
if case('del'):
if stampy.stampy.is_owner_or_admin(message):
id_todel = texto.split(' ')[2]
text = _("Deleting quote id `%s`") % id_todel
stampy.stampy.sendmessage(chat_id=chat_id, text=text,
reply_to_message_id=message_id,
disable_web_page_preview=True,
parse_mode="Markdown")
deletequote(id=id_todel, gid=stampy.stampy.geteffectivegid(gid=chat_id))
try:
id_todel = texto.split(' ')[2]
except:
id_todel = False
if id_todel:
text = _("Deleting quote id `%s`") % id_todel
stampy.stampy.sendmessage(chat_id=chat_id, text=text,
reply_to_message_id=message_id,
disable_web_page_preview=True,
parse_mode="Markdown")
deletequote(id=id_todel, gid=stampy.stampy.geteffectivegid(gid=chat_id))
break
if case():
# We're just given the nick (or not), so find quote for it
Expand Down

0 comments on commit 9727602

Please sign in to comment.