Fix "x previous logs" message not appearing in new modmail threads

master
Miikka Virtanen 2017-02-10 12:17:53 +02:00 committed by GitHub
parent f35ceb4c0d
commit 9e301c3c03
1 changed files with 5 additions and 2 deletions

View File

@ -112,8 +112,11 @@ bot.on('messageCreate', (msg) => {
// If the thread was just created, do some extra stuff // If the thread was just created, do some extra stuff
if (thread._wasCreated) { if (thread._wasCreated) {
// Mention previous logs at the start of the thread // Mention previous logs at the start of the thread
if (logs.length > 0) { if (userLogs.length > 0) {
bot.createMessage(thread.channelId, `${logs.length} previous modmail logs with this user. Use !logs ${msg.author.id} for details.`); let logText;
if (userLogs.length === 1) logText = `There is 1 logged conversation with this user.`;
else logText = `There are ${userLogs.length} logged conversations with this user.`;
bot.createMessage(thread.channelId, `${logText} Type !logs for details.`);
} }
// Ping mods of the new thread // Ping mods of the new thread