From 3d077cb252752889edc55c46d4e375d8d5bda44e Mon Sep 17 00:00:00 2001 From: Dragory Date: Thu, 28 Mar 2019 04:57:21 +0200 Subject: [PATCH] Add current voice channel to thread header --- src/data/threads.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/data/threads.js b/src/data/threads.js index 42e85e9..66cce60 100644 --- a/src/data/threads.js +++ b/src/data/threads.js @@ -176,10 +176,19 @@ async function createNewThreadForUser(user, quiet = false) { // Guild member info for (const [guildId, guildData] of userGuildData.entries()) { const {nickname, joinDate} = getHeaderGuildInfo(guildData.member); - const headerStr = [ + const headerItems = [ `NICKNAME **${nickname}**`, `JOINED **${joinDate}** ago` - ].join(', '); + ]; + + if (guildData.member.voiceState.channelID) { + const voiceChannel = guildData.guild.channels.get(guildData.member.voiceState.channelID); + if (voiceChannel) { + headerItems.push(`VOICE CHANNEL **${voiceChannel.name}**`); + } + } + + const headerStr = headerItems.join(', '); if (mainGuilds.length === 1) { infoHeader += `\n${headerStr}`;