Limiit !to to 5 messages per user

This commit is contained in:
jesopo 2019-04-30 11:57:31 +01:00
parent 2d2ea2fc3a
commit 8a9fedb875

View file

@ -23,6 +23,10 @@ class Module(ModuleManager.BaseModule):
target_user = event["server"].get_user(event["args_split"][0]) target_user = event["server"].get_user(event["args_split"][0])
messages = event["target"].get_user_setting(target_user.get_id(), messages = event["target"].get_user_setting(target_user.get_id(),
"to", []) "to", [])
if len(messages) == 5:
raise utils.EventError("Users can only have 5 messages stored")
messages.append([event["user"].nickname, messages.append([event["user"].nickname,
" ".join(event["args_split"][1:]), " ".join(event["args_split"][1:]),
utils.iso8601_format_now()]) utils.iso8601_format_now()])