Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chat = peripheral.find("chatBox")
- if not chat then error("No chatbox attached!") end
- local dc = require("discord")
- if not dc then error("Discord API not installed! Run \"update discord\" to install.") end
- local dcData = require("discorddata")
- if not dcData then error("Discord Data not configured!") end
- local function getMinecraftAvatar(uuid)
- return "https://crafatar.com/renders/head/"..uuid
- end
- local function relayMessageToDiscord()
- local event, username, message, uuid, isHidden = os.pullEvent("chat")
- print(username.. " just wrote: ".. message)
- avatar_url = getMinecraftAvatar(uuid)
- dc.webhookMessage(dcData.webhookId, dcData.webhookToken, message, username, avatar_url)
- end
- while true do relayMessageToDiscord() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement