### Install discohooks with npm Source: https://github.com/neonn0d/discohooks/blob/main/README.md Command to install the discohooks library using the npm package manager. ```Shell npm install discohooks ``` -------------------------------- ### Install discohooks with yarn Source: https://github.com/neonn0d/discohooks/blob/main/README.md Command to install the discohooks library using the yarn package manager. ```Shell yarn add discohooks ``` -------------------------------- ### Send API Data with Embeds using discohooks in Node.js Source: https://github.com/neonn0d/discohooks/blob/main/README.md Provides an example of using discohooks in a Node.js environment to fetch data from an API using axios and send it as a Discord message with an embed. ```JavaScript const axios = require('axios'); const DiscordNotification = require('discohooks'); const webhookUrl = 'https://discord.com/api/webhooks/1234567890/abcdefg'; // Replace with your webhook const discord = new DiscordNotification(webhookUrl); const apiUrl = 'https://reqres.in/api/users/1'; // Replace with the actual API URL async function sendApiDataToDiscord() { try { const response = await axios.get(apiUrl); const user = response.data.data; const embed = { color: 0x0099ff, title: `${user.first_name} ${user.last_name}`, thumbnail: { url: user.avatar, }, fields: [ { name: 'User ID', value: user.id, inline: true, }, { name: 'Email', value: user.email, inline: true, }, ], timestamp: new Date(), footer: { text: 'Discord Notification', }, }; await discord.send( null, { username: 'Custom Username', avatar_url: 'https://example.com/avatar.png', tts: true, }, embed, ); console.log('Message sent successfully'); } catch (error) { console.error('Failed to send message:', error.message); } } sendApiDataToDiscord(); ``` -------------------------------- ### Method Signature for Sending with Embeds Source: https://github.com/neonn0d/discohooks/blob/main/README.md Shows the method signature for the send function, highlighting the optional embed parameter used for sending rich messages. ```JavaScript async send(content, options = {}, embed = null) { ... } ``` -------------------------------- ### Send API Data with Embeds using discohooks in React Source: https://github.com/neonn0d/discohooks/blob/main/README.md Shows a React component that fetches data from a public API and sends it to Discord using discohooks, formatting the data into an embed object for a richer message appearance. ```JavaScript import { useState } from 'react'; import DiscordNotification from 'discohooks'; export default function DiscordApiDataSender() { const apiUrl = 'https://reqres.in/api/users/1'; const webhookUrl = 'https://discord.com/api/webhooks/1234567890/abcdefg'; // Replace with your webhook URL const [isSending, setIsSending] = useState(false); const sendApiDataToDiscord = async () => { setIsSending(true); try { const discord = new DiscordNotification(webhookUrl); const response = await fetch(apiUrl); const data = await response.json(); const content = `User ID: ${data.data.id}\nEmail: ${data.data.email}\nFirst Name: ${data.data.first_name}\nLast Name: ${data.data.last_name}\nAvatar: ${data.data.avatar}`; const embed = { title: 'User Information', color: 0x00ff00, fields: [ { name: 'User ID', value: data.data.id, inline: true, }, { name: 'Email', value: data.data.email, inline: true, }, { name: 'First Name', value: data.data.first_name, inline: true, }, { name: 'Last Name', value: data.data.last_name, inline: true, }, { name: 'Avatar', value: data.data.avatar, inline: true, }, ], }; await discord.send(content, {}, embed); alert('Message sent successfully'); } catch (error) { alert('Failed to send message: ' + error.message); } finally { setIsSending(false); } }; return (