ModsJava
Minecraft Discord Messenger [1.13 - 1.21]
Script for sending messages to Discord via Webhook URL written in Skript
⬇ Download on SpigotOpen in MCModsHubGet it on Google Play →
Hello, Minecraft community!
I present to your attention a script written in Skript for sending messages to Discord via a webhook URL.
You can generate messages in JSON format and send them to the webhook of the URL Discord channel.
I present to your attention a script written in Skript for sending messages to Discord via a webhook URL.
You can generate messages in JSON format and send them to the webhook of the URL Discord channel.
The script has two main functions.
The first one generates a message in JSON format, and the second one sends this message to the Discord channel.
The first one generates a message in JSON format, and the second one sends this message to the Discord channel.
1. Function prepareDiscordMessage
Function to format message in JSON format.
Spoiler: function parameters
Parameters:
● avatarUrl: Avatar for Discord bot
● botUsername: Username for Discord bot
● embedTitle: Embed title
● embedDescription: Embed description
● embedFooter: Footer text
● embedColor: Embed color
● avatarUrl: Avatar for Discord bot
● botUsername: Username for Discord bot
● embedTitle: Embed title
● embedDescription: Embed description
● embedFooter: Footer text
● embedColor: Embed color
Usage example:
An example of the result of formatting a message for further sending as a message to the Discord channel.
Code (Text):
set {_discordMessage} to prepareDiscordMessage(BotAvatar(), BotUsername(), "%event-player% has joined the server", "The player **%event-player%** has joined the server.", FooterText(), GreenColor())
Code (Text):
'{ ""embeds"": [{ ""title"": ""CHYZHOV has joined the server"", ""description"": ""The player **CHYZHOV** has joined the server."", ""color"": 3066993, ""footer"": { ""text"": ""Date of action execution: 02.11.2024, 02:49"" } }], ""username"": ""System alert"", ""avatar_url"": ""https://cdn.discordapp.com/attachments/1014147200701435965/1294052865836318791/star-fall-svgrepo-com.png?ex=6714d0e5&is=67137f65&hm=aecc0259e4c8eda035b42ac9b414ea87c6d1d7e82a23fa21a3519273ef64ded3&"" }'
2. Function sendDiscordMessage
Function for sending messages to the Discord channel.
Spoiler: function parameters
Parameters:
● message: Message in JSON format
● channel: Channel webhook URL
● message: Message in JSON format
● channel: Channel webhook URL
Usage example:
When a player joins a server, a message will be sent to the Discord channel about it.
Code (Text):
on join:
set {_discordMessage} to prepareDiscordMessage(BotAvatar(), BotUsername(), "%event-player% has joined the server", "The player **%event-player%** has joined the server.", FooterText(), GreenColor())
sendDiscordMessage({_discordMessage}, Channel())
set {_discordMessage} to prepareDiscordMessage(BotAvatar(), BotUsername(), "%event-player% has joined the server", "The player **%event-player%** has joined the server.", FooterText(), GreenColor())
sendDiscordMessage({_discordMessage}, Channel())
The message was sent to the Discord channel.
Spoiler: result image
For more convenient use of the script, you can use such functions as those listed below.
Override the values in the functions below.
Override the values in the functions below.
1. Bot avatar
Specify a link to the bot's avatar, which will be displayed in the discord message.
Code (Text):
function BotAvatar() :: string:
return "https://cdn.discordapp.com/attachments/1014147200701435965/1294052865836318791/star-fall-svgrepo-com.png?ex=6714d0e5&is=67137f65&hm=aecc0259e4c8eda035b42ac9b414ea87c6d1d7e82a23fa21a3519273ef64ded3&"
return "https://cdn.discordapp.com/attachments/1014147200701435965/1294052865836318791/star-fall-svgrepo-com.png?ex=6714d0e5&is=67137f65&hm=aecc0259e4c8eda035b42ac9b414ea87c6d1d7e82a23fa21a3519273ef64ded3&"
The name of the bot will be displayed in the discord message.
Code (Text):
function BotUsername() :: string:
return "System alert"
return "System alert"
The text will be displayed in the footer of the Discord message.
Code (Text):
function FooterText() :: string:
return "Date of action execution: %now%"
return "Date of action execution: %now%"
The color code variant for the embed in the Discord message.
Code (Text):
function RedColor() :: integer:
return 13458524
return 13458524
The color code variant for the embed in the Discord message.
Code (Text):
function YellowColor() :: integer:
return 15844367
return 15844367
The color code variant for the embed in the Discord message.
Code (Text):
function GreenColor() :: integer:
return 3066993
return 3066993
Link to the webhook of the URL channel to which the message will be sent.
Code (Text):
function Channel() :: string:
return "https://discord.com/api/webhooks/your_webhook"
return "https://discord.com/api/webhooks/your_webhook"
Please pay attention to this information!
For the script to work, you need to install some plugins.
For the script to work, you need to install some plugins.
1. Skript - https://www.spigotmc.org/resources/skript.114544/
2. skript reflect - https://www.spigotmc.org/resources/skript-reflect.82259/
Minecraft Discord Messenger [1.13 - 1.21] is a free Minecraft Java mod. Compatible with Minecraft 1.13, 1.14, 1.15, 1.16 and newer. Downloaded 238 times (via Spigot). Download it and open it directly in the game.
Explore more