This Lua script is designed to detect a redstone signal in Minecraft and notify a Discord channel using a webhook. It sends a message in embed mode, including GPS coordinates and an avatar.
Before using this script, make sure you have the following:
- ComputerCraft or CC: Tweaked installed in your Minecraft world.
- A Discord webhook URL for the channel where you want to receive notifications.
The script includes a function to obtain and display GPS coordinates in the Discord message.
To use the GPS functionality, follow these steps:
- Set up three computers (computers A, B, and C) with an ender-modem attached to each.
- Arrange them as shown in the image. Upload the GPS/startup.lua script to each computer and specify the coordinates of each computer.
- Open the Lua script in your ComputerCraft computer.
- Replace
"your-discord-webhook-url"
with your Discord webhook URL in thewebhookURL
variable. - Optionally, replace the
avatarURL
variable with the URL of your desired avatar.
- The script continuously checks for a redstone signal.
- If a redstone signal is detected, it sends a Discord message with embed mode, displaying the GPS coordinates and the detection message.
- To avoid spam, it waits for a few seconds (configurable) before checking for the signal again.
-- Example Configuration
local webhookURL = "your-discord-webhook-url"
local avatarURL = "https://media.energetic.pw/pm5sfo-82l.jpg"
-- ... (rest of the configuration)
-- Example Usage
sendDiscordEmbedMessageWithAvatar("Redstone Detection", "A redstone signal has been detected!\n" .. printGPSCoordinates(), 0xFF0000, avatarURL)