Advertisement
Noctaliuz

Untitled

Jun 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.29 KB | None | 0 0
  1. import string
  2. from Read import getUser, getMessage
  3. from Socket import openSocket, sendMessage
  4. from Initialize import joinRoom
  5. import time
  6. import random
  7. from datetime import datetime
  8. import re
  9.  
  10.  
  11.  
  12. s = openSocket()
  13. joinRoom(s)
  14. readbuffer = ""
  15.  
  16. # random emotes
  17. emotes = [" Kappa", " Keepo", " BrokeBack", " TriHard", " BabyRage", " CoolCat", " FreakinStinkin"]
  18.  
  19. # List of commands
  20. commands = ["!judnas", "!abe", "!alsoa", "!games", "!request", "!games", "!salmoncum", "!adhd", "!spam", "!salute"]
  21.  
  22. while True:
  23.     readbuffer = readbuffer + s.recv(1024)
  24.     temp = string.split(readbuffer, "\n")
  25.     readbuffer = temp.pop()
  26.  
  27.     for line in temp:
  28.         print(line)
  29.         if "PING" in line:
  30.             s.send(line.replace("PING", "PONG"))
  31.             break
  32.         user = getUser(line)
  33.         message = getMessage(line).strip()
  34.         print user + " typed :" + message
  35.  
  36.         # Commands
  37.         if message.startswith("!commands"):
  38.             sendMessage(s, "The following commands are available for this channel : " + (", ".join(commands)))
  39.             break
  40.         # Abe
  41.         if message.startswith("!abe"):
  42.             sendMessage(s, "No, " + user + " you abe! StinkyCheese")
  43.             break
  44.  
  45.         # Judnas
  46.         if message.startswith("!judnas"):
  47.             sendMessage(s,
  48.                         "Wow " + user + " I see you want something sexy, please follow this sweet gay @ https://www.twitch.tv/judnas")
  49.             break
  50.  
  51.         # Alsoa
  52.         if message.startswith("!alsoa"):
  53.             sendMessage(s, user + " just gave AlsoaTV a shoutout 4Head Catch him at https://www.twitch.tv/alsoatv")
  54.             break
  55.  
  56.         # Games
  57.         games = ["Rimworld", "Prison Architect", "My Summer Car", "Genital Jousting", "Factorio",
  58.                  "AND sometimes I will be programming in the future. Feel free to !request one of these games"]
  59.  
  60.         if message.startswith("!games"):
  61.             sendMessage(s, user + " here is a list of games I play on stream, updated 22/06-18 " + (
  62.             ", ".join(games) + random.choice(emotes)))
  63.             break
  64.  
  65.         # Request
  66.         if message.startswith("!request"):
  67.             req = message.lstrip("!request").strip()
  68.             # Check if anything after request
  69.             if req != "":
  70.                 sendMessage(s, "@Noctaliuz " + user + " requested " + req + random.choice(emotes))
  71.             break
  72.  
  73.         # Salmoncum
  74.         if message.startswith("!salmoncum"):
  75.             print("Calculating aids! MrDestructoid")
  76.  
  77.             random.seed("{0}-{1}".format(user, datetime.now().hour))
  78.             percent = random.randrange(0, 100)
  79.  
  80.             resp = "{0} has {1}% salmon cum in the mouth! SabaPing https://bit.ly/2ttps5H".format(user, percent)
  81.  
  82.             # Printing aids message
  83.             print(resp)
  84.  
  85.             sendMessage(s, resp)
  86.             break
  87.  
  88.         # ADHD
  89.         if message.startswith("!adhd"):
  90.             print("Calculating aids! MrDestructoid")
  91.  
  92.             random.seed(
  93.                 "{0}/{1}/{2}-{3}:{4} - {5}".format(datetime.now().year, datetime.now().month, datetime.now().date,
  94.                                                    datetime.now().hour, datetime.now().minute, user))
  95.             percent = random.randrange(0, 100)
  96.  
  97.             resp = "{0} has {1}% ADHD TheThing".format(user, percent)
  98.  
  99.             # Printing aids message
  100.             print(resp)
  101.  
  102.             sendMessage(s, resp)
  103.             break
  104.  
  105.         # SPAM
  106.         if message.startswith("!spam"):
  107.  
  108.             message = message.lstrip("!spam").strip()
  109.             found = re.search("({0})\s([0-9])".format("|".join(emotes)), message)
  110.  
  111.             if (found):
  112.                 tmpEmote, tmpCount = found.groups()
  113.  
  114.                 print("Found {0} x {1}".format(tmpEmote, tmpCount))
  115.  
  116.                 tmpCount = int(tmpCount)
  117.  
  118.                 # If number of times is over 1 and under 100
  119.                 if (tmpCount >= 1 and tmpCount <= 100):
  120.                     resp = [tmpEmote] * tmpCount
  121.                 print(resp)
  122.                 sendMessage(s, " ".join(resp))
  123.  
  124.             else:
  125.                 print("NO MATCH FOR SPAM! BabyRage")
  126.  
  127.             break
  128.  
  129.         # Salute
  130.         if message.startswith("!salute"):
  131.             sendMessage(s, "Kappa 7")
  132.             break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement