Discord Gateway API
Build Discord bots with real-time event handling — receive messages, manage guilds, and interact with users from Delphi.
Build Discord bots with real-time event handling — receive messages, manage guilds, and interact with users from Delphi.
Connect to Discord's Gateway WebSocket API for real-time bot interactions and server management.
The sgcWebSockets Discord component implements the Discord Gateway protocol, handling authentication, heartbeats, reconnection, and resume automatically. Receive real-time events for messages, reactions, member updates, and more. Combined with the Discord REST API, build fully featured Discord bots in Delphi.
Connect a bot to Discord and respond to messages.
uses
sgcHTTP_API_Discord;
var
Discord: TsgcHTTPAPI_Discord;
procedure TForm1.FormCreate(Sender: TObject);
begin
Discord := TsgcHTTPAPI_Discord.Create(nil);
Discord.DiscordOptions.BotToken := 'your-bot-token';
Discord.OnDiscordMessage := OnMessage;
Discord.Connect;
end;
procedure TForm1.OnMessage(Sender: TObject;
aChannelId, aAuthor, aContent: string);
begin
if aContent = '!ping' then
Discord.SendMessage(aChannelId, 'Pong!');
end;
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.