Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Member Name Changes #296

Merged
merged 2 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/abstracts/LogMessageDeleteHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ abstract class LogMessageDeleteHandler extends EventHandler {
const embed = new EmbedBuilder();

embed.setTitle("Message Deleted");
embed.setDescription(`Author: ${message.author}\nChannel: ${message.channel}`);
embed.setDescription(`Author: ${message.author} (${message.author.username})\nChannel: ${message.channel}`);
embed.addFields([{ name: "Message", value: message.content }]);
embed.setColor(getConfigValue<GenericObject<ColorResolvable>>("EMBED_COLOURS").DEFAULT);

Expand Down
6 changes: 3 additions & 3 deletions src/commands/InspectCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class InspectCommand {
private buildInspectEmbed(memberObj: GuildMember): EmbedBuilder {
const embed = new EmbedBuilder();

embed.setTitle(`Inspecting ${memberObj?.user.tag}`);
embed.setTitle(`Inspecting ${memberObj?.user.username}`);
embed.setColor(<ColorResolvable>(memberObj?.displayColor || getConfigValue<GenericObject<ColorResolvable>>("EMBED_COLOURS").DEFAULT));
embed.setThumbnail(memberObj?.user.displayAvatarURL());
embed.addFields([
{ name: "User ID", value: memberObj?.user.id },
{ name: "Username", value: memberObj?.user.tag }
{ name: "Username", value: memberObj?.user.username }
]);

if (memberObj?.nickname !== null) embed.addFields([{ name: "Nickname", value: memberObj?.nickname }]);
Expand All @@ -61,4 +61,4 @@ class InspectCommand {
}
}

export default InspectCommand;
export default InspectCommand;
2 changes: 1 addition & 1 deletion src/event/handlers/LogMemberLeaveHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LogMemberLeaveHandler extends EventHandler {
const embed = new EmbedBuilder();

embed.setTitle("Member Left");
embed.setDescription(`User: ${guildMember.user}`);
embed.setDescription(`User: ${guildMember.user} (${guildMember.user.username})`);
embed.setColor(getConfigValue<GenericObject<ColorResolvable>>("EMBED_COLOURS").DEFAULT);
embed.addFields([
{ name: "Join Date", value: new Date(guildMember.joinedTimestamp!).toLocaleString(), inline: true },
Expand Down
14 changes: 7 additions & 7 deletions test/commands/InspectCommandTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ describe("InspectCommand", () => {
const relativeTime = time(member?.joinedAt!, TimestampStyles.RelativeTime);

expect(replyStub.calledOnce).to.be.true;
expect(embed.data.title).to.equal(`Inspecting ${member.user.tag}`);
expect(embed.data.title).to.equal(`Inspecting ${member.user.username}`);
expect(embed.data.fields[0].name).to.equal("User ID");
expect(embed.data.fields[0].value).to.equal(member.user.id);
expect(embed.data.fields[1].name).to.equal("Username");
expect(embed.data.fields[1].value).to.equal(member.user.tag);
expect(embed.data.fields[1].value).to.equal(member.user.username);
expect(embed.data.fields[2].name).to.equal("Nickname");
expect(embed.data.fields[2].value).to.equal("my name");
expect(embed.data.fields[3].name).to.equal("Joined At");
Expand All @@ -104,9 +104,9 @@ describe("InspectCommand", () => {
const relativeTime = time(member?.joinedAt!, TimestampStyles.RelativeTime);

expect(replyStub.calledOnce).to.be.true;
expect(embed.data.title).to.equal(`Inspecting ${member.user.tag}`);
expect(embed.data.title).to.equal(`Inspecting ${member.user.username}`);
expect(embed.data.fields.find((field: EmbedField) => field.name === "User ID")?.value).to.equal(member.user.id);
expect(embed.data.fields.find((field: EmbedField) => field.name === "Username")?.value).to.equal(member.user.tag);
expect(embed.data.fields.find((field: EmbedField) => field.name === "Username")?.value).to.equal(member.user.username);
expect(embed.data.fields.find((field: EmbedField) => field.name === "Nickname")?.value ?? null).to.equal(member?.nickname);
expect(embed.data.fields.find((field: EmbedField) => field.name === "Joined At")?.value ?? null).to.equal(`${shortDateTime} ${relativeTime}`);
expect(embed.data.fields.find((field: EmbedField) => field.name === "Roles")?.value).to.equal(" <@&12345>");
Expand All @@ -127,11 +127,11 @@ describe("InspectCommand", () => {
const relativeTime = time(member?.joinedAt!, TimestampStyles.RelativeTime);

expect(replyStub.calledOnce).to.be.true;
expect(embed.data.title).to.equal(`Inspecting ${member.user.tag}`);
expect(embed.data.title).to.equal(`Inspecting ${member.user.username}`);
expect(embed.data.fields[0].name).to.equal("User ID");
expect(embed.data.fields[0].value).to.equal(member.user.id);
expect(embed.data.fields[1].name).to.equal("Username");
expect(embed.data.fields[1].value).to.equal(member.user.tag);
expect(embed.data.fields[1].value).to.equal(member.user.username);
expect(embed.data.fields[2].name).to.equal("Nickname");
expect(embed.data.fields[2].value).to.equal("my name");
expect(embed.data.fields[3].name).to.equal("Joined At");
Expand All @@ -145,4 +145,4 @@ describe("InspectCommand", () => {
sandbox.restore();
});
});
});
});