Tuesday, 05 April 2022
  6 Replies
  1.6K Visits
  Subscribe
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?
2 years ago
·
#963
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
·
#964
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
·
#965
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
·
#966
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
·
#967
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
·
#968
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.
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf,pas,dfm,dpr,dproj,dpk
· Insert · Remove
  Upload Files (Maximum 10MB)