Fixed to work with utils_refactor
This commit is contained in:
parent
0a1d2b3e0e
commit
41468d5467
|
@ -1,6 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aprsd import utils as aprsd_utils
|
|
||||||
from slack_sdk import WebClient
|
from slack_sdk import WebClient
|
||||||
|
|
||||||
import aprsd_slack_plugin
|
import aprsd_slack_plugin
|
||||||
|
@ -46,7 +45,7 @@ class SlackPluginBase:
|
||||||
|
|
||||||
# signing_secret = self.config["slack"]["signing_secret"]
|
# signing_secret = self.config["slack"]["signing_secret"]
|
||||||
try:
|
try:
|
||||||
aprsd_utils.check_config_option(self.config, ["services", "slack", "bot_token"])
|
self.config.exists(["services", "slack", "bot_token"])
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.error("Failed to find config slack:bot_token {}".format(ex))
|
LOG.error("Failed to find config slack:bot_token {}".format(ex))
|
||||||
return "No slack bot_token found"
|
return "No slack bot_token found"
|
||||||
|
|
|
@ -2,8 +2,7 @@ import logging
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from aprsd import messaging, plugin_utils
|
from aprsd import messaging, plugin, plugin_utils
|
||||||
from aprsd import utils as aprsd_utils
|
|
||||||
|
|
||||||
import aprsd_slack_plugin
|
import aprsd_slack_plugin
|
||||||
from aprsd_slack_plugin import base_plugin
|
from aprsd_slack_plugin import base_plugin
|
||||||
|
@ -11,7 +10,7 @@ from aprsd_slack_plugin import base_plugin
|
||||||
LOG = logging.getLogger("APRSD")
|
LOG = logging.getLogger("APRSD")
|
||||||
|
|
||||||
|
|
||||||
class SlackLocationPlugin(base_plugin.SlackPluginBase):
|
class SlackLocationPlugin(base_plugin.SlackPluginBase, plugin.APRSDRegexCommandPluginBase):
|
||||||
"""SlackCommandPlugin.
|
"""SlackCommandPlugin.
|
||||||
|
|
||||||
This APRSD plugin looks for the location command comming in
|
This APRSD plugin looks for the location command comming in
|
||||||
|
@ -48,7 +47,7 @@ class SlackLocationPlugin(base_plugin.SlackPluginBase):
|
||||||
command_regex = "^[lL]"
|
command_regex = "^[lL]"
|
||||||
command_name = "location-slack"
|
command_name = "location-slack"
|
||||||
|
|
||||||
def command(self, packet):
|
def process(self, packet):
|
||||||
LOG.info("SlackCommandPlugin")
|
LOG.info("SlackCommandPlugin")
|
||||||
|
|
||||||
fromcall = packet["from"]
|
fromcall = packet["from"]
|
||||||
|
@ -60,7 +59,7 @@ class SlackLocationPlugin(base_plugin.SlackPluginBase):
|
||||||
|
|
||||||
# get last location of a callsign, get descriptive name from weather service
|
# get last location of a callsign, get descriptive name from weather service
|
||||||
try:
|
try:
|
||||||
aprsd_utils.check_config_option(self.config, ["services", "aprs.fi", "apiKey"])
|
self.config.exists(["services", "aprs.fi", "apiKey"])
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.error("Failed to find config aprs.fi:apikey {}".format(ex))
|
LOG.error("Failed to find config aprs.fi:apikey {}".format(ex))
|
||||||
return "No aprs.fi apikey found"
|
return "No aprs.fi apikey found"
|
||||||
|
|
Loading…
Reference in New Issue