By Guest on Tuesday, 05 April 2022
Posted in General
Replies 6
Likes 0
Views 1.6K
Votes 0
Hello!
I downloaded a trial version of your discord components for Builder C++. There is practically no documentation. Can you give me two examples of how to change the status of the bot and send a message to the channel?
Hello,

The discord component allows to listen the websocket events and interactuate with the REST API using HTTP commands, there are some functions to send HTTP commands:

function GET_Request(const aPath: String): string;
function POST_Request(const aPath, aMessage: String): string;
function PUT_Request(const aPath, aMessage: String): string;
function PATCH_Request(const aPath, aMessage: String): string;
function DELETE_Request(const aPath: String): string;

For example, to send a message, you must build the message and send a POST

https://discord.com/developers/docs/resources/channel#create-message

Kind Regards,
Sergio
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, I saw a brief description of these functions on your site. Also there is just one small example of obtaining data.
Thanks for the link to the developer portal, unfortunately I was there too and I couldn't apply their documentation to your component. Could you make an example? I'm sure many of your users would be grateful.
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

According the sample of the documentation, this should work:


Discord.POST_Request(
'/channels/{channel.id}/messages',
'{"content": "Hello, World!", "tts": false, "embeds": [{"title": "Hello, Embed!", "description": "This is an embedded message."}]}');


Just change the {channel.id} to the correct value.

Kind Regards,
Sergio
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Sergio!
This is a good example!
Now everything is clear with the messages. I just don’t understand which way to go to change the status of the bot (json itself I have code)
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

According documentation, bots cannot update the status of the bot (Bots are only able to send name, type, and optionally url.)

https://discord.com/developers/docs/topics/gateway#activity-object

Kind Regards,
Sergio
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Sergio and Thanks/
Yes, I have seen and have been reading this resource for the third day. There are many examples (for Python JS languages). I also found your example there.
But I did not understand how to apply these examples (to change the status in the discord.) to your miracle component.
·
2 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post