Skip to content

Commit

Permalink
Abstract hardcoded user ID to single location
Browse files Browse the repository at this point in the history
  • Loading branch information
David Rorex committed Aug 18, 2016
1 parent 74b8bc4 commit 956156d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions slackups/slackgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@
class SlackGateway:

def __init__(self):

## where to save profile pics locally
self.IMGDIR = "/home/hangups/icons"

## url the profile pics are accessible under
self.IMGURL = "http://davr.org/slackicons"

## your slack user id
self.SLACK_USER_ID = "U03NV5HLH"

self.SLACK_TOKEN_URL = 'https://api.slack.com/docs/oauth-test-tokens#test_token_generator'
self.sent_messages = {}
self.renamegroups = False
Expand Down Expand Up @@ -121,7 +129,7 @@ def run(self):
yield from asyncio.sleep(TICK)

def slackMessage(self, channel, user, text):
if user != "U03NV5HLH":
if user != self.SLACK_USER_ID:
logger.info("Ignoring unk dude")
return

Expand Down Expand Up @@ -185,7 +193,7 @@ def convToChan(self, conv):
logger.critical("ERROR SETTING TOPIC")
logger.critical(json.dumps(res).encode("utf-8"))

res = self.client.api_call('groups.invite', channel=channelID, user="U03NV5HLH")
res = self.client.api_call('groups.invite', channel=channelID, user=self.SLACK_USER_ID)
yield from asyncio.sleep(TICK)

self.addGroup({'id':channelID, 'name':cname, 'topic':{'value':util.get_topic(conv)}, 'purpose':{'value':purpose}})
Expand Down

0 comments on commit 956156d

Please sign in to comment.