test init
This commit is contained in:
parent
d5919aa63d
commit
89fa07e4b0
47
commands/implemented/command_threads.py
Normal file
47
commands/implemented/command_threads.py
Normal file
@ -0,0 +1,47 @@
|
||||
from abc import ABCMeta
|
||||
import tempText_Module
|
||||
|
||||
from commands.command_base import AbstractCommand
|
||||
|
||||
import thread_management_module
|
||||
|
||||
import utilities_script as utilities
|
||||
|
||||
class Command_Threading(AbstractCommand, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the temptext command.
|
||||
"""
|
||||
command = "threads"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(Command_Threading.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
|
||||
self.help = ["This command controls the bot's threads.",
|
||||
"\nExample:",
|
||||
"thread list",
|
||||
"thread start \"Name\"",
|
||||
"thread end \"Name\""]
|
||||
self.isCommandEnabled = True
|
||||
|
||||
def do_command(self, bot, user_message):
|
||||
|
||||
thread_Module = thread_management_module()
|
||||
tempBool = True
|
||||
if tempBool == True:
|
||||
tempParsedMessage = user_message.message.split(" ")
|
||||
i = len(tempParsedMessage)
|
||||
|
||||
if i > 2:
|
||||
if "list" in tempParsedMessage[1]:
|
||||
pass
|
||||
|
||||
if "start" in tempParsedMessage[1]:
|
||||
pass
|
||||
|
||||
if "end" in tempParsedMessage[1]:
|
||||
pass
|
||||
|
||||
returnMessage = "@" + user_message.user.name + " did a thread thing!\n"
|
||||
bot.return_message(returnMessage)
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
34
config_management_module.py
Normal file
34
config_management_module.py
Normal file
@ -0,0 +1,34 @@
|
||||
import massedit
|
||||
import credentials
|
||||
|
||||
import config
|
||||
|
||||
import utilities_script as utilities
|
||||
|
||||
class Config_Management_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.configNames = ['config.py']
|
||||
|
||||
def main(self):
|
||||
print("[Config Management Module]> test")
|
||||
print(self.doesConfigExist("twitch_module"))
|
||||
self.editConfig('twitch_module: bool = False', 'twitch_module: bool = True')
|
||||
|
||||
def changeConfig(self, configName):
|
||||
pass
|
||||
|
||||
def doesConfigExist(self, configName):
|
||||
doesExist = False
|
||||
|
||||
return doesExist
|
||||
|
||||
def editConfig(self, configName, newVar):
|
||||
massedit.edit_files(self.configNames, ["re.sub('" + configName + "','" + newVar + "', line)"])
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
testModule = Config_Management_Module()
|
||||
|
||||
testModule.main()
|
||||
82
thread_management_module.py
Normal file
82
thread_management_module.py
Normal file
@ -0,0 +1,82 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
import twitch_script
|
||||
import discord_script
|
||||
import test_module
|
||||
|
||||
import user_module
|
||||
|
||||
import utilities_script as utility
|
||||
import config as config
|
||||
|
||||
import credentials
|
||||
|
||||
import threading
|
||||
import db
|
||||
|
||||
from enum import Enum
|
||||
|
||||
import config_management_module
|
||||
|
||||
class Thread_Management_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.dbCredential: credentials.DB_Credential
|
||||
self.Config_Management_Module = config_management_module.Config_Management_Module()
|
||||
self.threads = []
|
||||
|
||||
def main(self):
|
||||
credentials_manager = credentials.Credentials_Module()
|
||||
credentials_manager.load_credentials()
|
||||
self.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||
print("[Thread Management Module]> test")
|
||||
|
||||
def addThread(self, threadName):
|
||||
return self.threads.append(self.makeThread(threadName))
|
||||
|
||||
def makeThread(self, threadName):
|
||||
newThreadModule = ThreadModule_Type.get(threadName)
|
||||
self.threads.append()
|
||||
|
||||
def startThread(self, threadName):
|
||||
for t in self.threads:
|
||||
if t.name == threadName:
|
||||
t.start()
|
||||
|
||||
def stopThread(self, threadName):
|
||||
for t in self.threads:
|
||||
if t.name == threadName:
|
||||
self.Config_Management_Module.editConfig(ThreadModule_ConfigBoolName_True.get(t.name), ThreadModule_ConfigBoolName_False.get(t.name))
|
||||
utility.restart_self()
|
||||
|
||||
ThreadModule_Type = {
|
||||
"Twitch" : twitch_script.Twitch_Module(),
|
||||
"Discord" : discord_script.Discord_Module(),
|
||||
"Test" : test_module.Test_Module(),
|
||||
"User" : user_module.User_Module()
|
||||
}
|
||||
|
||||
ThreadModule_ConfigBoolName_True = {
|
||||
"Twitch" : "twitch_module: bool = True",
|
||||
"Discord" : "discord_module: bool = True",
|
||||
"Test" : "test_module: bool = True",
|
||||
"User" : "user_module: bool = True"
|
||||
}
|
||||
|
||||
ThreadModule_ConfigBoolName_False = {
|
||||
"Twitch" : "twitch_module: bool = False",
|
||||
"Discord" : "discord_module: bool = False",
|
||||
"Test" : "test_module: bool = False",
|
||||
"User" : "user_module: bool = False"
|
||||
}
|
||||
|
||||
class Thread_():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.dbCredential: credentials.DB_Credential
|
||||
|
||||
if __name__ == "__main__":
|
||||
testModule = Thread_Management_Module()
|
||||
|
||||
testModule.main()
|
||||
Loading…
Reference in New Issue
Block a user