Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
dazlious committed May 30, 2017
1 parent 8daf3a0 commit 9032a38
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

def init_settings():
parser = argparse.ArgumentParser()

parser.add_argument('-t', '--token', help='Slack API token', required=True, type=str)
parser.add_argument('-c', '--channel', help='Slack channel', required=True, type=str)
parser.add_argument('-cmd', '--command', help='Slack command', required=True, type=str)
parser.add_argument('-i', '--instruction', help='Slack instruction for command', required=True, type=str)

args = parser.parse_args()
return args

Expand All @@ -15,6 +20,12 @@ def main():
try:
settings = init_settings()
slack = Slacker(settings.token)
channel_id = slack.channels.get_channel_id(settings.channel)
slack.chat.command(
channel=channel_id,
command='/' + settings.command,
text=settings.instruction
)

except (KeyboardInterrupt, SystemExit):
print "-> Aborted through user interaction"
Expand Down

0 comments on commit 9032a38

Please sign in to comment.