classes/structures/member/memberUpdated.js

  1. const User = require("../user/user.js");
  2. class MemberUpdated {
  3. /**
  4. * MemberUpdate constructor
  5. * @param {String} serverId The server id of the member update
  6. * @param {Object} userInfo The user info
  7. * @param {String} userInfo.id The user id of the user who was updated
  8. * @param {String | undefined} userInfo.nickname The username of the user who was updated
  9. * @returns {MemberUpdate<String, String, String | undefined, User>} The server id of the member update, the user id of the user who was updated, the username of the user who was updated, the user who was updated
  10. * @private
  11. */
  12. constructor(userUpdateData, Client) {
  13. /**
  14. * Client instance
  15. * @type {Client}
  16. * @readonly
  17. */
  18. this.client = Client;
  19. /**
  20. * The server id of the member update
  21. * @type {String}
  22. * @readonly
  23. * @private
  24. */
  25. this.serverId = userUpdateData.serverId;
  26. /**
  27. * The user ID of the user who was updated
  28. * @type {String}
  29. * @readonly
  30. * @private
  31. */
  32. this.userId = userUpdateData.userInfo.id;
  33. /**
  34. * The username of the user who was updated
  35. * @type {String | undefined}
  36. * @readonly
  37. * @private
  38. */
  39. this.username = userUpdateData.userInfo?.nickname ?? undefined;
  40. /**
  41. * The user object of the user who was updated
  42. * @type {User}
  43. * @readonly
  44. * @private
  45. */
  46. this.user = new User(userUpdateData.userInfo, Client);
  47. }
  48. }
  49. module.exports = MemberUpdated;