structures/Upvote.js

  1. const Base = require('./Base.js');
  2. const User = require('./User.js');
  3. /**
  4. * Resembles an upvote from the `/servers/:id/upvotes` endpoint.
  5. * @extends {Base}
  6. */
  7. class Upvote extends Base {
  8. /**
  9. * @param {object} obj
  10. * @param {string} id
  11. */
  12. constructor(obj, id) {
  13. super(obj);
  14. /**
  15. * The guild ID of the upvote.
  16. * @type {string}
  17. */
  18. this.guildID = id;
  19. /**
  20. * The timestamp in which the upvote took place.
  21. * @type {number}
  22. */
  23. this.timestamp = obj.timestamp;
  24. /**
  25. * The user that upvoted.
  26. * @type {User}
  27. */
  28. this.user = new User(obj.user);
  29. }
  30. /**
  31. * Returns text that Discord recognizes as a user mention.
  32. * @type {string}
  33. */
  34. toString() {
  35. return `<@${this.user.id}>`;
  36. }
  37. }
  38. module.exports = Upvote;