Auto Spam
Auto Spam
class AutoSpamGUI:
def __init__(self, master):
self.master = master
master.title("Auto Spam by Murad")
master.geometry("600x750")
self.style = ttk.Style(master)
self.style.theme_use("arc")
self.stop_event = threading.Event()
self.config_file = self.get_config_path()
self.load_config()
self.create_widgets()
self.spam_threads = []
def get_config_path(self):
if getattr(sys, 'frozen', False):
# Jika dijalankan sebagai executable
application_path = os.path.dirname(sys.executable)
else:
# Jika dijalankan sebagai script
application_path = os.path.dirname(os.path.abspath(__file__))
return config_path
def load_config(self):
if not os.path.exists(self.config_file):
self.config = {
"token": "",
"webhook_url": "",
"webhook_channel_id": "",
"channels": []
}
self.save_config()
else:
with open(self.config_file, 'r') as f:
self.config = json.load(f)
# Ensure all required keys exist
for key in ["channels", "token", "webhook_url", "webhook_channel_id"]:
if key not in self.config:
self.config[key] = "" if key != "channels" else []
def save_config(self):
with open(self.config_file, 'w') as f:
json.dump(self.config, f, indent=4)
def create_widgets(self):
main_frame = ttk.Frame(self.master, padding="20 20 20 20")
main_frame.grid(column=0, row=0, sticky=(tk.W, tk.E, tk.N, tk.S))
main_frame.columnconfigure(0, weight=1)
main_frame.rowconfigure(0, weight=1)
# Title
title_label = ttk.Label(main_frame, text="Auto Spam by Murad",
font=("Helvetica", 16, "bold"))
title_label.grid(column=0, row=0, sticky=tk.W, pady=10)
# Input fields
input_frame = ttk.LabelFrame(main_frame, text="Input Data", padding="10 10
10 10")
input_frame.grid(column=0, row=1, sticky=(tk.W, tk.E, tk.N, tk.S), pady=10)
input_frame.columnconfigure(0, weight=1)
# Buttons
button_frame = ttk.Frame(main_frame)
button_frame.grid(column=0, row=2, sticky=(tk.W, tk.E), pady=10)
button_frame.columnconfigure(0, weight=1)
button_frame.columnconfigure(1, weight=1)
def save_settings(self):
self.config["token"] = self.token_entry.get()
self.config["webhook_url"] = self.webhook_url_entry.get()
self.config["webhook_channel_id"] = self.webhook_channel_id_entry.get()
self.save_config()
messagebox.showinfo("Success", "Settings saved successfully")
def start_all_spam(self):
self.stop_event.clear() # Clear the stop event before starting
token = self.token_entry.get()
for channel in self.config["channels"]:
thread = threading.Thread(
target=self.spam_loop,
args=(
channel["channel_id"],
channel["message"],
token,
channel["delay"],
channel.get("ping_user")
)
)
self.spam_threads.append(thread)
thread.start()
messagebox.showinfo("Started", "Spam threads have been started for all
channels")
def stop_spam(self):
self.stop_event.set()
for thread in self.spam_threads:
thread.join()
self.spam_threads.clear()
messagebox.showinfo("Stopped", "All spam threads have been stopped")
embed = {
"title": "AUTO POST LOG",
"color": 0x00ff00 if success else 0xff0000,
"fields": [
{"name": "📺 Channel", "value": f"<#{channel_id}>", "inline": True},
{"name": "💌 Status", "value": "SENT SUCCESSFULLY" if success else
"FAILED TO SEND", "inline": True},
{"name": "📝 Message", "value": message[:1024], "inline": False},
{"name": " Delay", "value": f"{delay} seconds", "inline": True}
]
}
payload = {
"embeds": [embed]
}
try:
response = requests.post(webhook_url, json=payload, timeout=10)
response.raise_for_status()
print("Webhook sent successfully")
except requests.exceptions.RequestException as e:
print(f"Failed to send webhook: {str(e)}")
def add_config(self):
channel_id = self.channel_id_entry.get()
message = self.message_text.get("1.0", tk.END).strip()
delay = self.delay_entry.get()
ping_user = self.ping_user_entry.get()
try:
delay = int(delay)
except ValueError:
messagebox.showerror("Error", "Delay must be a number")
return
new_config = {
"channel_id": channel_id,
"message": message,
"delay": delay,
"is_dm": False,
"ping_user": ping_user
}
self.config["channels"].append(new_config)
self.save_config()
messagebox.showinfo("Success", "Configuration added successfully")
delete_window = tk.Toplevel(self.master)
delete_window.title("Delete Configuration")
delete_window.geometry("400x300")
def delete_selected():
selection = listbox.curselection()
if not selection:
messagebox.showerror("Error", "Select a configuration to delete")
return
idx = selection[0]
del self.config["channels"][idx]
self.save_config()
messagebox.showinfo("Success", "Configuration deleted successfully")
delete_window.destroy()
def main():
root = ThemedTk(theme="arc")
gui = AutoSpamGUI(root)
root.mainloop()
if __name__ == "__main__":
main()