This commit is contained in:
0xDEAD10CC 2017-07-29 16:22:50 -07:00 committed by Steve Bouché
parent 1d8ac75c8e
commit 89aee67396
2 changed files with 20 additions and 12 deletions

View file

@ -35,6 +35,12 @@ class CurrencyTask(CoindroidAPITask):
continue
if self.currentTransaction:
self.lastTransaction = self.currentTransaction.copy()
self.currentTransaction = request.json()
if not request.json():
self.logger.error("Response is empty!")
elif len(request.json()) < 1:
self.logger.error("Response is empty!")
else:
self.currentTransaction = request.json()[0]
self.logger.info("Retrieved currency from Coindroids...")
self.logger.debug("{}".format(self.currentTransaction.get("last_ingested")))

View file

@ -2,7 +2,9 @@ import logging, telepot
from CoindroidAPI import CoindroidAPITask
from gevent import sleep
from collections import namedtuple
from twilio.rest import Client as TwilioClient
# from twilio.rest import Client as TwilioClient
class DroidControllerTask(CoindroidAPITask):
@ -21,12 +23,12 @@ class DroidControllerTask(CoindroidAPITask):
"experienceChangedFrom",
"experienceChangedTo",
])
twilioAccount = "ACdfcd2b529db83954e8a0041796072960"
twilioToken = "ab9b98a0b3da8a728d14774192773af2"
try:
self.twilioClient = TwilioClient(twilioAccount, twilioToken)
except:
self.logger.exception("Unable to initialize Twilio client!")
# twilioAccount = "ACdfcd2b529db83954e8a0041796072960"
# twilioToken = "ab9b98a0b3da8a728d14774192773af2"
# try:
# self.twilioClient = TwilioClient(twilioAccount, twilioToken)
# except:
# self.logger.exception("Unable to initialize Twilio client!")
try:
self.telegramBot = telepot.Bot(
"382491836:AAGj8Hf5HNAwcukRrjQ3Eyv7TSa2YvGax5s")
@ -132,8 +134,8 @@ class DroidControllerTask(CoindroidAPITask):
stats["targetID"] == 160):
self.logger.debug(
"bob's got an action!!! sending sms!!")
if self.twilioClient:
self.sendSMS(to="+14088963912", body=message)
# if self.twilioClient:
# self.sendSMS(to="+14088963912", body=message)
if self.telegramBot:
self.telegramBot.sendMessage(-228315434, message)
if (stats["droid_name"] == "Mabuhay") or (
@ -142,8 +144,8 @@ class DroidControllerTask(CoindroidAPITask):
"targetID"] == 165:
self.logger.debug(
"Mabuhay's got an action!!! sending sms!!")
if self.twilioClient:
self.sendSMS(to="+14086342295", body=message)
# if self.twilioClient:
# self.sendSMS(to="+14086342295", body=message)
if self.telegramBot:
self.telegramBot.sendMessage(-228315434, message)
else: