Utility: add voice information to !info, tweak embed styles a bit

This commit is contained in:
Dragory 2019-03-20 00:34:41 +02:00
parent 9202a717e3
commit cb7904ef81

View file

@ -417,9 +417,9 @@ export class UtilityPlugin extends ZeppelinPlugin<IBasePluginConfig, IUtilityPlu
name: "User information", name: "User information",
value: value:
trimLines(` trimLines(`
ID: ${user.id} ID: **${user.id}**
Profile: <@!${user.id}> Profile: <@!${user.id}>
Created: ${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")}) Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
`) + embedPadding, `) + embedPadding,
}); });
} else { } else {
@ -439,10 +439,23 @@ export class UtilityPlugin extends ZeppelinPlugin<IBasePluginConfig, IUtilityPlu
name: "Member information", name: "Member information",
value: value:
trimLines(` trimLines(`
Joined: ${joinAge} ago (${joinedAt.format("YYYY-MM-DD[T]HH:mm:ss")}) Joined: **${joinAge} ago (${joinedAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
${roles.length > 0 ? "Roles: " + roles.map(r => r.name).join(", ") : ""} ${roles.length > 0 ? "Roles: " + roles.map(r => r.name).join(", ") : ""}
`) + embedPadding, `) + embedPadding,
}); });
const voiceChannel = member.voiceState.channelID ? this.guild.channels.get(member.voiceState.channelID) : null;
if (voiceChannel || member.voiceState.mute || member.voiceState.deaf) {
embed.fields.push({
name: "Voice information",
value:
trimLines(`
${voiceChannel ? `Current voice channel: **${voiceChannel ? voiceChannel.name : "None"}**` : ""}
${member.voiceState.mute ? "Server voice muted: **Yes**" : ""}
${member.voiceState.deaf ? "Server voice deafened: **Yes**" : ""}
`) + embedPadding,
});
}
} }
const cases = (await this.cases.getByUserId(args.userId)).filter(c => !c.is_hidden); const cases = (await this.cases.getByUserId(args.userId)).filter(c => !c.is_hidden);
@ -461,7 +474,7 @@ export class UtilityPlugin extends ZeppelinPlugin<IBasePluginConfig, IUtilityPlu
embed.fields.push({ embed.fields.push({
name: "Cases", name: "Cases",
value: trimLines(` value: trimLines(`
Total cases: ${cases.length} Total cases: **${cases.length}**
${summaryText}: ${caseSummary.join(", ")} ${summaryText}: ${caseSummary.join(", ")}
`), `),
}); });