This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .env -> process.env | |
require("dotenv").config(); | |
// I will use axios as it comes with the next package as well. | |
const axios = require("axios"); | |
// Our function for the bot to send a message | |
function createMessage(channelID, content) { | |
//You need the token from your Discord bot. | |
return axios.post(`https://discord.com/api/v8/channels/${channelID}/messages`, content, { | |
headers: { | |
Authorization: `Bot ${process.env.DISCORD_TOKEN}`, |