I'm sure you've heard of Discord, the all-in-one voice and text chat app, and maybe you're even using it. Well did you know that it is possible to ...
For further actions, you may consider blocking this person and/or reporting abuse
This is cool! Congrats for the article!!!
Did the second part lunched?
Really nice article.
I've also made one, how to connect your Linux-Server to Discord.
It might be useful as additional information if somebody need to trigger a message from a server-process, instead out of JS.
just-sell-online-en.blogspot.com/2...
So I can just store the html file on the local machine? What would I need to add in order to tell it to execute every 2 hours? And could I run the webhook off of heroku or somewhere so that I wouldn't have to keep my PC on in order for it to work?
You could start a Node server and use a node module like this one: npmjs.com/package/discord-webhook-...
Then you could maybe use a
window.setInterval
to execute it repeatedly with an interval.Thank you!
Hello, Really cool, thanks a bounch!
it his possible to do something like this inside discord app?
I'm using Telegram and it has the cool option to let you write commands in a text message. Then the user click it and Telegram simply repeat the link content and send it to your bot.
Something like this
'Click /done when you have done.'
when you click (or tap) on /done, telegram send a message like this
/done@YourCoolBot
and your bot grab it as a regular command, like if you wrote /done yourself in the text line.
i would like to replicate the behavior on discord to or, if not possible since it seems not, at least do something like that
You mean having some programmed logic when pressing links on the message sent by the Webhook?
This is very nice and all, but I have a question:
So I made a simplistic website and I want to add a webhook notifiyer right
Basically they paste their webhook in a textbox, and when they press a button,
a message I made gets sent to the webhook they posted in the text box.
I'd like to know how to do this please, and thank you.
what html editor do you use because i kinda need one lol
vscode is very good
I use Visual Studio Code
for me personally i use repl.it, its online based, fast, and you don't need to download anything it supports multiple languages and it can be used as a website hoster.
Glitch is much better in my personal opinion
I need to embed telegram post via this method to my discord channel. How to do it.
The embed code looks like this
<script async src="https://telegram.org/js/telegram-widget.js?19" data-telegram-post="codewithdila/2" data-width="100%"></script>
How do i make it send the content that was in the text box of a html page
like an discord webhook sender
Set the content field to the value of your input:
i did it like that but this is dont working please help me bro
<br> function sendMessage() {<br> const request = new XMLHttpRequest();<br> request.open("POST", "<a href="https://discord.com/api/webhooks/921856294481186857/cJd-f85MqKVdLyFotaxZf7yzWH-ILK3VGPL1H7W2IX7UsQwIs0yDEap7cG4oF18uE4K0%22" rel="nofollow">https://discord.com/api/webhooks/921856294481186857/cJd-f85MqKVdLyFotaxZf7yzWH-ILK3VGPL1H7W2IX7UsQwIs0yDEap7cG4oF18uE4K0"</a>);</p> <div class="highlight"><pre class="highlight plaintext"><code> request.setRequestHeader('Content-type', 'application/json'); const params = { username: "My Webhook Name", avatar_url: "", content: document.querySelector("input").value } request.send(JSON.stringify(params)); } </code></pre></div> <p>
and how i should modify this
Where did you copy that code from? That’s some plain HTML displaying JavaScript code, not executing it.
Hey @oskarcodes ! My code doesn't work. Can you please check why?
Thank you!
Your code looks fine, it must be the Webhook URL endpoint that is wrong
How would I make it to where I make a text submit box and get whatever hey typed in sent to the webhook?
Make an HTML
<input>
element, select if from JavaScript, and pass the.value
of that element to the payload you send to your Webhook.can you make an example of this please im really new to this
Works flawlessly. <3
Hi! So I wanted to enter the content directly from the html page, so I made a label, but I don't really know how to link the label's entered input to the content value. Anyone got any ideas? I'm really new to html, css and java so I don't really know much.
Set the content field to the value of your input:
How do you make it like send a message every 24 hours?
set a timer for 24 hours that sends a request
What would be the code to do that?
Sorry I am not very experienced at this.
In JavaScript, you can use the
setInterval
method to run some code repeatedly.Check out the documentation: developer.mozilla.org/en-US/docs/W...
Une partie 2, une partie 2, une partie 2
Ça arrive bientôt
hi, thanks for the help. Can you write also how to get messages from a channel? I am trying but everything and everyone just use discord.js which I cant use in my project
Webhooks cannot read data from channels, because they're just HTTP endpoints you send requests to, there's no code logic involved in the Webhook on Discord's side.
So yeah, you'll have to use Discord.js to read from channels
Is it possible to do multiple webhooks? Like a dropdown menu of channels and selecting X channel from the form dropdown list will use Y webbook?
Yes that’s totally possible, just check which option is selected in the drop down, and send to a different webhook url based on that
Uhm hello, can i ask, I'm getting error from CORS Policy, how should i fix it?
Then your webhook endpoint must be wrong, check it again.
Is there a way to make it so it sends multiple lined messages? In this it only allows me to send a message that is in all one line.
Add the character \n to create a newline, like so:
Otherwise you could use backsticks instead of quotes, like so:
How do you send the same messages to multiple server ??
Make requests to multiple webhook endpoints
How do I make it send a variable in the content: parameter?
Well you can just put your variable in there instead of the string
How would you post an updating game log through discord?
Same logic as explained in this article, just that the environment is your game framework or engine.
can we put text box instead of writing the message in code all the time pls help
Yes you can, just use the value property of the text box and pass it in the object that is sent in the webhook payload.
can you link the enbed vid plz ty
Which video?
Is there a way to use webhook to send a private message if person is on the server which my app is connected to?
No, for that you’ll need a Discord bot. A webhook can only send to server channels.
Can you send an image instead of text to the discord server? if so, what's the code?
hey there is a problem for some reason it gives me this error:
(index):1 Uncaught ReferenceError: sendMessage is not defined
at HTMLButtonElement.onclick ((index):1:1)
can you help me fix it?