D++ (DPP)
C++ Discord API Bot Library
Creating a Discord Bot in Replit
Warning
Be aware, Replit changes frequently, meaning DPP may not always work. It is out of our control and you simply have to hope that they change it again. If this is an inconvenience, we recommend you obtain some affordable non-free hosting.
Note
There is a premade repl, ready for use, which was built using the steps below. If you wish to use this repl simply visit this GitHub repository and click the "Run on Replit" button. Then, follow the steps in the README file.

To build a D++ bot in a Replit instance, follow these steps. These steps are slightly more convoluted than installing D++ into a standard container as we don't have access to root in the conventional way or write access to any files outside of our home directory in a repl. This guide sidesteps the issue by locally extracting a libdpp deb file installer, and referencing the local dependencies from the command-line.

  1. Use wget, or the upload button, to get the precompiled x64 release into your repl as a file, e.g. wget -O libdpp.deb https://dl.dpp.dev/latest,
  2. Extract this deb file using dpkg:
    dpkg -x libdpp.deb .
  3. Compile your bot, note that you should be sure to include the pthread library explicitly and reference the extracted dpp installation you just put into the repl:
    g++ -o bot main.cpp -ldpp -lpthread -L./usr/lib -I./usr/include -std=c++17
  4. Run your bot! Note that you will need to set LD_PRELOAD to reference libdpp.so as it will be located in $HOME and not /usr/lib:
    LD_PRELOAD=./usr/lib/libdpp.so ./bot

Now that your bot is running, you have to keep it online. Replit automatically puts repls to sleep after some time, so you will need to ping a webserver. Unfortunately, Replit is sometimes limiting, and this is one of the only free workarounds to this issue.

  1. Start a http server. This can be through any webserver, but as a simple solution, use python's built in http.server:
    python3 -m http.server
  2. Create an index.html file with anything inside it for the server to serve.
  3. Go to uptimerobot.com and create an account if you don't have one.
  4. After verifying your account, click "Add New Monitor".
  • For Monitor Type, select "HTTP(s)"
  • In Friendly Name, put the name of your bot
  • For your URL, copy the URL of the new website that repl is serving for you
  • Select any alert contacts you want, then click "Create Monitor"

Here is an example of a possible uptimerobot configuration:

Troubleshooting

  • If the bot fails to start and instead you receive an error message about being banned from the Discord API, there is little to be done about this. These bans are temporary but because Replit is a shared platform, you share an IP address with many thousands of bots, some abusive and some badly written. This will happen often and is outside of the control of yourself and us. However, you can try to mitigate this by typing kill 1 in the shell. This is not guaranteed to work, and you might need to try it a few times. If it still does not work, then we recommend you obtain some affordable non-free hosting instead.
  • If your bot continues to fall asleep even though you have a server, we advise you to double check that no errors are happening, and if the server is being pinged. If that still does not work then, again, we recommend you obtain some affordable non-free hosting.
D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0