API Reference

Learn about plugin packets, generated C++ code structure, and how plugins communicate with GameCord.

Plugin Packet Structure

How it works: Each plugin you install generates a C++ header file (.h) with a packet class. You create instances of this packet, fill in the fields, and send it using your network manager.

Example: SystemNotification Plugin

This plugin sends rich Discord embeds. You configure the channel ID and embed template in the dashboard, then use the generated packet in your code.

// Generated header: Packets/SystemNotification.h
#include <Packets/SystemNotification.h>
// Create packet (pass values in constructor)
auto notif = std::make_shared<packet::SystemNotification>(
"Event Started!", // title
"The weekly raid is now live!", // description
0x00ff00, // color (green)
"https://example.com/event.png" // imageUrl
);
network::ClientManager::sendData(notif);

✅ Result: A beautiful Discord embed appears in your configured channel with the title, description, color, and image you specified.

Common Packet Fields

Depending on the plugin and your configuration, packets may have these fields:

m_title
std::string - Title for Discord embed
m_description
std::string - Main message content
m_color
int - Embed color in hex (e.g., 0xFF5733)
m_imageUrl
std::string - Image URL for embed
m_thumbnailUrl
std::string - Small thumbnail URL
m_footerText
std::string - Footer text (optional)

Analytics Plugins

Some plugins track data for analytics dashboards instead of sending Discord messages. These are configured as "Analytics Only" in the shop.

// Example: Player Kill Analytics
#include <Packets/PlayerKill.h>
auto kill = std::make_shared<packet::PlayerKill>(
pUser->GetId(), // playerId
pMover->GetId(), // targetId
pMover->GetName(), // targetName
pMover->GetLevel() // targetLevel
);
network::ClientManager::sendData(kill);

Tip: You can enable "Also send to Discord" in plugin settings to send analytics data to both the dashboard AND a Discord channel.

Plugin Builder (Advanced)

Custom Plugins: You can create your own plugins using the visual builder in your dashboard. Define packet fields, configure Discord embeds or analytics, and GameCord generates the C++ code automatically.

Creating a Custom Plugin

Navigate to Dashboard → Plugin Builder to create plugins tailored to your game's specific needs.

1. Define Fields
Add packet fields (title, description, player ID, item ID, etc.)
2. Configure Output
Choose Discord embed (with placeholders) or analytics tracking
3. Generate Code
GameCord generates the C++ header with your configuration baked in
4. Use in Game Server
Download the header and use it like any other plugin

Discord Commands (Premium)

Interactive Discord Slash Commands

Create Discord slash commands that interact with your game server. For example, /link to link a Discord account to a game account.

// Example: Link Account Command handler (in game server)
#include <Commands/LinkAccountCommand.h>
// Command is triggered from Discord
void LinkAccountCommand::handle() {
// Access Discord user data
std::string discordId = getOption<std::string>("user");
std::string token = getOption<std::string>("token");
// Link in database...
linkAccount(discordId, token);
// Send response back to Discord
sendSuccess("Account linked successfully!");
}

Premium Feature: Discord command plugins require the Pro plan or higher.

Technical Details

Communication

  • WebSocket - Real-time bidirectional communication
  • SSL/TLS - Encrypted connections (port 443)
  • Auto-reconnect - Handles network interruptions
  • Async processing - Non-blocking game server

Generated Code

  • Jinja2 templates - Python-based code generation
  • msgpack serialization - Efficient binary format
  • Packet batching - Optimized network usage
  • Header-only - No .lib files needed

Need Help?