• Resolved zoomah

    (@zoomah)


    Hello.. just stumbled over your nice plugin. While it works perfect to send Just text to Discord, i’d like to send the content of the textbox as is. That way i could even send a webhook embed.

    It would also be good if group mentions in the form “<@&\d+>” would actually arrive Discord unescaped.

    I’d also request %post_content% which should be cut to 2048 chars.

    I would do it myself but i really just started with WordPress and have no idea where to start :(. Hope you can help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    Hi @zoomah,
    I’m not sure I can fully help you here.

    While it works perfect to send Just text to Discord, i’d like to send the content of the textbox as is.

    Tha’s exactly what the plugin does. If you define a custom message format in the Settings it sends it as is without escaping anything. The escape is done by Discord.

    I’d also request %post_content% which should be cut to 2048 chars.

    You can do this with the filter wp_discord_post_post_content. Something like this in your functions.php file would work:

    
    add_filter( 'wp_discord_post_post_content', 'wp_discord_post_content_length' );
    function wp_discord_post_content_length( $content ) {
      if ( strlen( $content ) > 2048 ) {
        $content = substr( $content, 0, 2048 );
      }
    
      return $content;
    }
    
    • This reply was modified 6 years, 5 months ago by Nico.
    Thread Starter zoomah

    (@zoomah)

    I’ll look into it… The escapes for the mention come from a lot of html_escapes in your code, tho… might bring out my php skills and change it directly … hum

    because if i try to send <@&453685191131660290> it arrives like this: https://i.imgur.com/L4k3Uko.png and thats not recogniced as group-mention by discord.

    And thanks for explaining how to set up the filter thingy… just need to find out how to add more tags tho… is there a documentation about that $post that goes into the function? ??

    • This reply was modified 6 years, 5 months ago by zoomah.
    • This reply was modified 6 years, 5 months ago by zoomah.
    • This reply was modified 6 years, 5 months ago by zoomah.
    Thread Starter zoomah

    (@zoomah)

    I made a personal copy and changed a few things. Works like a charm now AND i can drop embeds into the chat ??

    Plugin Author Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    Awesome! Would you mind sharing your changes for others to benefit too?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Raw JSON Payload and’ is closed to new replies.