mirror of
https://gitlab.com/0xDEAD10CC/pycoindroid
synced 2025-07-05 20:41:08 -07:00
update
This commit is contained in:
parent
952f70d859
commit
1d8ac75c8e
1 changed files with 19 additions and 4 deletions
23
src/Droid.py
23
src/Droid.py
|
@ -1,4 +1,4 @@
|
||||||
import logging
|
import logging, telepot
|
||||||
from CoindroidAPI import CoindroidAPITask
|
from CoindroidAPI import CoindroidAPITask
|
||||||
from gevent import sleep
|
from gevent import sleep
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
@ -23,7 +23,16 @@ class DroidControllerTask(CoindroidAPITask):
|
||||||
])
|
])
|
||||||
twilioAccount = "ACdfcd2b529db83954e8a0041796072960"
|
twilioAccount = "ACdfcd2b529db83954e8a0041796072960"
|
||||||
twilioToken = "ab9b98a0b3da8a728d14774192773af2"
|
twilioToken = "ab9b98a0b3da8a728d14774192773af2"
|
||||||
self.twilioClient = TwilioClient(twilioAccount, twilioToken)
|
try:
|
||||||
|
self.twilioClient = TwilioClient(twilioAccount, twilioToken)
|
||||||
|
except:
|
||||||
|
self.logger.exception("Unable to initialize Twilio client!")
|
||||||
|
try:
|
||||||
|
self.telegramBot = telepot.Bot(
|
||||||
|
"382491836:AAGj8Hf5HNAwcukRrjQ3Eyv7TSa2YvGax5s")
|
||||||
|
except:
|
||||||
|
self.logger.exception("Unable to initialize Telegram bot!")
|
||||||
|
|
||||||
|
|
||||||
def getDroidStats(self, event):
|
def getDroidStats(self, event):
|
||||||
targetID = None
|
targetID = None
|
||||||
|
@ -123,14 +132,20 @@ class DroidControllerTask(CoindroidAPITask):
|
||||||
stats["targetID"] == 160):
|
stats["targetID"] == 160):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
"bob's got an action!!! sending sms!!")
|
"bob's got an action!!! sending sms!!")
|
||||||
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 (
|
if (stats["droid_name"] == "Mabuhay") or (
|
||||||
stats["targetName"] == "Mabuhay") or (
|
stats["targetName"] == "Mabuhay") or (
|
||||||
stats["droid_id"] == 165) or stats[
|
stats["droid_id"] == 165) or stats[
|
||||||
"targetID"] == 165:
|
"targetID"] == 165:
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
"Mabuhay's got an action!!! sending sms!!")
|
"Mabuhay's got an action!!! sending sms!!")
|
||||||
self.sendSMS(to="+14086342295", body=message)
|
if self.twilioClient:
|
||||||
|
self.sendSMS(to="+14086342295", body=message)
|
||||||
|
if self.telegramBot:
|
||||||
|
self.telegramBot.sendMessage(-228315434, message)
|
||||||
else:
|
else:
|
||||||
self.logger.debug("Queue is empty... No action to take...")
|
self.logger.debug("Queue is empty... No action to take...")
|
||||||
sleep(self.pause)
|
sleep(self.pause)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue