assuming a frictionless kernel (Ubuntu Linux)
Steps:
- Setup a Docker container running Ubuntu and install Discord on it
- Setup X permissions, so the container can connect to the running X server.
- Use xdotool with a shell script to automate input events to Discord.
Let's get started.
First, since we use Ubuntu, we'll have to setup Docker. Following (and slightly modifying) the official installation instructions:
host$ sudo apt update
host$ sudo apt -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
host$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
host$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
host$ sudo apt update
host$ sudo apt -y install docker-ce docker-ce-cli containerd.io
host$ sudo systemctl enable --now docker
host$ sudo groupadd docker
host$ sudo usermod -aG docker <your username here>
Log out and log back in. Now, we are going to create our container:
host$ docker create --name discord-self-bot ubuntu
host$ docker exec -it discord-self-bot /bin/bash
Install Discord:
con# curl -L -o discord.deb "https://discordapp.com/api/download?platform=linux&format=deb"
con# dpkg -i discord.deb
con# apt -f install
Now, setup X permissions:
host$ xhost +localhost
Using xdotool with a shell script to automate input events to Discord
First, install xdotool:
host$ sudo apt -y install xdotool
We are going to be running xdotool from outside the container, so that Discord doesn't know it's running. First, open up Discord, and navigate to the desired channel to self-bot (in this example, counting up in #count):
<run _only this command_ in another terminal>
con$ discord
<navigate to the channel in discord, and focus the text field>
Then, copy and paste this into self-bot.sh
, adjusting it to fit your needs:
#!/bin/bash
NUM=1000 # or whatever
while true; do
xdotool search --name "Discord" --sync type "$NUM\n"
((NUM += 1))
sleep 400 # or whatever
done
Make it executable:
host$ chmod u+x self-bot.sh
host$ ./self-bot.sh
And there you go, you've self-botted Discord!