From 4a1cb8dd0711d7753e6b6eac7d4cc156f1b9b885 Mon Sep 17 00:00:00 2001 From: Miikka Virtanen Date: Wed, 21 Dec 2016 04:30:39 +0200 Subject: [PATCH] Add role name into replies --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 72bab00..d48a1ad 100644 --- a/index.js +++ b/index.js @@ -319,8 +319,12 @@ bot.registerCommand('reply', (msg, args) => { saveAttachments(msg).then(() => { bot.getDMChannel(channelInfo.userId).then(dmChannel => { + const roleId = msg.member.roles[0]; + const role = (roleId ? modMailGuild.roles.get(roleId).name : ''); + const roleStr = (role ? `(${role}) ` : ''); + let argMsg = args.join(' ').trim(); - let content = `**${msg.author.username}:** ${argMsg}`; + let content = `**${roleStr}${msg.author.username}:** ${argMsg}`; const sendMessage = (file, attachmentUrl) => { dmChannel.createMessage(content, file).then(() => {