예제 #1
0
* Get technical state of machine from Slack: ready, default, heating
* Produce a video of a typical day at Equisense with the Eqs Coffee Machine.
"""
import time
from senseo import Senseo
from brewer import Brewer
from chat import Chat
from tank import Tank
brewer = None
tank = None

print('Listening to Slack...')
try:
	while True:
		for notification in Chat.getNotifications():
			Chat.processNotification(notification)
		while True:
			action = Chat.getNextAction()
			if action is None:
				break
			if brewer and brewer.isAlive():
				Chat.talk('Oh I\'m kind of busy now! Please wait a bit and I\'ll take your order @{0}.'
					.format(action['user']['name']),
					channel=action['notification']['channel'])
				continue
			# Spam a brewing process.
			brewer = Brewer(action['isShort'], action['notification']['channel'],
				action['user'])
			brewer.start()
		if not tank or not tank.isAlive() and not Chat.isDisabled():
			# Spam a tank check process.
예제 #2
0
* Produce a video of a typical day at Equisense with the Eqs Coffee Machine.
"""
import time
from senseo import Senseo
from brewer import Brewer
from chat import Chat
from tank import Tank

brewer = None
tank = None

print('Listening to Slack...')
try:
    while True:
        for notification in Chat.getNotifications():
            Chat.processNotification(notification)
        while True:
            action = Chat.getNextAction()
            if action is None:
                break
            if brewer and brewer.isAlive():
                Chat.talk(
                    'Oh I\'m kind of busy now! Please wait a bit and I\'ll take your order @{0}.'
                    .format(action['user']['name']),
                    channel=action['notification']['channel'])
                continue
            # Spam a brewing process.
            brewer = Brewer(action['isShort'],
                            action['notification']['channel'], action['user'])
            brewer.start()
        if not tank or not tank.isAlive() and not Chat.isDisabled():