from Parsers.ConfigParser import ConfigParser from Parsers.ArgParser import ArgParser from Commands.CommandFactory import CommandFactory config = ConfigParser("config.txt") args = ArgParser().parse_args() command = CommandFactory.create(args, config) command.execute() """ import os import sys import shutil from Site import Site from Hosts import Hosts from Folder import Folder projects_path = "C:\\Koda\\laravel" nginx_path = "C:\\Koda\\laravel\\laradock\\nginx\\sites" hosts_path = "C:\\Windows\\System32\\drivers\\etc\\hosts" name = "newsite" if(len(sys.argv) == 1): os.chdir("c:\\Koda\\laravel\\laradock") os.system("docker-compose up -d nginx workspace mysql redis phpmyadmin") exit() if(len(sys.argv) == 2): os.chdir("c:\\Koda\\laravel\\laradock") os.system("docker-compose down") exit()
# bot.py import cfg import re import time from connection import Connection from Commands.CommandFactory import CommandFactory from Commands.abstract.MessageCommand import MessageCommand con = Connection(cfg.HOST, cfg.PORT,cfg.PASS,cfg.NICK,cfg.CHAN) s = con.connect() CHAT_MSG=re.compile(r"^:\w+!\w+@\w+\.tmi\.twitch\.tv PRIVMSG #\w+ :") while True: response = s.recv(1024).decode("utf-8") print(response) if response == "PING :tmi.twitch.tv\r\n": s.send("PONG :tmi.twitch.tv\r\n".encode("utf-8")) else: username = re.search(r"\w+", response).group(0) # return the entire match message = CHAT_MSG.sub("", response).rstrip() command = CommandFactory.create(message,username) if(command and isinstance(command, MessageCommand)): con.chat(command.getMessage(username)) time.sleep(1 / cfg.RATE)