From d269bc418f9ff198989319f5a00214943d91a94a Mon Sep 17 00:00:00 2001 From: Andrew Siegman Date: Wed, 2 May 2018 20:29:02 -0500 Subject: [PATCH 1/2] accept a channel for bot conduct --- scripts/conduct.coffee | 20 -------------------- scripts/conduct.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 20 deletions(-) delete mode 100644 scripts/conduct.coffee create mode 100644 scripts/conduct.js diff --git a/scripts/conduct.coffee b/scripts/conduct.coffee deleted file mode 100644 index 88938cb..0000000 --- a/scripts/conduct.coffee +++ /dev/null @@ -1,20 +0,0 @@ -# Description: -# Remind members about our code of conduct -# -# Dependencies: -# None -# -# Configuration: -# None -# -# Commands: -# hubot conduct - Remind the channel about the devICT code of conduct - -module.exports = (robot) -> - robot.respond /(code( of)? )?conduct/i, (msg) -> - msg.send "devICT is dedicated to a safe and harassment-free experience for " + - "everyone. We do not tolerate harassment in any form. If you have any " + - "questions or concerns please feel free to reach out to one of the devICT " + - "organizers. Our anti-harassment policy can be found at: " + - "https://devict.org/conduct" - msg.send "Generally let's keep things PG." diff --git a/scripts/conduct.js b/scripts/conduct.js new file mode 100644 index 0000000..d3fbb89 --- /dev/null +++ b/scripts/conduct.js @@ -0,0 +1,33 @@ +// Description: +// Remind members about our code of conduct +// +// Dependencies: +// None +// +// Configuration: +// None +// +// Commands: +// hubot conduct - Remind the channel about the devICT code of conduct + +module.exports = (robot) => { + robot.respond(/(?:code(?: of)? )?conduct(?:\s?([#@][\w-]+))?/i, (msg) => { + let msgs = [ + "devICT is dedicated to a safe and harassment-free experience for " + + "everyone. We do not tolerate harassment in any form. If you have any " + + "questions or concerns please feel free to reach out to one of the devICT " + + "organizers. Our anti-harassment policy can be found at: " + + "https://devict.org/conduct", + "Generally let's keep things PG." + ] + if (typeof msg.match[1] !== 'undefined') { // a channel was specified + for (let i = 0; i < msgs.length; i++) { + robot.messageRoom(msg.match[1], msgs[i]) + } + } else { + for (let i = 0; i < msgs.length; i++) { + msg.send(msgs[i]) + } + } + }) +} From 5362723a08c992b0e867c7bbd7fb2647a23bdbd5 Mon Sep 17 00:00:00 2001 From: Andrew Siegman Date: Thu, 3 May 2018 12:27:53 -0500 Subject: [PATCH 2/2] remove user symbol from regex + add example --- scripts/conduct.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/conduct.js b/scripts/conduct.js index d3fbb89..d359976 100644 --- a/scripts/conduct.js +++ b/scripts/conduct.js @@ -8,10 +8,11 @@ // None // // Commands: -// hubot conduct - Remind the channel about the devICT code of conduct +// bot conduct - Remind the current channel about the devICT code of conduct +// bot conduct #hubot - Remind the #hubot channel about the devICT code of conduct (omit "bot" and this can be in a DM to bot) module.exports = (robot) => { - robot.respond(/(?:code(?: of)? )?conduct(?:\s?([#@][\w-]+))?/i, (msg) => { + robot.respond(/(?:code(?: of)? )?conduct(?:\s?(#[\w-]+))?/i, (msg) => { let msgs = [ "devICT is dedicated to a safe and harassment-free experience for " + "everyone. We do not tolerate harassment in any form. If you have any " +