Skip to content

Commit

Permalink
Merge pull request #113 from TogetherCrew/112-tracking-and-saving-nic…
Browse files Browse the repository at this point in the history
…kname-updates-in-guildmember-collection

112 tracking and saving nickname updates in guildmember collection
  • Loading branch information
cyri113 authored Jul 28, 2023
2 parents 12f703b + 71cb0c7 commit bce8d3a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"homepage": "https://github.com/Behzad-rabiei/tc-discordBot#readme",
"dependencies": {
"@sentry/node": "^7.51.2",
"@togethercrew.dev/db": "^2.4.93",
"@togethercrew.dev/db": "^2.4.95",
"@togethercrew.dev/tc-messagebroker": "^0.0.40",
"babel-jest": "^29.5.0",
"bullmq": "^3.14.0",
Expand Down
7 changes: 5 additions & 2 deletions src/events/member/guildMemberAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default {
joinedAt: member.joinedAt,
roles: member.roles.cache.map(role => role.id),
discriminator: member.user.discriminator,
deletedAt: null
deletedAt: null,
permissions: member.permissions.bitfield.toString(),
nickname: member.nickname
}
);
}
Expand All @@ -34,7 +36,8 @@ export default {
roles: member.roles.cache.map(role => role.id),
isBot: member.user.bot,
discriminator: member.user.discriminator,
permissions: member.permissions.bitfield.toString()
permissions: member.permissions.bitfield.toString(),
nickname: member.nickname
});
}
await closeConnection(connection)
Expand Down
4 changes: 4 additions & 0 deletions src/events/member/guildMemberUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default {
joinedAt: newMember.joinedAt,
roles: newMember.roles.cache.map(role => role.id),
discriminator: newMember.user.discriminator,
nickname: newMember.nickname,
permissions: newMember.permissions.bitfield.toString(),
}
);
if (!guildMember) {
Expand All @@ -30,6 +32,8 @@ export default {
roles: newMember.roles.cache.map(role => role.id),
isBot: newMember.user.bot,
discriminator: newMember.user.discriminator,
nickname: newMember.nickname,
permissions: newMember.permissions.bitfield.toString(),
});
}
await closeConnection(connection)
Expand Down
3 changes: 2 additions & 1 deletion src/functions/fetchMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function getNeedDataFromGuildMember(guildMember: GuildMember): IGuildMember {
roles: guildMember.roles.cache.map(role => role.id),
isBot: guildMember.user.bot,
discriminator: guildMember.user.discriminator,
permissions: guildMember.permissions.bitfield.toString()
permissions: guildMember.permissions.bitfield.toString(),
nickname: guildMember.nickname
};
}

Expand Down

0 comments on commit bce8d3a

Please sign in to comment.