diff options
| author | 2019-06-20 12:08:35 +0100 | |
|---|---|---|
| committer | 2019-06-20 12:08:35 +0100 | |
| commit | 20df824f723334005d930ee9cd5d4f51d16f2d8e (patch) | |
| tree | 50d27c46d74cc5ba821382709376866a55f97616 /modules | |
| parent | Set ignore.py --depends-on hashflags (diff) | |
| signature | ||
Make it configurable whether people need permission to start a vote
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/vote.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/vote.py b/modules/vote.py index 6a90e157..c80890a9 100644 --- a/modules/vote.py +++ b/modules/vote.py @@ -10,7 +10,9 @@ STR_NOVOTE = "Unknown vote '%s'" class VoteCastResult(enum.Enum): Cast = 1 Changed = 2 - +@utils.export("channelset", {"setting": "vote-start-restricted", + "help": "Whether starting a vote should be restricted to ops", + "validate": utils.bool_or_none, "example": "on"}) class Module(ModuleManager.BaseModule): def _get_vote(self, channel, vote_id): return channel.get_setting("vote-%s" % vote_id, None) @@ -72,9 +74,12 @@ class Module(ModuleManager.BaseModule): """ :help: Start a vote :usage: <description> - :require_mode: o - :permission: vote """ + + if event["target"].get_setting("vote-start-restricted", True): + event["check_assert"](utils.Check("channel-mode", "o")| + utils.Check("permission", "vote")) + vote = self._start_vote(event["target"], event["args"]) event["stdout"].write( "Vote %s started. use '%svote <option>' to vote (options: %s)" % |
