44import os
55from concurrent .futures import ThreadPoolExecutor
66
7+ repeat_count = 0 # Don't change!
8+
79def send_file (token , channel_url , file_path ):
810 url = channel_url
911 files = {"file" : open (file_path , "rb" )}
@@ -19,66 +21,73 @@ def send_message(token, channel_url, message):
1921def get_files_in_folder (folder_path ):
2022 return [f for f in os .listdir (folder_path ) if os .path .isfile (os .path .join (folder_path , f ))]
2123
22- def get_user_messages ():
23- messages = []
24- while True :
25- user_input = input ("Enter your message (or press Enter twice to finish adding your message): " )
26- if not user_input :
27- break
28- messages .append (user_input )
29- return messages
30-
31- def get_user_channels ():
32- channels = []
24+ def get_user_input (prompt , exit_condition ):
25+ user_input_list = []
3326 while True :
34- user_input = input ("Enter channel URL (or press Enter twice to finish adding channels): " )
27+ user_input = input (prompt )
3528 if not user_input :
3629 break
37- channels .append (user_input )
38- return channels
39-
40- def send_messages_in_parallel (token , user_channels , message ):
41- with ThreadPoolExecutor () as executor :
42- executor .map (lambda channel : send_message (token , channel , message ), user_channels )
30+ user_input_list .append (user_input )
31+ return user_input_list
4332
44- def send_files_in_parallel (token , user_channels , image_path ):
33+ def send_messages_in_parallel (token , user_channels , content_list , is_file = False , folder_path = None ):
34+ global repeat_count
4535 with ThreadPoolExecutor () as executor :
46- executor .map (lambda channel : send_file (token , channel , image_path ), user_channels )
36+ for i in range (repeat_count ):
37+ if is_file :
38+ files = get_files_in_folder (folder_path )
39+ if files :
40+ file_path = os .path .join (folder_path , random .choice (files ))
41+ executor .submit (send_file , token , random .choice (user_channels ), file_path )
42+ else :
43+ message = random .choice (content_list )
44+ executor .submit (send_message , token , random .choice (user_channels ), message )
4745
4846def main ():
47+ global repeat_count
4948 # Add your user token and channels directly in the code
5049 token = "YOUR_USER_TOKEN"
5150 user_channels = [
52- "https://discord.com/api/v9/channels/YOUR_CHANNEL_ID_1/messages" ,
53- "https://discord.com/api/v9/channels/YOUR_CHANNEL_ID_2/messages"
51+ "https://discord.com/api/v9/channels/CHANNEL_ID/messages"
5452 # Add more channel URLs as needed
5553 ]
5654
57- repeat_count = 30
58- image_folder_path = r"resources/images" # Replace with your folder path
55+ repeat_count = int (input ("Enter the number of messages/images to send: " ))
5956
60- print ("Add your own messages. Press Enter twice to finish adding." )
61- user_messages = get_user_messages ()
57+ print ("Choose an option:" )
58+ print ("1. Only use text messages" )
59+ print ("2. Only use images" )
60+ choice = input ("Enter your choice (1 or 2): " )
6261
63- while True :
64- for i in range (repeat_count ):
65- if random .choice ([True , False ]): # Randomly choose whether to send a message or an image
66- message = random .choice (user_messages )
67- send_messages_in_parallel (token , user_channels , message )
68- else :
69- images = get_files_in_folder (image_folder_path )
70- if images :
71- image_path = os .path .join (image_folder_path , random .choice (images ))
72- send_files_in_parallel (token , user_channels , image_path )
62+ if choice == '1' :
63+ user_messages = get_user_input ("Enter your message (or press Enter twice to finish adding your message): " , "" )
7364
74- # time.sleep(1) <-- uncomment to change the time between sending each message, ex: time.sleep(5)
65+ while True :
66+ send_messages_in_parallel (token , user_channels , user_messages )
67+ print (f"{ repeat_count } messages sent to { len (user_channels )} channels. Wait 5 seconds before resending." )
68+ time .sleep (5 )
7569
76- print (f"{ repeat_count } messages/images sent to { len (user_channels )} channels. Wait 5 seconds before resending." )
77- time .sleep (5 )
70+ user_input = input (f"Do you want to send another { repeat_count } messages? (y/n): " )
71+ if user_input .lower () != 'y' :
72+ break
7873
79- user_input = input ("Do you want to send another 30 messages/images? (y/n): " )
80- if user_input .lower () != 'y' :
81- break
74+ elif choice == '2' :
75+ image_folder_path = r"resources\images" # Replace with your folder path
76+
77+ if os .path .exists (image_folder_path ):
78+ while True :
79+ send_messages_in_parallel (token , user_channels , [], is_file = True , folder_path = image_folder_path )
80+ print (f"{ repeat_count } images sent to { len (user_channels )} channels. Wait 5 seconds before resending." )
81+ time .sleep (5 )
82+
83+ user_input = input (f"Do you want to send another { repeat_count } images? (y/n): " )
84+ if user_input .lower () != 'y' :
85+ break
86+ else :
87+ print ("Invalid folder path. Please provide a valid path." )
88+
89+ else :
90+ print ("Invalid choice. Please enter either '1' or '2'." )
8291
8392if __name__ == "__main__" :
8493 main ()
0 commit comments