Post by Ben Goodman on Jul 26, 2020 11:52:29 GMT -8
Hello!
My proboards community is massively integrated with my discord server and I would like to allow my users to send specific post urls via the webhook, but I do not know how shall I modify the javascript so it posts the link as it supposed to.
Now it always posts the link to the last post on the page.
My proboards community is massively integrated with my discord server and I would like to allow my users to send specific post urls via the webhook, but I do not know how shall I modify the javascript so it posts the link as it supposed to.
<script>
function sendtoDiscord() {
var request = new XMLHttpRequest();
request.open("POST", "https://discordapp.com/api/webhooks/ICENSOREDMYWEBHOOKID");
request.setRequestHeader('Content-type', 'application/json');
var params = {
username: "$[post.created_by.name]",
avatar_url: "",
content: "/post/$[post.id]"
}
request.send(JSON.stringify(params));
}
</script>
<tr id="$[post.content_id]" class="$[post.content_class]{if $[post.even]} even{/if}{if $[viewing_recent_posts]} recent{/if}">
<td class="$[post.thread.first_post.unblocked_class]">
<table role="grid">
<tr>
<td class="left-panel" rowspan="2">
$[post.created_by.miniprofile]
</td>
<td class="content">
<article>
<div class="content-head ui-helper-clearfix">
<div class="info">
$[post.thread]
<span class="date">$[post.created_on]</span>
{if $[post.how_posted]}
<span class="post-method">via $[post.how_posted]</span>
{/if}
$[post.likes]
</div>
<div class="controls">
$[post.quote_button]
$[post.edit_button]
$[post.likes.button]
$[post.select_options]
<button onclick="sendtoDiscord()">Send to discord</button>
Now it always posts the link to the last post on the page.