Add role name into replies

master
Miikka Virtanen 2016-12-21 04:30:39 +02:00
parent 86dd4b59c5
commit 4a1cb8dd07
1 changed files with 5 additions and 1 deletions

View File

@ -319,8 +319,12 @@ bot.registerCommand('reply', (msg, args) => {
saveAttachments(msg).then(() => { saveAttachments(msg).then(() => {
bot.getDMChannel(channelInfo.userId).then(dmChannel => { 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 argMsg = args.join(' ').trim();
let content = `**${msg.author.username}:** ${argMsg}`; let content = `**${roleStr}${msg.author.username}:** ${argMsg}`;
const sendMessage = (file, attachmentUrl) => { const sendMessage = (file, attachmentUrl) => {
dmChannel.createMessage(content, file).then(() => { dmChannel.createMessage(content, file).then(() => {