discord.dm

Adds the DM side of sending messages to discord via nudge.
This commit is contained in:
skull132
2016-02-16 17:31:50 +02:00
parent 29150a1909
commit e832a8fbd8

View File

@@ -0,0 +1,33 @@
#define CHAN_ADMIN "admin_channel"
#define CHAN_CCIAA "cciaa_channel"
/proc/send_to_discord(var/channel, var/message)
if (!config.use_discord_bot)
return
if (!channel)
log_game("send_to_discord() called without channel arg.")
return
if (!message)
log_game("send_to_discord() called without message arg.")
return
var/arguments = " --key=\"[config.comms_password]\""
arguments += " --channel=\"[channel]\""
if (config.discord_bot_host)
arguments += " --host=\"[config.discord_bot_host]\""
if (config.discord_bot_port)
arguments += " --port=\"[config.discord_bot_port]\""
message = replacetext(message, "\"", "\\\"")
ext_python("discordbot_message.py", "[arguments] [message]")
return
/proc/send_to_admin_discord(var/message)
send_to_discord(CHAN_ADMIN, message)
/proc/send_to_cciaa_discord(var/message)
send_to_discord(CHAN_CCIAA, message)
#undef CHAN_CCIAA
#undef CHAN_ADMIN