billowy-insurance-37669
12/07/2022, 6:27 AMworried-lighter-82731
12/07/2022, 6:36 AMDCC_Message(channel_id, "My message");, it returns an ID which represents the "Message ID". Discord uses message ID's to do actions on, because it is not very efficient to search for entire messages every time you want to change them.
So, you can for example save that message ID somewhere. For this easy example, a variable should do:
c
msg_id = DCC_SendMessage(channel_id, "This is my message");
Then, later on, you use DCC_EditMessage to accomplish your goal:
c
DCC_EditMessage(msg_id, "The new text you want to have in your message");
//----------------^^
Notes:
Your discord bot need permission to edit these messages.billowy-insurance-37669
12/07/2022, 3:44 PMcs
#include <a_samp>
#include <discord-connector>
#include <discord-command>
#define DCC_CHANNEL_TEST ("1046909425392291950")
new DCC_Channel:channel_test = DCC_INVALID_CHANNEL;
new msg_id;
main(){}
public OnGameModeInit()
{
channel_test = DCC_FindChannelById(DCC_CHANNEL_TEST);
msg_id = DCC_SendChannelMessage(channel_test, "My message!");
return 1;
}
DCMD:edit(user, channel, params[])
{
DCC_EditMessage(DCC_Message:msg_id, "New message");
return 1;
}worried-lighter-82731
12/07/2022, 3:56 PMnew msg_id and it is tagged inside the DCC_EditMessage?
change to:
new DCC_Message:msg_id;
and
DCC_EditMessage(msg_id, "New message");future-library-96464
12/07/2022, 3:59 PMbillowy-insurance-37669
12/07/2022, 4:05 PMnew DCC_Message:msg_id;worried-lighter-82731
12/07/2022, 4:05 PMfuture-library-96464
12/07/2022, 4:07 PMworried-lighter-82731
12/07/2022, 4:08 PMbillowy-insurance-37669
12/07/2022, 4:09 PMDCC_SendChannelMessage function doesn't return the message id, just 1(true) or 0(false).
This function could be so easy, just manipulating things by the already integrated ID via Discord, but it's so difficult, there's not even an explanation on their Github.
The function says:
native DCC_EditMessage(DCC_Message:message, const content[], DCC_Embed:embed = DCC_Embed:0);
So it could be:
native DCC_EditMessage(messageid, const content[], DCC_Embed:embed = DCC_Embed:0);worried-lighter-82731
12/07/2022, 4:18 PMbillowy-insurance-37669
12/07/2022, 4:30 PMDCC_EditMessage function is new, it came in version 0.3.5, but that was 2 years ago, did the owner of discord-connector give up on the project?dazzling-translator-76954
12/07/2022, 4:35 PMdazzling-translator-76954
12/07/2022, 4:38 PMThis function could be so easy, just manipulating things by the already integrated ID via Discord
that would become a blocking call, which is why SendChannelMessage has a callback param available in which you can utilise the real message from thereworried-lighter-82731
12/07/2022, 4:38 PMdazzling-translator-76954
12/07/2022, 4:41 PMnative DCC_SendChannelMessage(DCC_Channel:channel, const message[], const callback[] = "", const format[] = "", {Float, _}:...); !dazzling-translator-76954
12/07/2022, 4:42 PMdazzling-translator-76954
12/07/2022, 4:42 PMbillowy-insurance-37669
12/07/2022, 4:48 PMbillowy-insurance-37669
12/07/2022, 5:04 PM