Added reply callback procedure?

This commit is contained in:
Jacob Henry 2018-11-12 13:35:04 -05:00
parent 1ddfa7403b
commit c5a9a41935
3 changed files with 8 additions and 7 deletions

View File

@ -4,6 +4,7 @@ from fuzzywuzzy import fuzz
from slackclient import SlackClient
import channel_util
import client_wrapper
import house_management
import identifier
import scroll_util
@ -66,7 +67,8 @@ def do_signoff(slack: SlackClient, msg: dict, on_assign_index: int, by_brother:
slack_util.reply(slack, msg, "{} signed off {} for {}".format(on_assign.signer.name,
on_assign.assignee.name,
on_assign.job.pretty_fmt()))
alert_user(slack, on_assign.assignee, "Your house job was signed off")
alert_user(slack, on_assign.assignee, "{} signed you off for {}.".format(on_assign.signer.name,
on_assign.job.pretty_fmt()))
async def signoff_callback(slack: SlackClient, msg: dict, match: Match) -> None:
@ -145,7 +147,8 @@ async def signoff_callback(slack: SlackClient, msg: dict, match: Match) -> None:
"signoff step.")
# Make a listener hook
slack_util.ReplyWaiter(foc, pattern, msg["ts"], 60)
new_hook = slack_util.ReplyWaiter(foc, pattern, msg["ts"], 60)
client_wrapper.get_client_wrapper().add_hook(new_hook)
# noinspection PyUnusedLocal

View File

@ -7,13 +7,11 @@ import management_commands
import periodicals
import scroll_util
import slavestothemachine
# Read api token from file
from client_wrapper import ClientWrapper
import client_wrapper
def main() -> None:
wrap = ClientWrapper()
wrap = client_wrapper.get_client_wrapper()
# Add scroll handling
wrap.add_hook(scroll_util.scroll_hook)

View File

@ -158,7 +158,7 @@ class ReplyWaiter(AbsHook):
def try_apply(self, slack: SlackClient, msg: dict) -> Optional[Coroutine[None, None, None]]:
# First check: are we dead of age yet?
time_alive = time() - self.start_time
should_expire = time_alive < self.lifetime
should_expire = time_alive > self.lifetime
# If so, give up the ghost
if self.dead or should_expire: