This plugin is for those who are unable to setup real discord bots or do not have the hardware for it. Discord Messages makes use of the webhook function of Discord therefore you do not need any dependencies to get up and running!
Features
All of these features can be enabled/disabled via the config.
- Ban - (/ban) - Allows a player with permission to ban another player and have the message announced to the server and sent to discord, this replaces the vanilla ban command but works better in the way that it lets you ban offline players with simplicity.
- Report - (/report) - Allows a player with permission to report another player and have their message sent to discord.
- Mute Messages - (Requires Better Chat Mute) - When a player is muted via BetterChatMute a message is sent to Discord.
- Message - (/message) - Allows a player with permission to send a message to Discord.
- Server Chat - Posts to discord once a player types in chat with the option to enable TTS *(Text To Speech) *
Permissions
discordmessages.ban
-- Allows player to use theban
commanddiscordmessages.report
-- Allows player to use thereport
commanddiscordmessages.message
-- Allowsplayer to use themessage
command
Commands
() = Required - {} = Optional
ban (player) {message}
-- Ban player and send message to Discordreport (player) (message)
-- Send a report to Discordmessage (message)
-- Send a message to Discord
Localization
Developer API
There are two API methods. APISendFancyMessage will send an Embedded message while APISendTextMessage will send a generic text message.
DiscordMessages?.Call("API_SendFancyMessage", (string)WebhookURL, (string)EmbedTitle, (int/string/Color)EmbedColor, (json string)Fields, (optional string)MessageText, (optional Plugin)Plugin);
DiscordMessages?.Call("API_SendTextMessage", (string)WebhookURL, (string)Message, (optional bool)TextToSpeech, (optional Plugin)Plugin);
In order to create the fields required for an Embedded message you simply create an fields object with an array of fields as follows.
object fields = new[]
{
new {
name = "Field1 Title", value = "Field1 Value", inline = true
},
new {
name = "Field2 Title", value = "Field2 Value", inline = false
}
};
string json = JsonConvert.SerializeObject(fields);
DiscordMessages?.Call("API_SendFancyMessage", (string)WebhookURL, (string)EmbedTitle, (int)EmbedColor, json);
MIT License
Copyright (c) 2020 Slut
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.