def Init(): directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") ScriptSettings = MySettings(SettingsFile) ScriptSettings.Response = "Overwritten pong! ^_^" return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "settings.json") ScriptSettings = MySettings(SettingsFile) ScriptSettings.Response = "Settings Overwritten" return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\ChessProfile\Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join( os.path.dirname(__file__), "Services\Scripts\ChessProfile\Settings\settings.json") ScriptSettings = MySettings(SettingsFile) ScriptSettings.Command = "!chess" return
def Init(): Log("Init Called") EnsureLocalDirectoryExists("settings") ScriptSettings = MySettings(SettingsFile) Log("Init Ended") return
def Execute(data): if data.IsChatMessage() and data.GetParam(0).lower(): try: CommandFile = os.path.join( os.path.dirname(__file__), 'Config/' + data.GetParam(0).lower() + '.json') CommandFileList = MySettings(CommandFile) if Parent.GetPoints(data.User) > int(CommandFileList.value): ResponseString = CommandFileList.Response ResponseString = ResponseString.replace( "$character", data.User) ResponseString = ResponseString.replace( "$value", CommandFileList.value) SendResp(data, ResponseString) Parent.RemovePoints(data.User, data.UserName, int(CommandFileList.value)) KeyArray = CommandFileList.keys.split(' ') for i in KeyArray: if str(len(i)) > "1": HoldKey = i.split('.:.') for x in HoldKey: pyautogui.keyDown(x) for y in HoldKey: pyautogui.keyUp(y) else: pyautogui.press(i) else: SendResp(data, "You to poor mate, it cost " + CommandFileList.value) except: return return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") global ScriptSettings ScriptSettings = MySettings(SettingsFile) # The destination directory has to exist if not os.path.isdir(ScriptSettings.FileDirectory): Parent.Log("PUBG Session Stats", "Path {} not found.".format(ScriptSettings.FileDirectory)) sys.exit(1) # Setting the different files path global file_session_start file_session_start = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_SESSION_START global file_games file_games = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_GAMES global file_kills file_kills = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_KILLS global file_wins file_wins = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_WIN global file_assists file_assists = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_ASSIST global file_dbno file_dbno = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_DBNO global file_kd file_kd = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_KD global file_kda file_kda = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_KDA global file_top file_top = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_TOP global file_avg_rank file_avg_rank = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_AVG_RANK global file_total_damages file_total_damages = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_TOTAL_DAMAGE global file_max_damages file_max_damages = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_DAMAGE global file_avg_damages file_avg_damages = ScriptSettings.FileDirectory + "\\" + conf.CONST_FILE_AVG_DAMAGE # Set the local datetime in UTC local_tz = pytz.timezone(ScriptSettings.Timezone) dt_now_without_tz = DT.datetime.now() dt_now_with_tz = local_tz.localize(dt_now_without_tz, is_dst=None) # No daylight saving time dt_now_in_utc = dt_now_with_tz.astimezone(pytz.utc) update_source_file(file_session_start, dt_now_in_utc.strftime('%Y-%m-%d %H:%M:%S %Z')) init_data_files() return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Checks if beerfile exists, if it doesnt: creates it if os.path.isfile(beerFilepath) == 0: data = {} with open(beerFilepath, 'w') as f: json.dump(data, f, indent=4) # Load settings SettingsFile = os.path.join("Settings", "settings.json") SettingsPath = os.path.join(os.path.dirname(__file__), SettingsFile) ScriptSettings = MySettings(SettingsPath) ScriptSettings.Response = "Overwritten file!" return
def Init(): try: Log('Settings start off as:' + json.dumps(ScriptSettings.__dict__)) except: Log('settings not defined yet') directory = os.path.join(os.path.dirname(__file__), "Settings") Log('Checking settings directory for ' + ScriptName + ' exists? ' + directory) if not os.path.exists(directory): Log('directory does not exist, creating settings directory') os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") Log('Loading settings for ' + ScriptName + ' found at: ' + SettingsFile) ScriptSettings = MySettings(SettingsFile) ScriptSettings.Response = "Overwritten pong! ^_^" Log('Settings are now:' + json.dumps(ScriptSettings.__dict__)) return
def Execute(data): if data.IsChatMessage(): try: PointFile = os.path.join(os.path.dirname(__file__), 'Config/Point.json') PointFileList = MySettings(PointFile) if Parent.GetPoints(data.User) > int(PointFileList.value): #SendResp(data, "You to poor mate, it cost " + Parent.GetPoints(data.User)) Parent.RemovePoints(data.User, data.UserName, int(Parent.GetPoints(data.User)) - int(PointFileList.value)) except: return return
def PlayerLoopUp(faction): status = "" CommandFile = os.path.join(os.path.dirname(__file__), 'Config/' + faction + '.json') CommandFileList = MySettings(CommandFile) OnlinePlayer = re.findall(r"[\w']+", CommandFileList.player) for i in OnlinePlayer: Playername = i.lower() Parent.Log(ScriptName, Playername) if GetOnlinePlayer(i) == "true": status = i return status return status
def Init(): global ScriptSettings path = os.path.dirname(__file__) # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) if not os.path.exists(os.path.join(path, CurrentLevelFileName)): with open(os.path.join(path, CurrentLevelFileName), "w+") as f: f.write("0") # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") ScriptSettings = MySettings(SettingsFile) ScriptSettings.Initialized = True return
def Init(): global SettingsFile, ScriptSettings, SmiteApi # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), 'Settings') if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), 'Settings', 'settings.json') ScriptSettings = MySettings(SettingsFile) # Smite API SmiteApi = SmiteClient(ScriptSettings.DevId, ScriptSettings.AuthKey, lambda x: Parent.Log(ScriptName, str(x))) return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") ScriptSettings = MySettings(SettingsFile) # ScriptSettings.Response = "Overwritten pong! ^_^" all_responses = [ "git gud pleb", "when is your bday bo", "KEKW", "LUL LUL LUL", "Kappa", "mrboja1W mrboja1W mrboja1W mrboja1W", "btw this is actually me and not a bot", "i love you", "POG" ] my_response = random.choice(all_responses) return
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Chess.com Profile" Website = "https://www.streamlabs.com" Description = "!chess (username) will give the chess.com profile of a user" Creator = "Dan White" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Services\Scripts\ChessProfile\Settings\settings.json" global ScriptSettings ScriptSettings = MySettings() ScriptSettings.Command = "!chess" #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\ChessProfile\Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Rock, Paper, Scissors" Website = "https://www.streamlabs.com" Description = "!rps (rock/paper/scissors) will play rock paper scissors" Creator = "Dan White" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Services\Scripts\Quote\Settings\settings.json" global ScriptSettings ScriptSettings = MySettings() ScriptSettings.Command = "!rps" #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\Quote\Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Spin Wheel" Website = "https://willsie.net" Description = "Viewers can spin a wheel to gain or lose nuggets" Creator = "Willsie Digital" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "" global ScriptSettings ScriptSettings = MySettings() global RestPath RestPath = os.path.join(os.path.dirname(__file__), "REST") #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Number Guesser" Website = "https://www.streamlabs.com" Description = "!guess (number) will try to guess the secret number" Creator = "Dan White" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Services/Scripts/Quote/Settings/settings.json" global ScriptSettings ScriptSettings = MySettings(SettingsFile) ScriptSettings.Command = "!guess" ScriptSettings.Cooldown = 1 #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\Quote\Settings") if not os.path.exists(directory): os.makedirs(directory)
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Dadjoke script" Website = "https://twitch.tv/immeraufdemhund" Description = "!dadjoke will post a joke in chat" Creator = "immeraufdemhund" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Settings\settings.json" global ScriptSettings ScriptSettings = MySettings(SettingsFile) def Log(message): Parent.Log(ScriptName, message) return #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): try: Log('Settings start off as:' + json.dumps(ScriptSettings.__dict__)) except: Log('settings not defined yet')
def Init(): global SettingsFile SettingsFile = os.path.join(os.path.dirname(__file__), "settings.json") global ScriptSettings ScriptSettings = MySettings(SettingsFile) return
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Quote Generator" Website = "https://www.streamlabs.com" Description = "!quote will post a quote in chat" Creator = "Dan White" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Services/Scripts/Quote/Settings/settings.json" global ScriptSettings ScriptSettings = MySettings(SettingsFile) ScriptSettings.Command = "!quote" #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\Quote\Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings
#--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "" global ScriptSettings # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\\settings.json") ScriptSettings = MySettings(SettingsFile) if len(ScriptSettings.BadWords): ScriptSettings.BadWordList = ScriptSettings.BadWords.split(',') else: ScriptSettings.BadWordList = [] #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): return #--------------------------- # [Required] Execute Data / Process messages #---------------------------
#--------------------------- # [Required] Script Information #--------------------------- ScriptName = "Palindrome" Website = "https://www.streamlabs.com" Description = "!palindrome (message) will check if something is a palindrome or not." Creator = "Dan White" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Services/Scripts/Palindrome/Settings/settings.json" global ScriptSettings ScriptSettings = MySettings(SettingsFile) ScriptSettings.Command = "!palindrome" ScriptSettings.Cooldown = 10 #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\Palindrome\Settings") if not os.path.exists(directory): os.makedirs(directory)
#--------------------------- ScriptName = "Anagram Finder" Website = "https://www.streamlabs.com" Description = "!anagram (message) will attempt to find anagrams" Creator = "Dan White" Version = "1.0.0.0" #--------------------------- # Define Global Variables #--------------------------- global SettingsFile SettingsFile = "Services/Scripts/Quote/Settings/settings.json" global ScriptSettings ScriptSettings = MySettings(SettingsFile) ScriptSettings.Command = "!anagram" ScriptSettings.Cooldown = 10 #--------------------------- # [Required] Initialize Data (Only called on load) #--------------------------- def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Services\Scripts\Quote\Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Services\Scripts\Quote\Settings\settings.json")