Building a Discord bot using outdated C++ standards and tools

Hey everyone! I’m stuck with an old C++ project (C++98) using Visual Studio 2013 and platform toolset v120. I really want to add a Discord bot to it but I’m having trouble finding a library that works.

I’ve looked at Sleepy-Discord, DPP, and Discord.CPP, but they don’t seem to play nice with my setup. Updating the whole project isn’t an option because it’s huge.

Does anyone know a way to make this work? I’m open to:

  • Finding a Discord library that’s compatible with my old setup
  • Figuring out how to modify a newer library to work with C++98
  • Directly interacting with the Discord API somehow
  • Any other creative solutions

I’m pretty desperate at this point, so I’ll take any ideas you’ve got. Thanks for your help!

Have you considered using a C binding for a Discord library? Some Discord libraries offer C APIs which might be more compatible with your older C++ setup. You could potentially wrap these C functions in C++ code to integrate with your project.

Alternatively, you could implement a basic HTTP client using WinInet or WinHTTP, which should be available in your VS2013 environment. This would allow you to make direct REST calls to the Discord API. It’s more work, but gives you fine-grained control and avoids dependency issues.

If those don’t pan out, you might look into using a plugin architecture. Create a separate plugin in modern C++ that handles Discord interactions, then develop a simple interface in your main project to communicate with this plugin. This keeps your core project intact while allowing for newer features.

oof, that’s a tough spot. have u tried using a separate modern c++ project for the discord bot and communicating with ur main project thru files or sockets? might be easier than forcing new libs to work with old stuff. just a thought, gl with it!

I’ve been in a similar situation before, and it’s definitely a challenge. One approach that worked for me was creating a simple REST API wrapper for the Discord API using libraries compatible with your older C++ setup. You could use something like libcurl for HTTP requests and a basic JSON parser like JsonCpp.

This way, you’d be implementing the Discord bot functionality directly in your project without relying on modern Discord libraries. It’s more work upfront, but it gives you full control and compatibility. You’d need to handle authentication, rate limiting, and webhook management yourself, but it’s doable.

Another option is to write a small intermediary program in a modern language that interfaces with Discord, and then communicate with your main C++ project via inter-process communication or a simple socket connection. This keeps your legacy codebase untouched while still adding Discord functionality.

Both approaches have their pros and cons, but they might be worth exploring given your constraints.