Wulf
Plugin API for sending messages and notifications to Slack

Supported Games

Slack is a plugin API for sending messages and notifications to Slack channels. There are a few message templates provided, and more will likely be added as the plugin develops.

Configuration

{
  "BotName": "Oxide",
  "HookUrl": "",
  "IconUrl": "",
  "LinkNames": true,
  "ServerInfo": true
}

HookUrl is the URL created at https://YOURSLACKNAME.slack.com/apps/A0F7XDUAZ-incoming-webhooks.

BotName and IconUrl are optional, and are used to override the default webhook settings.

Developer API

To call the methods provided by this plugin, your plugin needs to get the plugin reference. You can do this a couple different ways depending on if it optionally depends on it or requires it.

If your plugin requires this plugin and is written in C#, you can use the following at the top of your plugin:

// Requires: Slack

For C# plugins, you'll need to get the plugin's reference as such:

[PluginReference]
private Plugin Slack;

Now that you have the plugin reference, you call the provided methods:

Slack?.Call("FancyMessage", "Hello world!", player);

Note: The above examples are not using the optional IPlayer, channel, and the Action callback parameters. For examples of how to use these, see Slack Chat, Slack Notices, Slack Report, and other plugins that use this plugin.

API Methods

private void FancyMessage(string message, IPlayer player, string channel = null, Action<bool> callback = null)

Sends a fancy message to Slack with linked profile, in-game avatar, and server information.

private void SimpleMessage(string message, IPlayer player, string channel = null, Action<bool> callback = null)

Sends a simple message to Slack as a fake user with in-game avatar.

private void Message(string message, string channel = null, Action<bool> callback = null)

Sends a basic message to Slack using configured settings.

private void TicketMessage(string message, IPlayer player, string channel = null, Action<bool> callback = null)

Sends a ticket-styled message to Slack with reporter information and position.

MIT License, with distribution exclusivity for uMod.org


Copyright (c) 2020 Wulf


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.