Before you start you will need node ( https://nodejs.org/en/ ), some knowledge of javascript and a code editor (Atom, Vscode) You will also need a webhook in your server setup
Create a Discord WebHook on windows
-
Make a folder where desired, call it whatever you want.
-
Open the folder, hold shift and right click. (Make sure your mouse is hovering over the folder)
-
Once a menu has come up click open cmd or powershell.
-
Once one of them is open type npm init and press enter.
-
After that is done it will go through a few steps. (name, version, description etc.)
-
Once you have done that type npm i discord.js (this is the node module you will need.)
-
Then you can close the window and open the folder in a editor of choice. (The one I reccomend is atom or vs code.)
Now you have got the main part over. -
Make a new file and call it hook or index .js.
-
Then open it and put the code in bellow.
// Import the discord.js module const Discord = require('discord.js');
// This defines your id and token. const hook = new Discord.WebhookClient('webhook id', 'webhook token');
// This is a test message. hook.send('I am now alive!');
-
To get your id and token there should be a link on the webhook.
-
Once that it is done make a file called run.bat. (This will run the webhook)
-
In the run.bat copy the code in down bellow.
node hook.js (or index.js).
-
Save all the files and click on the run.bat and look in the channel you set up the webhook to send the message.
-
This should of ssent the message
I am alive!.Now getting into embeds. -
Copy the code bellow and change it to your liking.
var Embed = new Discord.RichEmbed() .setTitle('Title') .setColor('Put a hex color code here') .setDescription('Description') .addField('Title of the field', 'text of the field') .addField('Title of the field', 'text of the field') .addField('Title of the field', 'text of the field') .setTimestamp(new Date()); // This puts the date and time. hook.send(Embed)
Copyright of Tylercuz Games.