samp-discord-connector icon indicating copy to clipboard operation
samp-discord-connector copied to clipboard

DCC_OnMessageDelete doesn't call.

Open b4ll opened this issue 5 years ago • 5 comments

Hi, I try to operate on callback DCC_OnMessageDelete but it doesn't work.

public DCC_OnMessageDelete(DCC_Message:message)
{
	new
	 lString[128]
	;
	DCC_GetMessageContent(message, lString);
	printf("message deleted! [%d] [%s]", _:message, lString);
}

Callback isn't executed after deleting message.

b4ll avatar Dec 31 '19 17:12 b4ll

Are there any errors or warnings in the plugin log? Does your bot have enough permissions to receive message delete events in the channel you expect it to?

maddinat0r avatar Jan 05 '20 16:01 maddinat0r

I deleted a few messages, the only message I got from discord-connector.log is [01/05/20 21:28:48] [ERROR] Error while retrieving HTTP POST response from '/api/v6/channels/633370983469678593/messages': end of stream.

Does your bot have enough permissions to receive message delete events in the channel you expect it to?

I think so. He has a role which has an Administrator privilege, also I gave him manage messages privilege and still nothing. Callback DCC_OnMessageCreate works as it should, but DCC_OnMessageDelete isn't.

b4ll avatar Jan 05 '20 20:01 b4ll

Can you help me with this? I don't know what I am doing wrong.

b4ll avatar Jan 29 '20 15:01 b4ll

I'll investigate further as soon as I get some free time.

maddinat0r avatar Jan 29 '20 21:01 maddinat0r

As to why this isn't calling is because every time DCC_OnCreateMessage finishes, it deletes the message but OnDelete requires the message to stay in memory. You can use DCC_SetMessagePersistent in DCC_OnCreateMessage to keep the message in memory until they delete it. You can't do this in the current version as of yet (0.3.5) due to DCC_OnCreateMessage ignoring the value of persistence.

Alasnkz avatar Nov 20 '20 07:11 Alasnkz