Update spam.py

This commit is contained in:
timofey 2020-12-31 19:17:39 +03:00 committed by GitHub
parent ed0ba00787
commit f8599d9172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

405
spam.py
View File

@ -1,154 +1,285 @@
#pip install pyautogui # Discord: TiMoFey#5066
#please download last version on github # Github: https://github.com/timofey260/pyspam
#don't work on mobile' # site: https://timofey26s.tilda.ws
# import______________________________________________
import codecs
import pyautogui import pyautogui
from time import sleep # sleep block on load{wait...} from os import system # system use for clear messages
from colorama import Fore, init # for colored text from time import sleep # sleep block on load{wait...}
from os import system # system use for clear messages from colorama import Fore, init # for colored text
init(Fore) # colorama init
uns = '' #unuse str. uses for def error()
cr = (' ____________________________________________ \n'
'|-----------------Made by Timofey------------|\n'
'|Discord: TiMoFey#5066 |\n'
'|Github: https://github.com/timofey260/pyspam|\n'
'|site: https://timofey26s.tilda.ws |\n'
'|____________________________________________|\n')
err = ( ' _________________________________________________________ \n' # inits________________________________________________
'|---------------------------Errors------------------------|\n' init(Fore) # colorama init
'|1. FileError: file not found! |\n' uns = '' # unuse str. uses for def error()
'|2. NumError: {str} not a number! |\n' # colors_______________________________________________
'|3. IndexError: index out of range! |\n' rr = Fore.RED
'|4. TypeError: {str} is not 1,2 or 3! |\n' rg = Fore.GREEN
'|5. ListError: Error not found! correct def error() |\n' rc = Fore.CYAN
'|_________________________________________________________|\n') ry = Fore.YELLOW
b = ('_____ + \n' # vars_______________________________________
' | /\\ /\\ \n' x = 6
' | | / \\ / \\ \n' modes = 3
' | | / \\ / \\ \n' v = "1.2.5"
' | | / \\/ \\ \n' run = True
'========spam_programm======= \n') # menu # banners____________________________________________
print(Fore.RED + b) log = ('1.2.5:\n'
def error(num, result): # errors: easy moding '-interval added\n')
if num == 1: b = ('_____ + |||||||||||||||||| \n'
print('FileError: file not found!') ' | /\\ /\\ |||||(0)|||(0)|||| \n'
input() ' | | / \\ / \\ |||||||||||||||||| \n'
elif num == 2: ' | | / \\ / \\ ||||0\\|||||||/0||| \n'
print('NumError: %1s not a number!' %(result)) ' | | / \\/ \\ ||||\\00000000/|||| \n'
input() '========spam_programm===========|||||||||||||||||| \n') # menu
elif num == 3: cr = (rg + ' ________________________________________________ \n'
print('IndexError: index out of range!') '|-------------------Made by Timofey--------------|\n'
input() '|Discord: TiMoFey#5066 |\n'
elif num == 4: '|Github: https://github.com/timofey260/pyspam |\n'
print('TypeError: %1s is not 1,2 or 3!' %(result)) '|site: https://timofey26s.tilda.ws |\n'
input() '|________________________________________________|\n')
else: err = (rr + ' _________________________________________________________ \n'
print('ErrorError: Error not found! correct def error()') '|---------------------------Errors------------------------|\n'
input() '|1. FileError: file not found! |\n'
exit() '|2. NumError: {str} not a number! |\n'
'|3. IndexError: index out of range! |\n'
'|4. TypeError: {str} is not 1 - %1s! |\n'
'|5. ListError: Error not found! correct def error() |\n'
'|_________________________________________________________|\n' % (x))
print(Fore.YELLOW + "[" + Fore.CYAN + "1" + Fore.YELLOW + "]file") #menu buttons # deffs___________________________________________
print(Fore.YELLOW + "[" + Fore.CYAN + "2" + Fore.YELLOW + "]message") def error(value, result, ver): # errors: easy moding
print(Fore.YELLOW + "[" + Fore.CYAN + "3" + Fore.YELLOW + "]credits") if value == 1:
print(Fore.YELLOW + "[" + Fore.CYAN + "4" + Fore.YELLOW + "]Errorlist") print('FileError: %1s file not found!' % result)
print(Fore.YELLOW + "[" + Fore.CYAN + "5" + Fore.YELLOW + "]exit")
name = input('>>> ') # name: 1, 2 or 3(int)
st = 0
if name == '1':
f = input("file name: ") #f - filename(str)
print(Fore.GREEN + 'num of messages(you can use"all"): ' + Fore.RED)
sta = input() # sta - num of messages(int or str('all'))
if sta == 'all':
num = 0 # num - index of file(int)
fil = f + ".txt" # file.txt
try: # errorfind
file = open(fil, 'r', encoding = 'utf-8').readlines() # open file for 'all'
except:
error(1, uns)
filew = file
elif sta != 'all':
try: # errorfind
sta = int(sta) # sta - num of messages(int or str('all'))
except:
error(2, sta)
num = 0
fil = f + ".txt"
try: # errorfind
file = open(fil, 'r', encoding = 'utf-8').readlines() #open file for 'slice'
except:
error(1, uns)
if sta > len(file):
error(3, uns)
filew = file[:sta] #slice of file
sleep(4) # wait...
system('cls||clear') # cls
print(Fore.YELLOW + b +"\nwait. ") elif value == 2:
sleep(0.5) print('NumError: %1s not a number!' % result)
system('cls||clear')
print(Fore.YELLOW + b +"\nwait.. ") elif value == 3:
sleep(0.5) print('IndexError: index out of range!')
system('cls||clear')
print(Fore.YELLOW + b +"\nwait...") elif value == 4:
system('cls||clear') print('TypeError: %1s is not 1 - %1s!' % (result, ver))
for a in filew: # spam messages in file
print(Fore.GREEN + '%1d message send!' %(num + 1)) # print messages in screen
pyautogui.write(a)
num = num + 1
print('=====process=====') else:
print(b, '\ntimes: %1s' %(len(filew))) print('ListError: Error not found! correct def error()')
pyautogui.alert('succefuly send %2d messages!' %(len(filew))) # result input()
elif name == '2': exit()
print(Fore.RED + b)
print(Fore.GREEN + 'text: ' + Fore.RED)
g = input()
print(Fore.GREEN + 'num of messages: ' + Fore.RED)
try: # errorfind def menud(pa1, pa2):
n = int(input()) print(ry + "[" + rc + str(pa1) + ry + "] " + pa2)
except:
error(2, n)
sleep(4) # wait...
f = range(n)
system('cls||clear') # cls
print(Fore.YELLOW + b +"\nwait. ")
sleep(0.5)
system('cls||clear')
print(Fore.YELLOW + b +"\nwait.. ") def menu():
sleep(0.5) print(rr + b)
system('cls||clear') menud(1, 'mode') # menu text
menud(2, 'credits')
menud(3, 'Errorlist')
menud(4, 'exit')
menud(5, 'version')
menud(6, 'log')
import pyperclip, keyboard
print(Fore.YELLOW + b +"\nwait...") def paste(text):
system('cls||clear') pyperclip.copy(text)
keyboard.press_and_release('ctrl + v')
print('=====process=====')
print(b, '\nmessage: %1s\ntimes: %1s' %(g, n))
for i in f: # spam messages
print(Fore.GREEN + '%1d message send!' %(i + 1)) # print messages in screen
pyautogui.write(g)
pyautogui.press('enter')
pyautogui.alert('succefuly send %2d messages!' %(n)) # result # programms__________________________________________________
elif name == '3': # credits while run:
print(cr)
input()
elif name == '4': # errorlist menu()
print(err) name = input('>>> ') # name(int)
input() if name == '1':
menud(1, 'file') # menu text
menud(2, 'message')
menud(3, 'num_message')
name = input('>>> ')
if name == '1':
elif name == '5': f = input("file name: ") # f - filename(str)
exit() print(rg + 'num of messages(you can use"all"): ' + rr)
else: n = input() # n - num of messages(int or str('all'))
error(4, name) try:
inte = int(input("interval[sec]: "))
except:
error(2, inte, ver)
if n == 'all':
num = 0 # num - index of file(int)
fil = f + ".txt" # file.txt
try: # errorfind
file = codecs.open(fil, 'r', encoding='utf-8').readlines() # open file for 'all'
except:
error(1, fil, x)
filew = file
le = len(filew)
elif n != 'all':
try: # errorfind
n = int(n) # n - num of messages(int or str('all'))
except:
error(2, n, x)
num = 0
fil = f + ".txt"
try: # errorfind
file = codecs.open(fil, 'r', encoding='utf-8').readlines() # open file for 'slice'
filew = file[:n] # slice of file
except:
error(1, fil, x)
le = len(filew)
if n > len(filew):
error(3, uns, x)
elif n == "":
error(2, n, x)
sleep(4) # wait...
system('cls||clear') # cls
print(ry + b + "\nwait. ")
sleep(0.5)
system('cls||clear')
print(ry + b + "\nwait.. ")
sleep(0.5)
system('cls||clear')
print(ry + b + "\nwait...")
system('cls||clear')
for a in filew: # spam messages in file
sleep(inte)
print(rg + '%1d message send!' % (num + 1)) # print messages in screen
paste(a)
num = num + 1
pyautogui.press('enter')
print('=====process=====#file')
pyautogui.alert('succefuly send %2d messages!' % (le)) # result
elif name == '2':
print(rr + b)
print(rg + 'text: ' + rr)
g = input()
print(rg + 'num of messages(0 = inf.): ' + rr)
try:
inte = int(input("interval[sec]: "))
except:
error(2, inte, ver)
try: # errorfind
n = int(input())
except:
error(2, n, x)
sleep(4) # wait...
f = range(n)
system('cls||clear') # cls
print(ry + b + "\nwait. ")
sleep(0.5)
system('cls||clear')
print(ry + b + "\nwait.. ")
sleep(0.5)
system('cls||clear')
print(ry + b + "\nwait...")
system('cls||clear')
print('=====process=====#message')
print(b, '\nmessage: %1s\ntimes: %1s' % (g, n))
if n != 0:
for i in f: # spam messages
sleep(inte)
print(rg + '%1d message send!' % (i + 1)) # print messages in screen
paste(g)
pyautogui.press('enter')
elif n == 0:
r = True
i = 0
while r:
i = i + 1
sleep(inte)
print(rg + '%1d message send!' % (i))
paste(g)
pyautogui.press('enter')
pyautogui.alert('succefuly send %2d messages!' % n) # result
elif name == '3':
print(rr + b)
print(rg + 'prefix: ' + rr)
g = str(input())
print(rg + 'suffix: ' + rr)
su = str(input())
print(rg + 'num of messages(0 = inf.): ' + rr)
try:
inte = int(input("interval[sec]: "))
except:
error(2, inte, ver)
try: # errorfind
n = input()
n = int(n)
except:
error(2, n, x)
sleep(4) # wait...
f = range(n)
system('cls||clear') # cls
print(ry + b + "\nwait. ")
sleep(0.5)
system('cls||clear')
print(ry + b + "\nwait.. ")
sleep(0.5)
system('cls||clear')
print(ry + b + "\nwait...")
system('cls||clear')
print('=====process=====num_message')
print(b, '\nprefix: %1s\nsuffix %1s\ntimes: %1s' % (g, su, n))
if n != 0:
for i in f: # spam messages
sleep(inte)
print(rg + '%1d message send!' % (i + 1)) # print messages in screen
fo = ('%1s %1s %1s' %(g, str(i), su))
paste(g)
pyautogui.press('enter')
i = i + 1
elif n == 0:
r = True
i = 0
while r:
sleep(inte)
i = i + 1
print(rg + '%1d message send!' % (i))
fo =('%1s %1s %1s' %(g, str(i), su))
paste(g)
pyautogui.press('enter')
else:
error(4, name, modes)
elif name == '2': # credits
system('cls||clear') # cls
print(cr)
input()
elif name == '3': # errorlist
system('cls||clear') # cls
print(err)
input()
elif name == '4': # exit
run = False
elif name == '5': # exit
system('cls||clear') # cls
print(v)
input()
elif name == '6': # exit
system('cls||clear') # cls
print(log)
input()
else:
error(4, name, x)