Provides a slash command to create polls in Mattermost
Provides a slash command to create polls in Mattermost.
By default, a poll will only offer the options Yes and No. However, users can also specify an arbitrary number of choices:
Choices are separated by --
.
--noprogress
: Do not display the number of votes until the poll is ended--public
: Show who voted for what at the end of the poll--votes=X
: Allows users to place a total of X votes. Default is 1. Each individual option can still only be voted once.--bars
: Show results as a bar chart at the end of the poll.--locale=X
: Use a specific locale for the poll. Supported values are en and de. By default it's the users language./poll help
will display full usage options. Only visible to you.
Set the "Autocomplete Hint" in the Slash Command settings to See "/poll help" for full usage options
Copy settings.py.example
to settings.py
and customise your settings.
Start the server:
gunicorn --workers 4 --bind :5000 app:app
settings.py
(requires server restart).config.json
to include "localhost" in the "AllowedUntrustedInternalConnections" setting, e.g. "AllowedUntrustedInternalConnections": "localhost"
To resolve usernames in --public
polls and to provide localization, the server needs access to the
Mattermost API. For this a personal access token must be provided in your settings.py
. Which user provides the token doesn't matter, e.g. you can create a dummy account. If no token is provided --public
polls will not be available and all texts will be english.
To integrate with mattermost-docker:
cd mattermost-docker
git submodule add [email protected]:M-Mueller/mattermost-poll.git poll
and add the following to the services
section:
poll:
build:
context: poll
args:
- mattermost_url="http://web"
- mattermost_tokens=['<mattermost-token-1>', '<mattermost-token-2>']
- mattermost_pa_token="<personal-access-token>"
ports:
- "5000:5000"
restart: unless-stopped
volumes:
- ./volumes/poll:/app/volume:rw
config.json
to include "poll" in the "AllowedUntrustedInternalConnections" setting, e.g. "AllowedUntrustedInternalConnections": "poll"