Advertisement
Guest User

Discord Text Manipulation

a guest
Jan 24th, 2020
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.46 KB | None | 0 0
  1. import os
  2. import sys
  3. import pyperclip
  4. import colorama
  5. import webbrowser
  6. import time
  7. from colorama import Fore, Back, Style
  8. colorama.init()
  9.  
  10. TITLE = Style.BRIGHT + Fore.GREEN + "Discord text manipulation suite, by REED 1/23/2020 \nPress ! to back out of selection\n1.Regional Indicator Text\n2.Spoil All Characters\n3.ASCII Formatter\n" + Style.RESET_ALL
  11. print(TITLE)
  12.  
  13. def printText():
  14.     strang = Style.BRIGHT + Fore.GREEN + "1.Big text\n2.Spoil All Characters\n3.ASCII Formatter" + Style.RESET_ALL
  15.     print(strang)
  16.    
  17. def regional():
  18.        
  19.     alphabet = "a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")
  20.  
  21.     numbers = {
  22.         "1":":one:",
  23.         "2":":two:",
  24.         "3":":three:",
  25.         "4":":four:",
  26.         "5":":five:",
  27.         "6":":six:",
  28.         "7":":seven:",
  29.         "8":":eight:",
  30.         "9":":nine:"}
  31.  
  32.     words = "one two three four five six seven eight nine".split()
  33.     finString = []
  34.     finVal = ""
  35.  
  36.     while True:
  37.         TITLE = Style.BRIGHT + Fore.GREEN + "Enter text to make big" + Style.RESET_ALL
  38.         print(TITLE)
  39.         userIn = input("").lower()
  40.         if userIn == "!":
  41.             printText()
  42.             break
  43.         for character in userIn:
  44.             if character in alphabet:
  45.                 finString.append(":regional_indicator_{0}: ".format(character))
  46.             if character in numbers:
  47.                 i = numbers[character]
  48.                 finString.append(i)
  49.             if character == " " or character == ",":
  50.                 finString.append(":black_large_square: ")
  51.             if character == "!":
  52.                 finString.append(":exclamation: ")
  53.             if character == "?":
  54.                 finString.append(":question: ")
  55.             if character == ".":
  56.                 finString.append(":black_large_square: :black_large_square: :black_large_square: ")
  57.                
  58.         finVal = finVal.join(finString)
  59.         if len(finVal) > 2000:
  60.             overBy = len(finVal) - 2000
  61.             print("Message is {0} characters long, {1} over discord's 2000 character limit. Try again".format(str(len(finVal)), overBy))
  62.             del finString[:]
  63.             finVal = ""
  64.             pass
  65.         else:
  66.             os.system("echo %s | clip" %finVal)
  67.             TITLE = Style.BRIGHT + Fore.YELLOW + "Copied to clipboard!" + Style.RESET_ALL
  68.             print(TITLE)
  69.             del finString[:]
  70.             finVal = ""
  71.  
  72. def spoil():
  73.     stringResult = []
  74.     while True:
  75.         TITLE = Style.BRIGHT + Fore.GREEN + "Enter text to spoil" + Style.RESET_ALL
  76.         print(TITLE)
  77.         userIn = input("".lower())
  78.        
  79.         if userIn == "!":
  80.             printText()
  81.             break
  82.        
  83.         for character in userIn:
  84.             character = "||" + character + "||"
  85.             stringResult.append(character)
  86.  
  87.         pyperclip.copy("".join(stringResult))
  88.         del stringResult[:]
  89.         TITLE = Style.BRIGHT + Fore.YELLOW + "Copied to clipboard!" + Style.RESET_ALL
  90.         print(TITLE)
  91.    
  92.  
  93. def asciii():
  94.     finMsg = []
  95.     string = ""
  96.     while True:
  97.         TITLE = Style.BRIGHT + Fore.GREEN + "Paste in ascii art, hit enter to go to a new line, and enter ctrl+Z" + Style.RESET_ALL
  98.         print(TITLE)
  99.         msg = sys.stdin.readlines()
  100.        
  101.         if len(str(msg)) >= 1:
  102.             printText()
  103.             break
  104.         if len(str(msg)) >= 1999:
  105.             ERROR = Style.BRIGHT + Fore.RED + "Over 2000 characters, too large for Discord. Try Again" + Style.RESET_ALL
  106.             print(ERROR)
  107.         else:
  108.             for line in msg:
  109.                 modText = "| " + line
  110.                 finMsg.append(modText)
  111.             finMsg[0] = "```"+finMsg[0]
  112.             finMsg[-1]=finMsg[-1].strip("\n")+"```"
  113.             for line in finMsg:
  114.                 string += line
  115.             pyperclip.copy(string)
  116.  
  117.             TITLE = Style.BRIGHT + Fore.YELLOW + "Copied to clipboard!" + Style.RESET_ALL
  118.             print(TITLE)
  119.            
  120. while True: #main loop
  121.     choice = input("")
  122.    
  123.     if choice == "1":
  124.         regional()
  125.     if choice == "2":
  126.         spoil()
  127.     if choice == "3":
  128.         asciii()
  129.     if choice.lower() == "reed and luna":
  130.         HEHE = Style.BRIGHT + Fore.RED + """        @@@@@@           @@@@@@
  131.      @@@@@@@@@@       @@@@@@@@@@
  132.    @@@@@@@@@@@@@@   @@@@@@@@@@@@@@
  133.  @@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@
  134. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  135. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  136. @@@@@@@@@Best Friends Forever!@@@@@@@@@
  137. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  138. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  139.  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  140.   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  141.    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  142.      @@@@@@@@@@@@@@@@@@@@@@@@@@@
  143.        @@@@@@@@@@@@@@@@@@@@@@@
  144.          @@@@@@@@@@@@@@@@@@@
  145.            @@@@@@@@@@@@@@@
  146.              @@@@@@@@@@@
  147.                @@@@@@@
  148.                  @@@
  149.                   @
  150. """ + Style.RESET_ALL
  151.         print(Style.BRIGHT + Fore.MAGENTA + "uwu" + Style.RESET_ALL)
  152.         time.sleep(2)
  153.         print(Style.BRIGHT + Fore.MAGENTA + "I can't draw cute things, but I can hide cute easter eggs in my code!"+ Style.RESET_ALL)
  154.         time.sleep(3)
  155.         print(Style.BRIGHT + Fore.MAGENTA + "You're one awesome possum~ I'm glad you're my friend <3"+ Style.RESET_ALL)
  156.         time.sleep(3)
  157.         print(HEHE)
  158.         time.sleep(3)
  159.         webbrowser.open_new_tab("https://youtu.be/HaZpZQG2z10?t=7")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement