Page 1 of 1

Discord Notifications

Posted: Sun Nov 24, 2019 8:57 pm
by RamsesV
Dear Community,

we are using this extension from "roots": viewtopic.php?t=2490106
I know it is abondened, but I did not find an alternative yet. Since a few days, the Extension is not working anymore. I assume that Discord changed something on their webhook API - I am getting an error from Discord that we would send an empty message, which cannot be posted.

Code: Select all

�:<١�yaaaaaaaaaaaaaaaaannot send an empty message", "code": 50006}���r�6��� �����e'q.��%麳q;�����Gb�`P��͟��~F��c{���vܦv4c<������?���//�X�|��I�=��G8�F���g��&�HAS��T�C��C��W��Z�>�/�$�~�����4��E<�LC�s_���`>+�)�ބ�4R�NY��a�o_6˘f��*��M��F3�ap� �L������Z}β32�0�n��T!�*�� �HȧSP"�nʲ.���� H����^�#x�)=���p^Ck;��ѳ��p� +I!a�� sRa��(��ѬzgLw �ױH���!<��{O���7�n��DQ#��N���A@�����ov�[*ɻ"�Os:���,�w��m��qT�)�X5^�e?�6\�CqaPRF0��5S�x��5(�}�ޱ�lN��� /�"�ഐ���{�Z��O�<т���{AkXd�q+����Z+�ÖK�Nݙ˼Q_G�+lH:v�j�������U��葅��w�)$��w�\y�o@z��k�U|wY�����N�y{���7q�����H���\�֗��ːݹ��I���T갍���'����\Y(���G���Qw%��� �h��� �^C����R���X��gA������Y$�AaK���CԒD�l�S��ܰ���#G���A����X��!E�N�6�8S�����Y�����*F�_p0ͽ�a����ϻ�YrR9ê�\�S�.d�c�u�ed\��!U{�7tt��t�,�ݶ΅��t�,����Gt9d#=����k^#�cy�5�tU)-;=']9�z�Uz��0E1�&�y�������5 �4���^���Y)�@6t<Ğ�B�4;�4V��ȋܼm����ޣ���m�)�2�K�k���_����A���L�c`��v�[��2�� XzO���m��Z ]�Cֹ��+�i;*��]�D���>��3P�D��A���Slk��99�̾����\im�#��H̱���KH&LF7c6����(i���9�Ğo�4��xs�kjƁ�Q��=���1ڴC�A�6jb�6%u�q�\!��)ݦI�{D������`����<>���z������)s������ib�)����~�;έ�ꌡ�T~�1��-Rr��)�M��&��u=;eU`M#e!+��ۧ�a��́�?�5�mW-�]�G� X�x�쯦�]�����pa ?�o�Ess�� �$)0��(�<�=�7� } �lTd�ۣ�e\*�����h>����5���x=S�k(�dߒ�t�rj�r�m�����.6?�asP��)�8. o�2$�LNp#���'�M���#�{�>�x���L��Ȯ� k����,R�NS�"έ�H �b$ m��ʜY����R*M%S[�Cޜ`����FM��q���j���*��������ϼ��Ҳ��;�g��No}=�\�'7��Ì��\Wm-�֪�%Lb$}���qA�q�%wf�̲�n=�c\����;�,뙸��y#��U9�/X�Q�yx�E ��g��E�_��7"gq�]u�*��Q�k�OŎճ��V�/4�Ҍ�3��W��&����}�c�5�T&��(�R�2�GL�'��qh�� �/��C\58*;�ׁߣ����Hh6d�TᏸY&M�v�C��ı�չ�&);N=צ�eR�����L�H1d�KN�����,>z"����/.w�x3�Z}� �)nK�o�Y�|����p��8�U��.>*� ՝V�3�X����7V˵�k�����gL���4u@v6�c�j�l_�ݛe�+�A�t�m���֯2���a�-�tu��;VZ�.U�1(�s{�7~м������v�Vɾ9�%3QHR'�7���57P z�����\���*�s:��tI薻K�� �}����p��k��/�y[�ϟP�(�DHd�a� �Rj~ذK�n��_�}�`�A|�ܩW�CP&7⒓�!��:���3�L��䅹Q{{kF;$S�zB���䴺�N�ݩ�#
As per https://discordapp.com/developers/docs/ ... atus-codes:

Code: Select all

50006	Cannot send an empty message
Just asking, if someone else was running into this before and might be able to help?
I appreciate, the extension is not maintained anymore, so if there is any similar extension, I am happy to switch over and use a maintained one.

Thnaks for your help in advance
RamsesV

Re: Discord Notifications

Posted: Sun Nov 24, 2019 10:37 pm
by RamsesV
I was able to fix it. However, I am still looking for a maintained alternative ;)

Fix:
Add

Code: Select all

curl_setopt($h, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
above

Code: Select all

curl_setopt($h, CURLOPT_URL, $discord_webhook_url);
in the notification_service.php in the root of the extension folder.

Re: Discord Notifications

Posted: Wed Nov 27, 2019 8:26 am
by nou nou
Thanks for flagging this! I wouldn't even have noticed until much later (I'm suppressing error messages for obvious reasons).

I'm using the extension on 3.2.8 and I'm pretty committed to keeping it working. Happy to share any adjustments I need to make for it in the future if this turns out to be abandonware.

Your fix works fine. Perhaps make a PR for it?

https://github.com/rootslinux/phpbb-dis ... ifications