mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Handle correctly unpacking errors
This commit is contained in:
parent
652db5895c
commit
0d5605d1c9
1 changed files with 2 additions and 2 deletions
|
@ -468,7 +468,7 @@ def parse_timestring(timestring: str) -> typing.Union[datetime.timedelta, dateti
|
||||||
def cmd_newevent(bot: Bot, update: Update):
|
def cmd_newevent(bot: Bot, update: Update):
|
||||||
try:
|
try:
|
||||||
_, timestring, name_desc = update.message.text.split(" ", 2)
|
_, timestring, name_desc = update.message.text.split(" ", 2)
|
||||||
except (ValueError, IndexError):
|
except ValueError:
|
||||||
bot.send_message(update.message.chat.id, "⚠️ Sintassi del comando non valida.\n"
|
bot.send_message(update.message.chat.id, "⚠️ Sintassi del comando non valida.\n"
|
||||||
"Sintassi corretta:\n"
|
"Sintassi corretta:\n"
|
||||||
"```/newevent <timestamp|[[[anno-]mese-]giorno-]ore-minuti"
|
"```/newevent <timestamp|[[[anno-]mese-]giorno-]ore-minuti"
|
||||||
|
@ -477,7 +477,7 @@ def cmd_newevent(bot: Bot, update: Update):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
name, description = name_desc.split("\n", 1)
|
name, description = name_desc.split("\n", 1)
|
||||||
except IndexError:
|
except ValueError:
|
||||||
name = name_desc
|
name = name_desc
|
||||||
description = None
|
description = None
|
||||||
# Parse the timestring
|
# Parse the timestring
|
||||||
|
|
Loading…
Reference in a new issue