diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b491a90 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.egg-info +.tox +.idea +__pycache__ +.coverage +.coverage.* +htmlcov +*.pyc +docs/_build +venv +dist +.pytest_cache +.mypy_cache +build \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index ee6587b..fd5a7e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ CHANGES ======= +v1.0.1 +------ + * remote the pinning of aprsd 1.0.0 v1.0 diff --git a/aprsd_slack_plugin/aprsd_slack_plugin.py b/aprsd_slack_plugin/aprsd_slack_plugin.py index 44805fa..a4e9015 100644 --- a/aprsd_slack_plugin/aprsd_slack_plugin.py +++ b/aprsd_slack_plugin/aprsd_slack_plugin.py @@ -48,15 +48,37 @@ class SlackCommandPlugin(plugin.APRSDPluginBase): """Create the slack require client from config.""" # signing_secret = self.config["slack"]["signing_secret"] - bot_token = self.config["slack"]["bot_token"] + if "slack" not in self.config: + LOG.error("APRSD config is missing slack section") + return False + + bot_token = self.config["slack"].get("bot_token", None) + if not bot_token: + LOG.error( + "APRSD config is missing slack: bot_token:. " + "Please install the slack app and get the " + "Bot User OAth Access Token." + ) + return False + self.swc = WebClient(token=bot_token) - self.slack_channel = self.config["slack"]["channel"] + self.slack_channel = self.config["slack"].get("channel", None) + if not self.slack_channel: + LOG.error( + "APRSD config is missing slack: slack_channel: " + "Please add a slack channel name to send messages." + ) + return False + + return True def command(self, fromcall, message, ack): LOG.info("SlackCommandPlugin") - self._setup_slack() + is_setup = self._setup_slack() + if not is_setup: + return # now call the location plugin to get the location info location_plugin = plugin.LocationPlugin(self.config)