Fixes & New Rewards
This commit is contained in:
parent
bc11d876c7
commit
fae2cacb73
87
channel_rewards/implemented/ChannelReward_SuggestPoll.py
Normal file
87
channel_rewards/implemented/ChannelReward_SuggestPoll.py
Normal file
@ -0,0 +1,87 @@
|
||||
from abc import ABCMeta
|
||||
|
||||
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
import requests
|
||||
|
||||
import threading
|
||||
|
||||
import random
|
||||
|
||||
class ChannelReward_Suggest_Poll(AbstractChannelRewards, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the Suggest a Poll reward.
|
||||
"""
|
||||
ChannelRewardName = "Suggest a Poll"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(ChannelReward_Suggest_Poll.ChannelRewardName, n_args=1, ChannelRewardType=AbstractChannelRewards.ChannelRewardsType.channelPoints)
|
||||
self.help = ["This is a TTS channel point reward."]
|
||||
self.isChannelRewardEnabled = True
|
||||
self.threads = []
|
||||
|
||||
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
|
||||
|
||||
#print("sending:",user, 16, "!lights hydration")
|
||||
try:
|
||||
#if self.is_ChannelReward_enabled:
|
||||
# thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", ""))
|
||||
# thread_.daemon = True
|
||||
# self.threads.append(thread_)
|
||||
# thread_.start()
|
||||
if self.is_ChannelReward_enabled:
|
||||
prompt_ = self.get_Phrase("wants to run a poll about,")
|
||||
thread_ = threading.Thread(target=self.send_TTS, args=("",user + prompt_ + userInput))
|
||||
thread_.daemon = True
|
||||
self.threads.append(thread_)
|
||||
thread_.start()
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
def send_Lights_Command(self, username, light_group, command, rest):
|
||||
# todo need to url-escape command and rest
|
||||
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
|
||||
#standalone_lights
|
||||
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def send_TTS(self, username, message):
|
||||
params = urlencode({'tts_sender': username, 'tts_text': message})
|
||||
#standalone_tts_core
|
||||
url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def get_Phrase(self, defaultRewardPrompt,
|
||||
phrases = ["wants to know other people's thoughts on,", "wants to gauge the room on the topic of,"]):
|
||||
|
||||
phrases.append(defaultRewardPrompt)
|
||||
totalPhrases = len(phrases) - 1
|
||||
targetPhrase = phrases[random.randint(0,totalPhrases)]
|
||||
return targetPhrase
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
87
channel_rewards/implemented/ChannelReward_TTS.py
Normal file
87
channel_rewards/implemented/ChannelReward_TTS.py
Normal file
@ -0,0 +1,87 @@
|
||||
from abc import ABCMeta
|
||||
|
||||
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
import requests
|
||||
|
||||
import threading
|
||||
|
||||
import random
|
||||
|
||||
class ChannelReward_TTS_Message(AbstractChannelRewards, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the TTS Message reward.
|
||||
"""
|
||||
ChannelRewardName = "Send a TTS Message"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(ChannelReward_TTS_Message.ChannelRewardName, n_args=1, ChannelRewardType=AbstractChannelRewards.ChannelRewardsType.channelPoints)
|
||||
self.help = ["This is a TTS channel point reward."]
|
||||
self.isChannelRewardEnabled = True
|
||||
self.threads = []
|
||||
|
||||
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
|
||||
|
||||
#print("sending:",user, 16, "!lights hydration")
|
||||
try:
|
||||
#if self.is_ChannelReward_enabled:
|
||||
# thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", ""))
|
||||
# thread_.daemon = True
|
||||
# self.threads.append(thread_)
|
||||
# thread_.start()
|
||||
if self.is_ChannelReward_enabled:
|
||||
prompt_ = self.get_Phrase(rewardPrompt)
|
||||
thread_ = threading.Thread(target=self.send_TTS, args=(user, userInput))
|
||||
thread_.daemon = True
|
||||
self.threads.append(thread_)
|
||||
thread_.start()
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
def send_Lights_Command(self, username, light_group, command, rest):
|
||||
# todo need to url-escape command and rest
|
||||
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
|
||||
#standalone_lights
|
||||
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def send_TTS(self, username, message):
|
||||
params = urlencode({'tts_sender': username, 'tts_text': message})
|
||||
#standalone_tts_core
|
||||
url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def get_Phrase(self, defaultRewardPrompt,
|
||||
phrases = [""]):
|
||||
|
||||
phrases.append(defaultRewardPrompt)
|
||||
totalPhrases = len(phrases) - 1
|
||||
targetPhrase = phrases[random.randint(0,totalPhrases)]
|
||||
return targetPhrase
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
87
channel_rewards/implemented/ChannelReward_Workout_Pushups.py
Normal file
87
channel_rewards/implemented/ChannelReward_Workout_Pushups.py
Normal file
@ -0,0 +1,87 @@
|
||||
from abc import ABCMeta
|
||||
|
||||
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
import requests
|
||||
|
||||
import threading
|
||||
|
||||
import random
|
||||
|
||||
class ChannelReward_Workout_Pushups(AbstractChannelRewards, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the Do 20 push-ups reward.
|
||||
"""
|
||||
ChannelRewardName = "Do 20 push-ups"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(ChannelReward_Workout_Pushups.ChannelRewardName, n_args=1, ChannelRewardType=AbstractChannelRewards.ChannelRewardsType.channelPoints)
|
||||
self.help = ["This is a Do 20 push-ups channel point reward."]
|
||||
self.isChannelRewardEnabled = True
|
||||
self.threads = []
|
||||
|
||||
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
|
||||
|
||||
#print("sending:",user, 16, "!lights hydration")
|
||||
try:
|
||||
#if self.is_ChannelReward_enabled:
|
||||
# thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", ""))
|
||||
# thread_.daemon = True
|
||||
# self.threads.append(thread_)
|
||||
# thread_.start()
|
||||
if self.is_ChannelReward_enabled:
|
||||
prompt_ = self.get_Phrase(" wants The Curious Nerd, to do 20 pushups")
|
||||
thread_ = threading.Thread(target=self.send_TTS, args=("", user + prompt_))
|
||||
thread_.daemon = True
|
||||
self.threads.append(thread_)
|
||||
thread_.start()
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
def send_Lights_Command(self, username, light_group, command, rest):
|
||||
# todo need to url-escape command and rest
|
||||
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
|
||||
#standalone_lights
|
||||
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def send_TTS(self, username, message):
|
||||
params = urlencode({'tts_sender': username, 'tts_text': message})
|
||||
#standalone_tts_core
|
||||
url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def get_Phrase(self, defaultRewardPrompt,
|
||||
phrases = [""]):
|
||||
|
||||
phrases.append(defaultRewardPrompt)
|
||||
totalPhrases = len(phrases) - 1
|
||||
targetPhrase = phrases[random.randint(0,totalPhrases)]
|
||||
return targetPhrase
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
87
channel_rewards/implemented/ChannelReward_Workout_Situps.py
Normal file
87
channel_rewards/implemented/ChannelReward_Workout_Situps.py
Normal file
@ -0,0 +1,87 @@
|
||||
from abc import ABCMeta
|
||||
|
||||
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
import requests
|
||||
|
||||
import threading
|
||||
|
||||
import random
|
||||
|
||||
class ChannelReward_Workout_Situps(AbstractChannelRewards, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the Do 20 sit-ups reward.
|
||||
"""
|
||||
ChannelRewardName = "Do 20 sit-ups"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(ChannelReward_Workout_Situps.ChannelRewardName, n_args=1, ChannelRewardType=AbstractChannelRewards.ChannelRewardsType.channelPoints)
|
||||
self.help = ["This is a Do 20 sit-ups channel point reward."]
|
||||
self.isChannelRewardEnabled = True
|
||||
self.threads = []
|
||||
|
||||
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
|
||||
|
||||
#print("sending:",user, 16, "!lights hydration")
|
||||
try:
|
||||
#if self.is_ChannelReward_enabled:
|
||||
# thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", ""))
|
||||
# thread_.daemon = True
|
||||
# self.threads.append(thread_)
|
||||
# thread_.start()
|
||||
if self.is_ChannelReward_enabled:
|
||||
prompt_ = self.get_Phrase(" wants The Curious Nerd, to do 20 sit-ups")
|
||||
thread_ = threading.Thread(target=self.send_TTS, args=("", user + prompt_))
|
||||
thread_.daemon = True
|
||||
self.threads.append(thread_)
|
||||
thread_.start()
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
def send_Lights_Command(self, username, light_group, command, rest):
|
||||
# todo need to url-escape command and rest
|
||||
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
|
||||
#standalone_lights
|
||||
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def send_TTS(self, username, message):
|
||||
params = urlencode({'tts_sender': username, 'tts_text': message})
|
||||
#standalone_tts_core
|
||||
url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def get_Phrase(self, defaultRewardPrompt,
|
||||
phrases = [""]):
|
||||
|
||||
phrases.append(defaultRewardPrompt)
|
||||
totalPhrases = len(phrases) - 1
|
||||
targetPhrase = phrases[random.randint(0,totalPhrases)]
|
||||
return targetPhrase
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
87
channel_rewards/implemented/ChannelReward_Workout_Squats.py
Normal file
87
channel_rewards/implemented/ChannelReward_Workout_Squats.py
Normal file
@ -0,0 +1,87 @@
|
||||
from abc import ABCMeta
|
||||
|
||||
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
import requests
|
||||
|
||||
import threading
|
||||
|
||||
import random
|
||||
|
||||
class ChannelReward_Workout_Squats(AbstractChannelRewards, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the Do 20 squats reward.
|
||||
"""
|
||||
ChannelRewardName = "Do 20 squats"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(ChannelReward_Workout_Squats.ChannelRewardName, n_args=1, ChannelRewardType=AbstractChannelRewards.ChannelRewardsType.channelPoints)
|
||||
self.help = ["This is a Do 20 squats channel point reward."]
|
||||
self.isChannelRewardEnabled = True
|
||||
self.threads = []
|
||||
|
||||
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
|
||||
|
||||
#print("sending:",user, 16, "!lights hydration")
|
||||
try:
|
||||
#if self.is_ChannelReward_enabled:
|
||||
# thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", ""))
|
||||
# thread_.daemon = True
|
||||
# self.threads.append(thread_)
|
||||
# thread_.start()
|
||||
if self.is_ChannelReward_enabled:
|
||||
prompt_ = self.get_Phrase(" wants The Curious Nerd, to do 20 squats")
|
||||
thread_ = threading.Thread(target=self.send_TTS, args=("", user + prompt_))
|
||||
thread_.daemon = True
|
||||
self.threads.append(thread_)
|
||||
thread_.start()
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
def send_Lights_Command(self, username, light_group, command, rest):
|
||||
# todo need to url-escape command and rest
|
||||
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
|
||||
#standalone_lights
|
||||
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def send_TTS(self, username, message):
|
||||
params = urlencode({'tts_sender': username, 'tts_text': message})
|
||||
#standalone_tts_core
|
||||
url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def get_Phrase(self, defaultRewardPrompt,
|
||||
phrases = [""]):
|
||||
|
||||
phrases.append(defaultRewardPrompt)
|
||||
totalPhrases = len(phrases) - 1
|
||||
targetPhrase = phrases[random.randint(0,totalPhrases)]
|
||||
return targetPhrase
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -16,7 +16,7 @@ class Chyron_Module():
|
||||
self.addItem(
|
||||
"WeekDays",
|
||||
"► Weekdays: ",
|
||||
"Daily Streams @ 12pm Noon EST")
|
||||
"Daily Dev Streams starting around 12pm Noon EST")
|
||||
self.addItem(
|
||||
"FriSat",
|
||||
"► Friday & Saturday: ",
|
||||
@ -24,18 +24,18 @@ class Chyron_Module():
|
||||
self.addItem(
|
||||
"Commands",
|
||||
"► Commands: ",
|
||||
"!animal, !climateclock, !discord, !page, !roll")
|
||||
self.addItem(
|
||||
"Website",
|
||||
"► Want to read about my various projects? visit: ",
|
||||
"TheCuriousNerd.com")
|
||||
"!animal, !climateclock, !discord, !lights, !roll")
|
||||
#self.addItem(
|
||||
# "Website",
|
||||
# "► Want to read about my various projects? visit: ",
|
||||
# "TheCuriousNerd.com")
|
||||
self.addItem(
|
||||
"Follow",
|
||||
"► ",
|
||||
"If you like what you see, hit that follow button to see more!")
|
||||
"If you like what you see and want more, hit the follow button to see more!")
|
||||
self.addItem(
|
||||
"Discord",
|
||||
"► Want to join our discord? type \" !d \" in chat to get the link or visit: ",
|
||||
"► Need help with Praxis Bot or one of our other projects? (or for memes) Join our discord! Type: \" !d \" in chat to get the link or visit: ",
|
||||
"discord.io/thecuriousnerd")
|
||||
|
||||
def chyron_stringUpdater(self):
|
||||
|
||||
@ -161,7 +161,7 @@ class Twitch_Pubsub():
|
||||
is_actionable = self.is_reward(rewardName, rewardType)
|
||||
if is_actionable:
|
||||
praxis_logger_obj.log("Trying to do the thing")
|
||||
if self.cooldownModule.isCooldownActive("twitchpubsub") == False:
|
||||
#if self.cooldownModule.isCooldownActive("twitchpubsub") == False:
|
||||
self.exec_reward(sender, rewardName, rewardType, rewardPrompt, userInput, raw_data)
|
||||
except:
|
||||
print("something went wrong with a reward")
|
||||
|
||||
@ -35,13 +35,13 @@ def textSource_chyron():
|
||||
return tempModule.getChyronFile()
|
||||
|
||||
@api.route('/text/<file_name>/')
|
||||
def textSource_tempText(filename):
|
||||
print("trying file: ", filename)
|
||||
def textSource_tempText(file_name):
|
||||
print("trying file: ", file_name)
|
||||
tempModule = tempText_Module.tempText_Module()
|
||||
return tempModule.getTempTextFile(filename)
|
||||
return tempModule.getTempTextFile(file_name)
|
||||
|
||||
@api.route('/timer/<timer_name>/')
|
||||
def textSource_timers(filename):
|
||||
def textSource_timers(timer_name):
|
||||
#print("trying file: ", filename)
|
||||
#tempModule = tempText_Module.tempText_Module()
|
||||
#tempModule.getTempTextFile(filename)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user