Skip to content

Commit

Permalink
Revert "Remove reactions to post message (scrapinghub#171)"
Browse files Browse the repository at this point in the history
This reverts commit f43f44f.
  • Loading branch information
lins05 committed Jul 20, 2018
1 parent f43f44f commit d38c855
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 57 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,6 @@ def hi(message):
# react with thumb up emoji
message.react('+1')

@respond_to('wave')
def wave(message):
# bot adds reaction of :wave: emoji to message
message.react('wave')

from time import sleep
sleep(1)

# bot removes it's reaction of :wave: emoji on message
message.unreact('wave')

@respond_to('I love you')
def love(message):
message.reply('I love you too!')
Expand Down
12 changes: 0 additions & 12 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,6 @@ def hi(message):
# react with thumb up emoji
message.react('+1')

@respond_to('wave')
def wave(message):
# bot adds reaction of :wave: emoji to message
message.react('wave')

from time import sleep
sleep(1)

# bot removes it's reaction of :wave: emoji on message
message.unreact('wave')


@respond_to('I love you')
def love(message):
message.reply('I love you too!')
Expand Down
9 changes: 0 additions & 9 deletions slackbot/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,6 @@ def react(self, emojiname):
channel=self._body['channel'],
timestamp=self._body['ts'])

def unreact(self, emojiname):
"""
Un react to a message using the web api
"""
self._client.unreact_to_message(
emojiname=emojiname,
channel=self._body['channel'],
timestamp=self._body['ts'])

@property
def channel(self):
return self._client.get_channel(self._body['channel'])
Expand Down
6 changes: 0 additions & 6 deletions slackbot/slackclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ def react_to_message(self, emojiname, channel, timestamp):
channel=channel,
timestamp=timestamp)

def unreact_to_message(self, emojiname, channel, timestamp):
self.webapi.reactions.remove(
name=emojiname,
channel=channel,
timestamp=timestamp)


class SlackConnectionError(Exception):
pass
Expand Down
13 changes: 1 addition & 12 deletions tests/functional/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,14 @@ def wait_for_file_uploaded(self, name, maxwait=60):
else:
raise AssertionError('expected to get file "{}", but got nothing'.format(name))

def ensure_reaction_adding_posted(self, emojiname, maxwait=5):
def ensure_reaction_posted(self, emojiname, maxwait=5):
for _ in range(maxwait):
time.sleep(1)
if self._has_reacted(emojiname):
break
else:
raise AssertionError('expected to get reaction "{}", but got nothing'.format(emojiname))

def ensure_reaction_removing_posted(self, emojiname, maxwait=5):
if not self._has_reacted(emojiname):
raise RuntimeError('Have you the reaction "{}" fortesting?'.format(emojiname))

for _ in range(maxwait):
time.sleep(1)
if not self._has_reacted(emojiname):
break
else:
raise AssertionError('expected to get reaction "{}", but got nothing'.format(emojiname))

def _send_message_to_bot(self, channel, msg):
self.clear_events()
self._start_ts = time.time()
Expand Down
8 changes: 1 addition & 7 deletions tests/functional/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,7 @@ def test_bot_listen_to_channel_message(driver):

def test_bot_react_to_channel_message(driver):
driver.send_channel_message('hey!', tobot=False)
driver.ensure_reaction_adding_posted('eggplant')


def test_bot_unreact_to_channel_message(driver):
driver.send_channel_message('hey!', tobot=False)
driver.ensure_reaction_adding_posted('eggplant')
driver.ensure_reaction_removing_posted('eggplant')
driver.ensure_reaction_posted('eggplant')


def test_bot_reply_to_private_channel_message(driver):
Expand Down

0 comments on commit d38c855

Please sign in to comment.