Пример #1
0
def quitCommand(input):
    if input == message.strip().lower() and user == CHANNEL:
        sendMessage(s, "The bot is being terminated.")
        quit()
    elif input == message.strip():
         sendMessage(s, "Error: You are not the channel owner.")
         cooldown()
def addCommand(s, message, commands):
    message_params = message.split(' ', 2)
    if len(message_params) != 3:
        print("addCommand::Error - Incorrect number of parameters")
    else:
        commands[message_params[1]] = message_params[2]
        sendMessage(s, "Command added:  " + message_params[1])
Пример #3
0
def commandCurrent(s):
	from functions import launchdemo
	print(launchdemo)
	for idx, item in enumerate(demolist):
		if item == launchdemo:
			demoidx = idx
	sendMessage(s, "The current demo is: " + launchdemo + " . Demo ID is: " + str(demoidx))
Пример #4
0
def getCommands(input):
    if input == message.strip().lower():
        sendMessage(
            s,
            'Commands: !wr • !2nd • !3rd • !4th • !pb • !place • !leaderboard • !race'
        )
        cooldown()
Пример #5
0
def check_command(chat, user):
    global quiz_running
    global current_quiz_answer
    global current_question_ended
    global s
    print 'checking command: ', chat
    print 'right answer: ', current_quiz_answer

    if '!startQuiz' in chat:
        if user_is_mod(user):
            if quiz_running == False:
                init_quiz()
                quiz_running = True
                t = threading.Thread(target=thread_entry)
                t.setDaemon(True)
                t.start()
                print "Thread started"
    if '!stopQuiz' in chat:
        quiz_running = False
        reinit_globals()

    if '!top5' in chat:
        print 'Sending top'
        send_top()

    if quiz_running and not current_question_ended and current_quiz_answer and current_quiz_answer.lower(
    ) in chat.lower():
        ms = 'Correct answer by: ' + user
        current_question_ended = True
        sendMessage(s, ms)
        if user_point_dict.has_key(user):
            user_point_dict[user] = user_point_dict[user] + 1
        else:
            user_point_dict[user] = 1
Пример #6
0
def give(msg,user, trivia_dict):
        if "!skip" in msg:
                if user.lower() == "ryssh" or user.lower() == "grady_wilson" or user.lower() == "arendiko" :
                        global gimmetimer
                        if time.time() > gimmetimer:
                                gimmetimer = time.time() + 3
                                sendMessage(s, trivia_dict["a"])
Пример #7
0
def controlIllumination(light_message):

    if "light_on" in light_message:
        sendMessage(s, "You have turned the light on!")
        # testingcontroller.turn_on_illumination()
    if "light_off" in light_message:
        sendMessage(s, "You have turned the light off!")
def removeCommand(s, message, commands):
    message_params = message.split(' ', 1)
    if len(message_params) != 2:
        print("removeCommand::Error - Incorrect number of parameters")
    else:
        del commands[message_params[1][0:len(message_params[1]) - 1]]
        sendMessage(s, "Command removed:  " + message_params[1])
Пример #9
0
def slotMachine():
    options = [
        'jigAYAYA', 'jigAYAYA', 'jigAYAYA', 'Mhmm', 'Mhmm', 'BonkTime',
        'ExpansionPak', 'ExpansionPak', 'ExpansionPak', 'GodsIntendedConsole'
    ]
    slot1 = random.choice(options)
    slot2 = random.choice(options)
    slot3 = random.choice(options)
    prize = None
    if (slot1 == slot2) and (slot1 == slot3) and (slot1 == 'jigAYAYA'):
        prize = 'FreePlay'
    elif (slot1 == slot2) and (slot1 == slot3) and (slot1 == 'BonkTime'):
        prize = 'LosePoints'
    elif (slot1 == slot2) and (slot1 == slot3) and (slot1 == 'Mhmm'):
        prize = 'Pyramid'
    elif (slot1 == slot2) and (slot1 == slot3) and (slot1
                                                    == 'GodsIntendedConsole'):
        prize = 'Jackpot'
    elif (slot1 == slot2) and (slot1 == slot3) and (slot1 == 'ExpansionPak'):
        prize = 'Item'
    elif (slot1 == slot2 and slot1 == 'GodsIntendedConsole') or (
            slot1 == slot3 and slot1 == 'GodsIntendedConsole') or (
                slot2 == slot3 and slot2 == 'GodsIntendedConsole'):
        prize = 'MiniJackpot'
    sendMessage(s, slot1 + " " + slot2 + " " + slot3)
    return prize
Пример #10
0
def checkUptime(s, message, start):
    if (len(message) == len('!uptime' + '\r')) and ("!uptime" in message):
        end = time.time()
        time_tab = stopWatch(end - start)
        uptime = str(time_tab[0]) + "h " + str(time_tab[1]) + "m " + str(
            time_tab[2]) + "s"
        sendMessage(s, uptime)
Пример #11
0
def getCommands(input):
    if input == message.strip().lower():
        sendMessage(
            s,
            '/me commands: !daily • !croissants • !top3 • !gamble • !slots • !followage • !uptime • !quote • !discord • !youtube • !donate • !bot'
        )  #+' • '.join(listCommand))
        cooldown()
Пример #12
0
def trivia(msg,trivia_dict,active,used_dict):
        if "!trivia" in msg:
                global triviatimer
                if time.time() > triviatimer:
                        triviatimer = time.time() + 8
                        if "q" not in trivia_dict.keys():
                                qNum = random.randint(0,int(len(trivia_dict)) -1)
                                if qNum in used_dict.keys():
                                        qNum = random.randint(0,int(len(trivia_dict)) -1)
                                        while qNum in used_dict.keys():
                                                qNum = random.randint(0,int(len(trivia_dict)) -1)

                                
                                used_dict[qNum] = qNum
                                print(str(qNum))
                                question_info = trivia_dict.get(qNum)
                                print(question_info)
                                question = question_info.split("|")[0]+ "????????????"
                                print("question: "+question)
                                answer = question_info.split("|")[1]
                                sendMessage(s, question+"?")
                                trivia_dict["a"] = answer
                                trivia_dict["q"] = question
                                del trivia_dict[qNum]
                                print(str(len(trivia_dict)))
                        else:
                                sendMessage(s, "answer the current question first: "+trivia_dict["q"])
Пример #13
0
def songCommand(input):
    if input == message.strip().lower():
        songFile = open("Now Playing.txt", "r")
        songName = songFile.readline()
        sendMessage(s, songName[3:].title())
        songFile.close()
        cooldown()
Пример #14
0
def mingyResponse(input):
    if input in message.strip().lower() and "!croissants" not in message.strip(
    ).lower() and "!award" not in message.strip().lower(
    ) and "!add" not in message.strip().lower():
        global mingyTimer
        #Aborts if 10 minutes have not yet passed since last Mingy response
        if not (time.time() - mingyTimer) > 600:
            return
        mingy_jongo_quotes = [
            "Hello, %s. Mumbo has big surprise for you." % user,
            "Har-har-harrr! Foolish %s, you fell straight into my trap!" %
            user,
            "I'm not that pathetic shaman you think I am! I'm Mingy Jongo and your worthless quest ends here, %s..."
            % user,
            "Foolish %s, why do you return? A few more shocks from my stick seem necessary..."
            % user,
            "As you see, %s, there's no escape and resistance is futile!" %
            user
        ]
        randomNumber = random.randint(0, len(mingy_jongo_quotes) - 1)
        randomQuote = mingy_jongo_quotes[randomNumber]
        #2 second delay for realism
        abort_after = 2
        start = time.time()
        while True:
            delta = time.time() - start
            if delta >= abort_after:
                break
        sendMessage(s, randomQuote)
        mingyTimer = time.time()
        cooldown()
Пример #15
0
def color(msg,user):
        if "!color" in msg:
                if user.lower() == "yoloswagbruh" :
                        global gimmetimer
                        if time.time() > gimmetimer:
                                color = msg.split(" ")[1]
                                gimmetimer = time.time() + 3
                                sendMessage(s, "/color "+color)
Пример #16
0
def checkFollow(s, followtime):
    """sends a follow message periodically"""
    current = time.time()
    msg, limit = follow()
    if current - followtime >= limit:
        followtime = current
        sendMessage(s, msg)
    return followtime
Пример #17
0
def checkFollows():
	global lastFollow
	follow=urlopen("https://api.twitch.tv/kraken/channels/"+CHANNEL+"/follows").read(1000).decode("utf-8")
	follow=follow.split("kraken/users/")[1]
	follow=follow.split("/follows/")[0]
	if follow!=lastFollow:
		sendMessage(s,"Merci "+follow+" pour le follow ! Bienvenue parmi les chiens de la casse ! :)")
		lastFollow=follow
Пример #18
0
def answer(user, msg, trivia_dict):
        try:
                print("looking for : "+trivia_dict["a"])
                if trivia_dict["a"].lower() in msg.lower():
                        sendMessage(s, user+" got the correct answer: "+trivia_dict["a"])
                        del trivia_dict["a"]
                        del trivia_dict["q"]
        except:
                pass
Пример #19
0
def quitCommand(input):
    if input == message.strip().lower() and user == CHANNEL:
        sendMessage(s, "/me has disconnected.")
        quit()
    elif input == message.strip().lower():
        sendMessage(
            s,
            "@" + user + " Only the channel owner may use the !quit command.")
        cooldown()
Пример #20
0
def quitCommand(input):
    if input == message.strip().lower() and user == CHANNEL:
        sendMessage(s, "[Disconnected]")
        quit()
    elif input == message.strip():
        sendMessage(
            s, "@" + user.title() +
            " Only the channel owner may use the !kill command.")
        cooldown()
Пример #21
0
def recognize(s, c, cd, td, ld):
    """attempts to recognize a command given by the user"""
    if c not in cd:
        return td
    td, ok = checkTime(c, td, ld)
    if ok:
        msg = cd[c]()[0]
        sendMessage(s, msg)
    return td
Пример #22
0
def leaveChan(msg):
        global leave
        if "!leave #"+channel in msg:
                if not leave:
                        sendMessage(s, "ok bye KKona 4Hand")
                        leave = True
        elif "!join" in msg:
                if leave and user.lower() == "yoloswagbruh" or user.lower() == "usuallyhigh" or user.lower() == "tehonlyninja" or user.lower() == "grady_wilson":
                        sendMessage(s, "back again tell a friend KKona")
                        leave = False 
Пример #23
0
def commandFROGTip(s, chan, caps):
    r = requests.get('https://tadpole.frog.tips/api/3/tips',
                     auth=HTTPBasicAuth(UUID, PASSPHRASE))
    tip = random.choice(r.json())['tip']
    if caps == True:
        tip = tip.lower()
        tip = re.sub(r'frog', upper_repl, tip)
        sendMessage(s, chan, tip)
    else:
        sendMessage(s, chan, tip)
def addBadWord(s, message, bad_words):
    message_params = message.split(' ', 2)
    if len(message_params) != 3:
        print("addBadWord::Error - Incorrect number of parameters")
    else:
        if message_params[2] == 'warrning\r':
            bad_words['warrning'].append(message_params[1])
            sendMessage(s, "Word added to warrning list")
        elif message_params[2] == 'timeout\r':
            bad_words['timeout'].append(message_params[1])
            sendMessage(s, "Word added to timeout list")
def joinRoom(s):
    readbuffer = ""
    Loading = True
    while Loading:
        readbuffer = readbuffer + s.recv(1024).decode("UTF-8")
        temp = readbuffer.split("\n")
        readbuffer = temp.pop()
        for line in temp:
            print(line)
            Loading = loadingComplete(line)
    sendMessage(s, "Bot Successfully Joined")
Пример #26
0
def startRaffle(input):
    if input == message.lower().strip() and user == CHANNEL:
        global raffleTimerStartTime
        global raffleStatus
        raffleStatus = True
        raffleTimerStartTime = time.time()
        sendMessage(
            s,
            CHANNEL.title() +
            " has started a raffle! Join with !enter. The winner will be announced in 2 minutes."
        )
        return
Пример #27
0
def cringe(msg, cringetimer):
        if "!cringe" in msg:
                if (time.time() > cringeTimer):
                        global cringeTimer
                        cringeTimer = time.time() + 30
                        num = random.randint(0,int(len(videoIds) - 1))
                        print(str(len(videoIds)))
                        sendMessage(s, "cringe video #"+str(num)+" : https://www.youtube.com/watch?v="+videoIds[int(num)])    
                        return
                elif "!cringe" in msg:
                        sendMessage(s,"cringe has a 30sec cd")
                        return
Пример #28
0
def joinRoom(s):
    readbuffer = ""
    Loading = True
    while Loading:
        readbuffer = readbuffer + s.recv(1024).decode("utf-8")
        temp = str.split(readbuffer, "\n")
        readbuffer = temp.pop()

        for line in temp:
            print(line)
            Loading = loadingComplete(line)
    sendMessage(s, "Hello chat. I am here to assist you on this journey!")
Пример #29
0
def joinRoom(s):
	readbuffer = ""
	Loading = True
	while Loading:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
			
		for line in temp:
			print(line)
			Loading = loadingComplete(line)
	sendMessage(s, "Successfully joined chat")
Пример #30
0
def joinRoom(s):
	readbuffer = ""
	Loading = True
	while Loading:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)
			Loading = loadingComplete(line)
	sendMessage(s, "Successfully joined chat")
Пример #31
0
def joinRoom(s):
    buffer = ""
    Loading = True
    while Loading:
        buffer = buffer + s.recv(2048).decode("utf-8")
        temp = buffer.split("\n")
        buffer = temp.pop()

        for line in temp:
            print(line)
            Loading = loadingComplete(line)
    sendMessage(s, "Joined chat")
Пример #32
0
def joinRoom(s):
    Loading = True
    while Loading:
        readbuffer = s.recv(1024).decode("utf-8")
        temp = readbuffer.split("\n")

        for line in temp:
            print(line)
            Loading = loadingComplete(line)
            if not Loading:
                break

    sendMessage(s, "Successfully joined chat")
Пример #33
0
def joinRoom(s):
    readbuffer = ""
    Loading = True
    while Loading:
        readbuffer = s.recv(1024)
        readbuffer = readbuffer.decode()
        temp = readbuffer.split("\n")
        readbuffer = readbuffer.encode()
        readbuffer = temp.pop()
        for line in temp:
            print(line)
            Loading = loadingComplete(line)
    sendMessage(s, "The bot has successfully connected.")
Пример #34
0
def join(s):
    rb = b''
    connecting = True
    print("Starting bot...\n\nTo stop the bot, restart the terminal\n\n")
    while connecting:
        rb += s.recv(1024)
        temp = rb.split(b"\n")
        rb = temp.pop()

        for i in temp:
            print(i)
            connecting = doneJoining(i)
    sendMessage(s, b"Has joined the chat")
def removeBadWord(s, message, bad_words):
    message_params = message.split(' ', 2)
    if len(message_params) != 3:
        print("removeBadWord::Error - Incorrect number of parameters")
    else:
        if message_params[2] == 'warrning\r':
            if message_params[1] in bad_words['warrning']:
                bad_words['warrning'].remove(message_params[1])
                sendMessage(s, "Word removed from warrning list")
        elif message_params[2] == 'timeout\r':
            if message_params[1] in bad_words['timeout']:
                bad_words['timeout'].remove(message_params[1])
                sendMessage(s, "Word removed from timeout list")
Пример #36
0
def joinRoom(s):
	readbuffer = ""
	Loading = True
	while Loading:
		readbuffer = readbuffer + s.recv(1024).decode('utf-8')
		temp = readbuffer.split("\n")
		readbuffer = temp.pop()

		for line in temp:
			print(line)
			Loading = loadingComplete(line)
	sendMessage(s, "Successfully joined chat")
	s.setblocking(0)
Пример #37
0
def duel(user, channel, msg):
        if "!duel " in msg:
                global dueltimer
                if time.time() > dueltimer:
                        hunnidk = open("hunnidk.txt","a")
                        records = open("record.txt", "a")
                        target =  msg.split(" ")[1]
                        dueltimer = time.time() + 4
                        roll = random.randint(1,100000)
                        if user.lower() == target.lower():
                                sendMessage(s, "you can't duel yourself ideot KKona")
                                return
                        elif search(chatters, target.lower()) == False:
                                sendMessage(s,"I can't find that user WutFace")
                                return
                        elif roll > 50000:
                                sendMessage(s,"/me spits on "+target+"! ("+str(roll)+")")
                                records.write(user+" win"+" \r\n")
                                records.write(target+ " lose"+" \r\n")
                                records.close()
                                if roll == 100000:
                                        hunnidk.write(user +" 100k \r\n")
                                        hunnidk.close()
                                return
                        elif roll <50001:
                                sendMessage(s,"/me spits on "+user+"! ("+str(roll)+")")
                                records.write(target+" win"+" \r\n")
                                records.write(user+ " lose"+" \r\n")
                                records.close()
                                if roll == 1:
                                        hunnidk.write(user +" 1 \r\n")
                                        hunnidk.close()
                                return
Пример #38
0
def joinRoom(s):
    """Ensures that the bot successfully joined the room"""
    readBuffer = ""
    loading = True
    while loading:
        readBuffer = readBuffer + s.recv(1024).decode("UTF-8")
        temp = readBuffer.split("\n")
        readBuffer = temp.pop()

        for line in temp:
            print(line)
            loading = loadingComplete(line)
            
    sendMessage(s, "Successfully joined chat")
Пример #39
0
def joinRoom(s):
    readbuffer = ""
    Loading = True
    while Loading:
        readbuffer = readbuffer + s.recv(1024).decode()
        #temp = string.split(readbuffer, "\n")
        temp = readbuffer.split("\n")
        readbuffer = temp.pop()

        for line in temp:
            print(line)
            Loading = loadingComplete(line)

    sendMessage(s, "!owlballs")
Пример #40
0
def joinRoom(s):
	readbuffer = ""
	Loading = True
	while Loading:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)
			Loading = loadingComplete(line)
	#sendMessage(s, "您的好友google小姐已上線")
	sendMessage(s, "大鯨:て・い・と・く、提督!")
	
	player_Poi("Taigei29.mp3")
def joinRoom(s):
	readbuffer = ""
	Loading = True
	while Loading:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)
			Loading = loadingComplete(line)
	if "reload = 0" in fileRead("Vars/Reload.txt"):
		sendMessage(s, "Hello! I'm Hayleethebot, a bot made my Hayleethegamer!")
		varChange("Reload.txt", "reload = 0")
	else:
		sendMessage(s, "Bot Reloaded")
		varChange("Reload.txt", "reload = 0")
Пример #42
0
def goldduel(user, msg):
        if "!duelgold " in msg:
                wager = msg.split(" ")[2]
                if wager:
                        global golddueltimer
                        if time.time() > golddueltimer:
                                records = open("record.txt", "a")
                                target =  msg.split(" ")[1]
                                golddueltimer = time.time() + 4
                                if search(chatters, target.lower()) == False:
                                        sendMessage(s, "I can't find that person WutFace")
                                        return
                                if int(wager) / 1:
                                        if int(wager) < 0:
                                                return
                                        hashq = random.getrandbits(128)
                                        hashstr = str(hashq)[0:4]
                                        sendMessage(s, target+", you have been challenged to a gold duel by "+user+" for "+wager+" gold, type !confirm "+hashstr+" to accept")
                                        goldDict[hashstr] = user+" "+target+" "+wager
                                        print(str(goldDict))
Пример #43
0
def winrate(user,msg):
        if "!winrate" == msg:
                global winratetimer
                wins = 0
                total = 0
                if time.time() > winratetimer:
                        winratetimer = time.time() + 4
                        records = open("record.txt","r")
                        for line in records:
                                if user.lower() in line.lower():
                                        if "win" in line:
                                                wins += 1
                                                total += 1
                                        else:
                                                total += 1
                        if total > 0:
                                winrate = (wins / total)*100
                                sendMessage(s, user+" wins: "+str(wins)+", total: "+str(total)+", winrate: "+str("%.2f" % winrate)+"%")
                        else:
                                sendMessage(s, "you need to play more matches, "+user)
                        return
Пример #44
0
def confirm(msg, goldDict, user):
        if "!confirm " in msg:
                duelID = msg.split(" ")[1]
                global confirmtimer
                if time.time() > confirmtimer:
                        confirmtimer = time.time() + 4
                        infostring = goldDict.get(duelID)
                        challenger = infostring.split(" ")[0]
                        challengee = infostring.split(" ")[1]
                        wager = infostring.split(" ")[2]
                        roll = random.randint(1,100)
                        print(str(challenger)+" is the challenger "+str(challengee)+" is the target "+str(wager)+" is the wager")
                        if user.lower() == challengee.lower():
                                #print("made it here")
                                if search(chatters, challenger.lower()) == False:
                                        sendMessage(s,"both users need to be in chat for gold duels")
                                        return
                                elif roll > 50:
                                        time.sleep(.5)
                                        sendMessage(s,str(challenger)+" rolls a "+str(roll)+", "+str(challengee)+" owes "+str(challenger)+" "+str(wager)+" gold!")
                                        del goldDict[duelID]
                                        return
                                elif roll <51:
                                        time.sleep(.5)
                                        sendMessage(s,str(challenger)+" rolls a "+str(roll)+", "+str(challenger)+" owes "+str(challengee)+" "+str(wager)+" gold!")
                                        del goldDict[duelID]
                                        return
Пример #45
0
def winrate2(user,msg):
        if "!winrate " in msg:
                global winratetimer
                target = msg.split(" ")[1]
                wins = 0
                total = 0
                if search(chatters, target.lower()) == True:
                        if time.time() > winratetimer:
                                winratetimer = time.time() + 4
                                records = open("record.txt","r")
                                for line in records:
                                        if target.lower() in line.lower():
                                                if "win" in line:
                                                        wins += 1
                                                        total += 1
                                                else:
                                                        total += 1
                                if total > 0:
                                        winrate = (wins / total)*100
                                        sendMessage(s, target+" wins: "+str(wins)+", total: "+str(total)+", winrate: "+str("%.2f" % winrate)+"%")
                                else:
                                        sendMessage(s, "unable to find records for "+target)
                                return
                else:
                        sendMessage(s, "make sure your target is currently in chat")
                        return
Пример #46
0
def find(msg,user):
        if "!find " in msg:
                global findtimer
                if time.time() > findtimer:
                        target2 = msg.split(" ")[1]
                        if target2.lower() == "yoloswagbruh":
                                sendMessage(s, "wouldn't you like to know deIlluminati")
                                return
                        sendMessage(s, "looking for "+target2+" please wait")
                        findtimer = time.time() +10
                        following = ""
                        follows = []
                        followerurl = urlopen("https://api.twitch.tv/kraken/users/"+target2+"/follows/channels?direction=desc&limit=200")
                        #index = 1
                        for word in followerurl.readlines():
                                following += word.strip().decode("utf-8")
                        follows = following.split("follows/channels/")
                        del follows[0]
                        temp = ""
                        namelist = []
                        for element in follows:
                                namelist.append(element[:20].split('"')[0])    
                        watching = ""
                        for channel in namelist:
                                response = urlopen("https://tmi.twitch.tv/group/user/"+channel+"/chatters")
                                readable = response.read().decode("utf-8")
                                chatlist = loads(readable)
                                chatters = chatlist['chatters']        
                                print(channel)
                                if search(chatters, target2.lower()):
                                        if channel == "ethanthejones":
                                                watching += ""
                                        else:
                                                watching += channel+", "
                        if watching != "":
                                sendMessage(s, target2+" is in "+watching)
                        elif watching == "":
                                sendMessage(s, target2+" is not in any channels FeelsBadMan")
Пример #47
0
def hunnidk(msg):
        if "!100k" in msg:
                global jahtimer
                if time.time() > jahtimer:
                        jahtimer = time.time() + 4
                        hunnid = open("hunnidk.txt","r")
                        winners = ""
                        losers = ""
                        for line in hunnid:
                                if "100k" in line:
                                        winners += line.split(" ")[0]+", "
                                elif "1" in line:
                                        losers += line.split(" ")[0]+", "
                        if winners == "" and losers == "":
                                sendMessage(s, "No one has rolled a 100k or a 1 yet FeelsBadMan")
                        else:
                                sendMessage(s, "winners: "+winners)
                                time.sleep(1.3)
                                sendMessage(s, "losers: "+losers)
Пример #48
0
import string
from Read import getUser, getMessage
from Socket import openSocket, sendMessage
from Initialize import joinRoom

s = openSocket()
joinRoom(s)
readbuffer = ""

while True:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)
			if "PING" in line:
				s.send(line.replace("PING", "PONG"))
				break
			user = getUser(line)
			message = getMessage(line)
			print user + " typed :" + message
			if "You Suck" in message:
				sendMessage(s, "No, you suck!")
				break
			if "!quote 1" in message:
				sendMessage(s, "People need to know ferrets are metal as f**k -Deveral")
				break
			
Пример #49
0
		actualtime=time.time()
		if actualtime-lastUptimeUpdate > 60:
			nbUpdate=int((actualtime-lastUptimeUpdate)/60)
			uptimeUpdate(nbUpdate)
			lastUptimeUpdate+=nbUpdate*60
		print(line.encode("ascii","ignore"))
		user=getUser(line)
		message=getMessage(line)
		messagelc=message.lower()
		noCommande=False
		cooldown=actualtime-lastCommande
		if user not in MODOS and cooldown < COOLDOWNCMD:
			noCommande=True
		else:
			if messagelc=="!help" or messagelc=="!commands" or messagelc=="!commandlist" or messagelc=="!commandes":
				sendMessage(s,"Ici Tanook_Lebot version bêta ! Je peux vous donner le !planning de la chaîne, les réseaux sociaux (!twitter, !youtube, !discord), les !pb Isaac de Tanook ainsi que les !starters et !mods du jeu, votre !uptime vos !messages et la liste des !modos. Vous pouvez tenter la !roulette, la !8ball et le !love, et j'ai quelques notions de base en modérations. :)")
			elif messagelc=="!ffz":
				sendMessage(s,"Extension www.FrankerFaceZ.com pour avoir les émotes chaloupées !")#goo.gl/ycz20N")
			elif messagelc=="!isaacmods" or messagelc=="!isaacsmods" or messagelc=="!mods":
				sendMessage(s,"Instant-Start : github.com/Zamiell/instant-start-mod ; Jud6s : github.com/Zamiell/jud6s ; Diversity : github.com/Zamiell/diversity-mod")
			elif messagelc=="!ladder":
				sendMessage(s,"Pour vous inscrire au Ladder c'est ici ! : goo.gl/forms/6bhNPqGwyRBfXbTD3")
			elif messagelc=="!diversity":
				sendMessage(s,"Diversity mod download + info: github.com/Zamiell/diversity-mod")
			elif messagelc=="!instantstart" or messagelc=="!instant-start":
				sendMessage(s,"Instant Start mod download + info: github.com/Zamiell/instant-start-mod")
			elif messagelc=="!jud6s" or messagelc=="!judasd6":
				sendMessage(s,"Jud6s mod download + info: github.com/Zamiell/jud6s")
			elif messagelc=="!starters":
				sendMessage(s,"Le guide des starters sur Isaac c'est ici : bit.ly/22lCM6i !")
			elif messagelc=="!srl" or messagelc=="!speedrunslive":
def chatCommands(readbuffer,s,message,temp,line,user,greeted,trusted,mods,tempWhitelist):
                        print(user + ": " + message)
			#all users
			try:
				split = message.split()
				greeting = split[0]
				person = split[1]
			except IndexError:
				person = "null"
			if (greeting.lower() in fileRead("Greetings.txt")) and (person.lower() in fileRead("Persons.txt")) or (person.lower() in fileRead("Greetings.txt")) and (greeting.lower() in fileRead("Persons.txt")):
				if (user not in fileRead('Greeted.txt')) and (user not in greeted):
					sendMessage(s, "Hello " + user + ", welcome to the stream!")
					greeted.append(user)
					fileWrite("Greeted.txt", user)
			if message == "!timeoutm\r":
                                sendMessage(s, "/timeout " + user + " 1")
                                sendMessage(s, "Really? Why did you time yourself out?")
			#Truested
			if (user in fileRead("Trusted.txt")) or (user in trusted) or (user in fileRead("Mods.txt")) or (user in mods):
				if "!quote" in message:
        	                        quote(message,user,s)
	                        if "!dictionary" in message:
                	                dictionary(message,user,s) 
				if message == "!credit\r":
					sendMessage(s, "The base of this code was thanks to Bad Nidalee on Youtube. Here's the Video: https://www.youtube.com/watch?v=T8DLwACpe3o")
				if message == "!test\r":
					sendMessage(s, "Yes, Hi, I'm working " + user)
				if message == "!bed\r":
					sendMessage(s, "Bed? What is a bed? Sleep? What's sleep? Who needs it?")
				if message == "!commands\r":
					sendMessage(s, "!bed, !test, !credit, !timeoutm, !quote, !dictionary, !trusted, !bot, !social")
				if message == "!rules\r":
					sendMessage(s, fileRead("Rules.txt"))
				if message == "!trusted\r":
					sendMessage(s, "Trusteds are users whome I trust more then the random viewer, they get access to commands and immunity from some of my automated modderating")
				if message == "!bot\r":
					sendMessage(s, "I am Hayleethegamer's bot, I am all hard coded by Haylee with some base code from someone else (check credit command). I enjoy watching chat and Haylee. And don't call me an it, I'm a she.")
				if message == "!social\r":
					sendMessage(s, "At the moment I do not have any social media I'm linking with this twitch account, but I may in the future")

				
			#Moderators
			if (user in fileRead("Mods.txt")) or (user in mods):
				if "!addtrusted" in message:
					foundUser = addUser(message)
					trusted.append(foundUser)
					fileWrite("Trusted.txt", foundUser)
					sendMessage(s, foundUser + " was added to Trusted list")
				if "!whitelist " in message:
					whitelisted = addUser
					tempWhitelist.append(whitelisted)
					sendMessage(s, whitelisted + " May now post one link in chat")
				if "!removetrusted " in message:
					removeUser = addUser(message)
					removeLine("Trusted.txt", removeUser)
					sendMessage(s, removeUser + " was removed from the trusted list.")
			#broadcaster
			if user == "hayleethegamer":
				if (message == "!exit\r"):
                                	quit(s) 
				if "!addmod" in message:
					foundUser = addUser(message)
					print(foundUser)
					mods.append(foundUser)
					fileWrite("Mods.txt", foundUser)
					sendMessage(s, foundUser + " was added to the Moderators list")
				if (message == "!reloadbot\r"):
					print("Restarting...")
					varChange("Reload.txt", "reload = 1")
					subprocess.call("Files/RestartBot.sh")
					quit(s)
				if "!removemod" in message:
					removedUser = addUser(message)
					removeLine("Mods.txt", removedUser)
					sendMessage(s, removedUser + " was removed from the list of mods.")
					
			#Bot Moding
			if (user not in trusted) and (user not in fileRead("Trusted.txt")) and (user not in mods) and (user not in fileRead("Mods.txt")):
				capsCount = countCaps(message)
				if (capsCount >= 10) and (capsCount <= 15):
					messagePick = [1,2]
					sentCapWarn = random.sample(messagePick)
					if sentCapWarn == 1:
						sendMessage(s,"Easy on the caps " + user)
					elif sentCapWarn == 2:
						sendMessage(s, "WHY ARE YOU SHOUTING " + user.upper())
				if (capsCount >= 15):
					sendMessage(s, "/timeout " + user + " 10")
					sendMessage(s, user + " Chill for ten seconds")
				if (capsCount >= 20):
					sendMessage(s, "/timeout " + user + " 10")
					sendMessage(s, user.upper() + "WHY ARE YOU SHOUTING SO MUCH!? ONLY MODS AND TRUSTEDS ARE ALLOWED TO!")
				if ("http" in message.lower()) or (".com" in message.lower()) or (".net" in message.lower()) or (".org" in message.lower()) or (".ly" in message.lower()) or (".do" in message.lower()) or (".gl" in message.lower()) or (".co" in message.lower()):
					if user not in tempWhitelist:
						sendMessage(s, "/timeout " + user + " 1")
						sendMessage(s, "Sorry " + user + " but no links without permission")
					elif (user in tempWhitelist):
						tempWhitelist.remove(user)
					else:
						print("WTF, how dd that happen?")
				if message.strip().lower() in fileRead("URLBlackList.txt"):
					#ask about making example.com/example get blocked when only example.com is in file
					sendMessage(s, "/timeout " + user + " 30")
					sendMessage(s, "Wooooooooo " + user + " that link is not allowed at all. This gets you a 30 second time out")
				if (message.strip().lower() in fileRead("BlackList.txt")):
					sendMessage(s, "/timeout " + user + " 30")
					sendMessage(s, "Watch it, Don't be offensive. Chill for half a minute.")
				if (message.strip().lower() in fileRead("ChestGreyList.txt")):
					sendMessage(s, "Sorry your jealous " + user + ", but....")
					quote(" secret 1", user, s)
Пример #51
0
import string
from Read import getUser, getMessage
from Socket import openSocket, sendMessage
from Initialize import joinRoom

s = openSocket()
joinRoom(s)
readbuffer = ""

while True:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)
			if "PING" in line:
				s.send(line.replace("PING", "PONG"))
				break
			user = getUser(line)
			message = getMessage(line)
			print user + " typed :" + message
			if "You Suck" in message:
				sendMessage(s, "No, you suck!")
				break
			
Пример #52
0
def checkforcommands(s,m):
	command = m[1].split(" ")[0]
	if command == "!help":
		sendMessage(s,"/w " + m[0] + " Sorry can't help you " + m[0] + "!")
Пример #53
0
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()

		for line in temp:
			print(line)
			if "PING" in line:
				s.send(line.replace("PING", "PONG"))
				break
			user = getUser(line)
			message = getMessage(line)
			print user + " typed :" + message

			#test if there is more than one result
			if(sum(pattern in message for pattern in PATT) == 1):
				sendMessage(s, "One match, Ok !")

				#debugging for the arduino / computer serial exchange
                if testSerial:
                    print "On"
                    #serial writing to the arduino, then wait.
                    ser.write(bytes(1))
                    sleep(arduinoWaitTime)
                    print "Off"
                    #serial writing to the arduino, then wait.
                    ser.write(bytes(0))
                    sleep(arduinoWaitTime)
                else:  
                        # Checks if text within the stream item is populated and issues a command to the Arduino
                    if availableArduino:
                        if (message.rstrip() == leftKey):
Пример #54
0
def textDelay(msg,delai):
	time.sleep(delai)
	for ligne in msg.split("\n"):
		sendMessage(s,ligne)
	return True
Пример #55
0
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)

			if "PING" in line:
				s.send((line.replace("PING", "PONG") + "\r\n"))
				print(line.replace("PING", "PONG"))
				break
			user = getUser(line)
			message = getMessage(line)
			print(user + " typed :" + message)
			
			if "sklive_如月" in message:
				player("8 8 3 7歐提 燒!")
				sendMessage(s, "8837歐提 燒!")
				break
			elif "!8837" in message:
				player("8 8 3 7歐提 燒!")
				break
			elif "戳8837" in message:
				player_Poi("KisaragiKai27.mp3")
				sendMessage(s, "如月:司令官ったら・・・ありがとう、好きよ。")
				break
			elif "http" in message:
				player("只是一個網址")
				break
			elif "sklive_田中" in message:
				player("幹你田中 燒!")
				break
			elif "sklive_歐提燒" in message:
Пример #56
0
			print("Twitch PING'd")
			s.send(line.replace("PING", "PONG"))
			print("Knubot PONG'd")
		else:
			print(line)
			user = getUser(line)
			message = getMessage(line)
			#commands
			if COMM == True:
				for command in commandlist:
				
					separate = command.split(" : ", 1)
					
					if CSCO == True:
						if separate[0] in message:
							sendMessage(s, separate[1])
							print("Command received and returned (" + separate[0] + ", " + separate[1] + ")")
					else:
						if separate[0].lower() in message.lower():
							sendMessage(s, separate[1])
							print("Command received and returned (" + separate[0] + ", " + separate[1] + ")")
					
			#bannable phrases
			if BANP == True:
				for phrase in phraselist:
				
					if CSBN == True:
						if phrase in message:
							sendMessage(s, "/ban " + user)
							print("User " + user + " has been banned for saying " + phrase + ".")
							sendMessage(s, BAND + " (" + user + " has been banned for saying " + phrase + ")")
def quit(s):
	sendMessage(s, "OK, I'm being pulled way, see you later!")
	sys.exit()
Пример #58
0
from Settings import bannedWords

s = openSocket()
joinRoom(s)
readbuffer = ""

while True:
		readbuffer = readbuffer + s.recv(1024)
		temp = string.split(readbuffer, "\n")
		readbuffer = temp.pop()
		
		for line in temp:
			print(line)

			user = getUser(line)
			message = getMessage(line)

			if "PING" in line:
				s.send(line.replace("PING", "PONG"))
				break

			print user + " typed :" + message

			if bannedWords in message:
				sendMessage(s, "Sorry, but you can't say that.")
				break

			if "!help" in line:
				s.send(line.replace("!help", "return_help"))
				break
Пример #59
-1
s = openSocket()
joinRoom(s)
readbuffer = ""

greeting = "hey, hi, hello, greetings"
person = "haylee, chat, friends, guys, all, everyone"
greeting = greeting.split(",")
person = person.split(",")
greeted = []
mods = []
trusted = []
wgreeted = open('Files/Greeted.txt', 'a')
tempWhitelist = []


while True:
	readbuffer = readbuffer + s.recv(1024)
        temp = string.split(readbuffer, "\n")
        readbuffer = temp.pop()
	for line in temp:
		#print("Debug: " + line)
                if "PING" in line:
                	s.send(line.replace("PING", "PONG"))
                        print(line)
                        print(line.replace("PING", "PONG"))
			sendMessage(s, "Debug: Ping found and responded too")
                        break
		user = getUser(line)
        	message = getMessage(line)
		chatCommands(readbuffer,s,message,temp,line,user,greeting,person,wgreeted,greeted,trusted,mods,tempWhitelist)