├── README.md ├── pom.xml ├── screenshot.png └── src └── main ├── java └── me │ └── rowin │ └── clicker │ └── Clicker.java └── resources └── META-INF └── MANIFEST.MF /README.md: -------------------------------------------------------------------------------- 1 | # Discord Auto Clicker 2 | 3 | As seen in [Headed's video](https://www.youtube.com/watch?v=7QdQivv_gzU). 4 | 5 | ![Screenshot](https://raw.githubusercontent.com/GitRowin/discord-auto-clicker/master/screenshot.png) 6 | 7 | ## Flaws 8 | * The auto clicker is easily detected client-side because of JNativeHook. 9 | * The randomization is mediocre, it probably won't get you auto banned though. 10 | 11 | These flaws will not be fixed, this project is mainly for demo purposes. 12 | 13 | ## How to compile 14 | 15 | To compile the auto clicker, you need Git and Maven. 16 | 17 | 1. Download the project using `git clone https://github.com/GitRowin/discord-auto-clicker.git` 18 | 2. Modify the constants `TOKEN`, `GUILD_ID`, and `CHANNEL_ID` in Clicker.java 19 | 3. Compile using `mvn clean install` -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | me.rowin 8 | clicker 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 8 13 | 8 14 | UTF-8 15 | 16 | 17 | 18 | 19 | dv8tion 20 | m2-dv8tion 21 | https://m2.dv8tion.net/releases 22 | 23 | 24 | 25 | 26 | 27 | com.1stleg 28 | jnativehook 29 | 2.1.0 30 | 31 | 32 | net.dv8tion 33 | JDA 34 | 4.2.1_265 35 | 36 | 37 | club.minnced 38 | opus-java 39 | 40 | 41 | 42 | 43 | 44 | 45 | clean compile assembly:single 46 | 47 | 48 | maven-assembly-plugin 49 | 50 | 51 | src/main/resources/META-INF/MANIFEST.MF 52 | 53 | 54 | jar-with-dependencies 55 | 56 | ${project.name} 57 | false 58 | 59 | 60 | 61 | make-assembly 62 | package 63 | 64 | single 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitRowin/discord-auto-clicker/f928356efdebc3f6cbe551ec699e35ec99ad1bb9/screenshot.png -------------------------------------------------------------------------------- /src/main/java/me/rowin/clicker/Clicker.java: -------------------------------------------------------------------------------- 1 | package me.rowin.clicker; 2 | 3 | import net.dv8tion.jda.api.EmbedBuilder; 4 | import net.dv8tion.jda.api.JDA; 5 | import net.dv8tion.jda.api.JDABuilder; 6 | import net.dv8tion.jda.api.entities.*; 7 | import net.dv8tion.jda.api.events.message.guild.react.GuildMessageReactionAddEvent; 8 | import net.dv8tion.jda.api.hooks.ListenerAdapter; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jnativehook.GlobalScreen; 11 | import org.jnativehook.mouse.NativeMouseEvent; 12 | import org.jnativehook.mouse.NativeMouseListener; 13 | 14 | import java.awt.*; 15 | import java.awt.event.InputEvent; 16 | import java.util.Random; 17 | import java.util.logging.Level; 18 | import java.util.logging.Logger; 19 | 20 | public class Clicker { 21 | 22 | private static final String TOKEN = "ODQ2MzU4NTcxODEzMzA2Mzc4.YKuW2A.yll8AMshaqABxBZZmYA7Cp-_Phw"; 23 | private static final String GUILD_ID = "846358951338836020"; 24 | private static final String CHANNEL_ID = "846358951838875681"; 25 | 26 | private boolean state = false; 27 | private boolean holding = false; 28 | private boolean skipNextPress = false; 29 | private boolean skipNextRelease = false; 30 | private boolean chill = false; 31 | private int cps = 12; 32 | 33 | public static void main(String[] args) throws Exception { 34 | new Clicker().start(); 35 | } 36 | 37 | private void start() throws Exception { 38 | JDA jda = JDABuilder.createDefault(TOKEN) 39 | .build() 40 | .awaitReady(); 41 | 42 | Guild guild = jda.getGuildById(GUILD_ID); 43 | 44 | if (guild == null) { 45 | System.out.println("Could not find guild with ID " + GUILD_ID); 46 | return; 47 | } 48 | 49 | TextChannel channel = guild.getTextChannelById(CHANNEL_ID); 50 | 51 | if (channel == null) { 52 | System.out.println("Could not find channel with ID " + CHANNEL_ID); 53 | return; 54 | } 55 | 56 | Message message = channel.sendMessage(buildEmbed()).complete(); 57 | message.addReaction("\uD83D\uDCA3").queue(); 58 | message.addReaction("⬆️").queue(); 59 | message.addReaction("⬇️").queue(); 60 | message.addReaction("\uD83D\uDFE2").queue(); 61 | message.addReaction("\uD83D\uDD34").queue(); 62 | 63 | jda.addEventListener(new ListenerAdapter() { 64 | @Override 65 | public void onGuildMessageReactionAdd(@NotNull GuildMessageReactionAddEvent event) { 66 | User user = event.getUser(); 67 | 68 | if (user.isBot()) return; 69 | if (event.getMessageIdLong() != message.getIdLong()) return; 70 | 71 | event.getReaction().removeReaction(user).queue(); 72 | 73 | String emoji = event.getReactionEmote().getEmoji(); 74 | 75 | switch (emoji) { 76 | case "\uD83D\uDCA3": 77 | message.delete().queue($ -> System.exit(0)); 78 | break; 79 | case "⬆️": 80 | cps = Math.min(20, cps + 2); 81 | message.editMessage(buildEmbed()).queue(); 82 | break; 83 | case "⬇️": 84 | cps = Math.max(6, cps - 2); 85 | message.editMessage(buildEmbed()).queue(); 86 | break; 87 | case "\uD83D\uDFE2": 88 | state = true; 89 | message.editMessage(buildEmbed()).queue(); 90 | break; 91 | case "\uD83D\uDD34": 92 | state = false; 93 | message.editMessage(buildEmbed()).queue(); 94 | break; 95 | } 96 | } 97 | }); 98 | 99 | // Disable annoying JNativeHook logging 100 | Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName()); 101 | logger.setLevel(Level.WARNING); 102 | logger.setUseParentHandlers(false); 103 | 104 | GlobalScreen.registerNativeHook(); 105 | 106 | GlobalScreen.addNativeMouseListener(new NativeMouseListener() { 107 | @Override 108 | public void nativeMouseClicked(NativeMouseEvent event) { 109 | // Unused 110 | } 111 | 112 | @Override 113 | public void nativeMousePressed(NativeMouseEvent event) { 114 | if (event.getButton() == NativeMouseEvent.BUTTON1) { 115 | if (skipNextPress) { 116 | skipNextPress = false; 117 | } else { 118 | holding = true; 119 | chill = true; 120 | } 121 | } 122 | } 123 | 124 | @Override 125 | public void nativeMouseReleased(NativeMouseEvent event) { 126 | if (event.getButton() == NativeMouseEvent.BUTTON1) { 127 | if (skipNextRelease) { 128 | skipNextRelease = false; 129 | } else { 130 | holding = false; 131 | } 132 | } 133 | } 134 | }); 135 | 136 | Robot robot = new Robot(); 137 | Random random = new Random(); 138 | 139 | //noinspection InfiniteLoopStatement 140 | while (true) { 141 | if (state && holding) { 142 | if (!chill) { 143 | skipNextPress = true; 144 | robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); 145 | } 146 | 147 | long ms = (long) (1000 / (cps - random.nextDouble())); 148 | 149 | if (random.nextInt(10) == 0) { 150 | ms += 20 + random.nextInt(20); 151 | } 152 | 153 | if (random.nextInt(20) == 0) { 154 | ms += 50 + random.nextInt(50); 155 | } 156 | 157 | //noinspection BusyWait 158 | Thread.sleep(ms / 2); 159 | 160 | if (!chill) { 161 | skipNextRelease = true; 162 | robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); 163 | } 164 | 165 | //noinspection BusyWait 166 | Thread.sleep(ms / 2); 167 | 168 | chill = false; 169 | } 170 | 171 | //noinspection BusyWait 172 | Thread.sleep(1); 173 | } 174 | } 175 | 176 | private MessageEmbed buildEmbed() { 177 | return new EmbedBuilder() 178 | .setColor(Color.MAGENTA) 179 | .setDescription("Press \uD83D\uDCA3 to exit the auto clicker\n" 180 | + "Press ⬆️️ to increase your CPS️\n" 181 | + "Press ⬇️ to decrease your CPS\n" 182 | + "Press \uD83D\uDFE2 to enable the auto clicker\n" 183 | + "Press \uD83D\uDD34 to disable the auto clicker\n" 184 | + "\n" 185 | + "Enabled: " + (state ? "\uD83D\uDFE2" : "\uD83D\uDD34") + "\n" 186 | + "CPS: " + cps) 187 | .build(); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Main-Class: me.rowin.clicker.Clicker 2 | --------------------------------------------------------------------------------