def report_battery_level(slack_config, battery_level): if slack_config.getboolean("reporting") is True: slack_messenger = SlackMessenger(slack_config["report_slack_token"], slack_config["report_channel"], slack_config["report_slackbot_name"]) slack_messenger.message("Current laptop battery level: " + str(battery_level) + "%.")
def main(): if len(sys.argv) < 2: print("Error: One argument (the message to send) must be provided.") sys.exit(1) s = SlackMessenger(slack_token, channel, slackbot_name) result = s.message(sys.argv[1]) log_result(result) if report: report_result(result)