diff --git a/cfg.sample.toml b/cfg.sample.toml index 668aba9e..cef89016 100644 --- a/cfg.sample.toml +++ b/cfg.sample.toml @@ -10,6 +10,9 @@ access_token = "" app_client_id = "" app_client_secret = "" +# Priority values above max_priority will be refused. +max_priority = 9001 + [git] # Use the local Git command. Required to use some advanced features. It also diff --git a/homu/main.py b/homu/main.py index 556fa2e8..fb8727c4 100644 --- a/homu/main.py +++ b/homu/main.py @@ -517,10 +517,18 @@ def parse_commands(body, username, repo_cfg, state, my_username, db, states, realtime, my_username): continue try: - state.priority = int(word[len('p='):]) + pvalue = int(word[len('p='):]) except ValueError: - pass + continue + if pvalue > global_cfg['max_priority']: + if realtime: + state.add_comment( + ':stop_sign: Priority higher than @{} is ignored.' + .format(global_cfg['max_priority']) + ) + continue + state.priority = pvalue state.save() elif word.startswith('delegate='): diff --git a/setup.py b/setup.py index 82b8844b..1c3fbaba 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='homu', - version='0.2.0', + version='0.3.0', author='Barosl Lee', url='https://github.com/barosl/homu', description=('A bot that integrates with GitHub '