@duque.edits/sdk 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@ class GuildBetManager {
28
28
  const response = await this.rest.request({
29
29
  method: "POST",
30
30
  url: route,
31
+ payload
31
32
  });
32
33
  const bet = this.set(response);
33
34
  return bet;
@@ -65,7 +66,7 @@ class GuildBetManager {
65
66
  return this.cache;
66
67
  }
67
68
  set(data) {
68
- if (!data._id)
69
+ if (!data?._id)
69
70
  return;
70
71
  const bet = new GuildBet_1.GuildBet(data, this.guild, this, this.rest);
71
72
  this.cache.set(bet._id, bet);
@@ -23,7 +23,7 @@ class GuildBetUserManager {
23
23
  this.cache = new Collection_1.Collection("betUsers");
24
24
  }
25
25
  set(data) {
26
- if (!data.id)
26
+ if (!data?.id)
27
27
  return;
28
28
  const user = new GuildBetUser_1.GuildBetUser(data, this, this.rest);
29
29
  this.rest.betUsers.set(user.id, user);
@@ -76,7 +76,7 @@ class ChannelManager {
76
76
  return this.cache;
77
77
  }
78
78
  set(data) {
79
- if (!data.type)
79
+ if (!data?.type)
80
80
  return;
81
81
  const channel = new Channel_1.Channel({
82
82
  baseUrl: Routes_1.Routes.guilds[this.structure.key].resource(this.guild.id, this.structure._id, "channels"),
@@ -28,6 +28,7 @@ class GuildMediatorManager {
28
28
  const response = await this.rest.request({
29
29
  method: "POST",
30
30
  url: route,
31
+ payload
31
32
  });
32
33
  const mediator = this.set(response);
33
34
  return mediator;
@@ -60,7 +61,7 @@ class GuildMediatorManager {
60
61
  if (!data.id)
61
62
  return;
62
63
  const mediator = new GuildMediator_1.GuildMediator(data, this.guild, this, this.rest);
63
- this.cache.set(data.id, mediator);
64
+ this.cache.set(data?.id, mediator);
64
65
  this.rest.mediators.set(mediator.id, mediator);
65
66
  return mediator;
66
67
  }
@@ -28,6 +28,7 @@ class GuildProductManager {
28
28
  const response = await this.rest.request({
29
29
  method: "POST",
30
30
  url: route,
31
+ payload
31
32
  });
32
33
  const product = this.set(response);
33
34
  return product;
@@ -60,7 +61,7 @@ class GuildProductManager {
60
61
  return this.cache;
61
62
  }
62
63
  set(data) {
63
- if (!data.id)
64
+ if (!data?.id)
64
65
  return;
65
66
  const product = new GuildProduct_1.GuildProduct(data, this, this.rest);
66
67
  this.cache.set(data.id, product);
@@ -28,6 +28,7 @@ class GuildTicketManager {
28
28
  const response = await this.rest.request({
29
29
  method: "POST",
30
30
  url: route,
31
+ payload,
31
32
  });
32
33
  const ticket = this.set(response);
33
34
  return ticket;
@@ -60,10 +61,10 @@ class GuildTicketManager {
60
61
  return this.cache;
61
62
  }
62
63
  set(data) {
63
- if (!data.id)
64
+ if (!data?.id)
64
65
  return;
65
66
  const ticket = new GuildTicket_1.GuildTicket(data, this.guild, this, this.rest);
66
- this.cache.set(data.id.toString(), ticket);
67
+ this.cache.set(data?.id?.toString(), ticket);
67
68
  return ticket;
68
69
  }
69
70
  setAll(data) {
@@ -66,7 +66,7 @@ class GuildUserManager {
66
66
  return user;
67
67
  }
68
68
  set(data) {
69
- if (!data.id)
69
+ if (!data?.id)
70
70
  return;
71
71
  const user = new GuildUser_1.GuildUser(data, this, this.rest);
72
72
  this.cache.set(user?.id, user);
@@ -4,8 +4,8 @@ exports.Routes = exports.Route = void 0;
4
4
  const Route = (route) => route;
5
5
  exports.Route = Route;
6
6
  exports.Routes = {
7
- base: "http://localhost:3000/api/v1",
8
- //base: "https://duquedev.up.railway.app/api/v1",
7
+ //base: "http://localhost:3000/api/v1",
8
+ base: "https://duquedev.up.railway.app/api/v1",
9
9
  field: (field) => `${field}`,
10
10
  fields: (...fields) => `${fields.join("/")}`,
11
11
  guilds: {
@@ -83,7 +83,7 @@ class GuildBet {
83
83
  this.manager = manager;
84
84
  this.key = "bets";
85
85
  this.channels = new ChannelManager_1.ChannelManager(guild, this, rest);
86
- this.messages = new MessagesManager_1.MessagesManager(this?.guild, this?._id, rest);
86
+ this.messages = new MessagesManager_1.MessagesManager(this?.guild, `bets/${data?._id}`, rest);
87
87
  this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
88
88
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
89
89
  this.guild = guild;
@@ -78,7 +78,7 @@ class GuildMatch {
78
78
  this.mvpId = data?.mvpId;
79
79
  this.key = "matches";
80
80
  this.channels = new ChannelManager_1.ChannelManager(guild, this, rest);
81
- this.messages = new MessagesManager_1.MessagesManager(guild, this?._id, rest);
81
+ this.messages = new MessagesManager_1.MessagesManager(guild, `matches/${data?._id}`, rest);
82
82
  this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
83
83
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
84
84
  this.guild = guild;
@@ -6,6 +6,7 @@ import { MessagesManager } from "../../managers/messages/MessagesManager";
6
6
  export declare class GuildTicket {
7
7
  /** Ticket's id */
8
8
  id: string;
9
+ _id: string;
9
10
  /** Ticket's creator id */
10
11
  creatorId: string;
11
12
  /** Ticket's admin id */
@@ -7,6 +7,7 @@ const MessagesManager_1 = require("../../managers/messages/MessagesManager");
7
7
  class GuildTicket {
8
8
  /** Ticket's id */
9
9
  id;
10
+ _id;
10
11
  /** Ticket's creator id */
11
12
  creatorId;
12
13
  /** Ticket's admin id */
@@ -39,7 +40,8 @@ class GuildTicket {
39
40
  * @param rest The rest client
40
41
  */
41
42
  constructor(data, guild, manager, rest) {
42
- this.id = data?.id.toString();
43
+ this.id = data?.id?.toString();
44
+ this._id = data?._id?.toString();
43
45
  this.creatorId = data?.creatorId;
44
46
  this.adminId = data?.adminId;
45
47
  this.customerRating = data.customerRating;
@@ -47,7 +49,7 @@ class GuildTicket {
47
49
  this.type = data?.type;
48
50
  this.status = data?.status;
49
51
  this.channelId = data?.channelId;
50
- this.messages = new MessagesManager_1.MessagesManager(this.guild, this.id, rest);
52
+ this.messages = new MessagesManager_1.MessagesManager(guild, `tickets/${data?.id}`, rest);
51
53
  this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
52
54
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
53
55
  this.guild = guild;
@@ -113,6 +115,7 @@ class GuildTicket {
113
115
  const response = await this.rest.request({
114
116
  method: "PATCH",
115
117
  url: route,
118
+ payload
116
119
  });
117
120
  this.customerRating = response.customerRating;
118
121
  this.manager.cache.set(this.id, this);
@@ -2,6 +2,7 @@ import { APIMessage } from "./APIMessage";
2
2
  export interface APIGuildTicket {
3
3
  /** Ticket's id */
4
4
  id: string;
5
+ _id: string;
5
6
  /** Ticket's creator id */
6
7
  creatorId: string;
7
8
  /** Ticket's admin id */
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duque.edits/sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "typings": "./dist/index.d.ts",