revbot.js 0.1.0 → 0.1.2

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.
package/dist/index.d.mts CHANGED
@@ -265,6 +265,10 @@ interface ClientEvents {
265
265
  interface clientOptions {
266
266
  /** Whether to fetch all members of a server. */
267
267
  fetchMembers?: boolean;
268
+ /** events for the client to ignore.*/
269
+ ignoreEvents?: string[];
270
+ /** Whether to ignore bot messages. */
271
+ ignoreBots?: boolean;
268
272
  /** wether to use X-Session-Token or X-Bot-Token*/
269
273
  isBot?: boolean;
270
274
  /** Configuration for REST API requests. */
@@ -597,6 +601,7 @@ declare class User extends Base {
597
601
  * @returns {Date} The date when the user was created.
598
602
  */
599
603
  get createdAt(): Date;
604
+ get isOwner(): boolean;
600
605
  /**
601
606
  * Gets the creation timestamp of the user in milliseconds.
602
607
  *
@@ -2044,6 +2049,8 @@ declare class UserManager extends BaseManager<User, User$1> {
2044
2049
  declare class ClientUser extends User {
2045
2050
  /** The notes channel associated with the client user, if any. */
2046
2051
  notes: NotesChannel | null;
2052
+ owner: string | null;
2053
+ constructor(client: client, data: User$1);
2047
2054
  /**
2048
2055
  * Updates the username of the client user.
2049
2056
  *
package/dist/index.d.ts CHANGED
@@ -265,6 +265,10 @@ interface ClientEvents {
265
265
  interface clientOptions {
266
266
  /** Whether to fetch all members of a server. */
267
267
  fetchMembers?: boolean;
268
+ /** events for the client to ignore.*/
269
+ ignoreEvents?: string[];
270
+ /** Whether to ignore bot messages. */
271
+ ignoreBots?: boolean;
268
272
  /** wether to use X-Session-Token or X-Bot-Token*/
269
273
  isBot?: boolean;
270
274
  /** Configuration for REST API requests. */
@@ -597,6 +601,7 @@ declare class User extends Base {
597
601
  * @returns {Date} The date when the user was created.
598
602
  */
599
603
  get createdAt(): Date;
604
+ get isOwner(): boolean;
600
605
  /**
601
606
  * Gets the creation timestamp of the user in milliseconds.
602
607
  *
@@ -2044,6 +2049,8 @@ declare class UserManager extends BaseManager<User, User$1> {
2044
2049
  declare class ClientUser extends User {
2045
2050
  /** The notes channel associated with the client user, if any. */
2046
2051
  notes: NotesChannel | null;
2052
+ owner: string | null;
2053
+ constructor(client: client, data: User$1);
2047
2054
  /**
2048
2055
  * Updates the username of the client user.
2049
2056
  *
package/dist/index.js CHANGED
@@ -715,6 +715,10 @@ var User = class extends Base {
715
715
  get createdAt() {
716
716
  return UUID.timestampOf(this.id);
717
717
  }
718
+ get isOwner() {
719
+ var _a;
720
+ return this.id === ((_a = this.client.user) == null ? void 0 : _a.owner);
721
+ }
718
722
  /**
719
723
  * Gets the creation timestamp of the user in milliseconds.
720
724
  *
@@ -3235,7 +3239,7 @@ var import_node_events = require("events");
3235
3239
  var import_axios4 = require("axios");
3236
3240
 
3237
3241
  // package.json
3238
- var version = "0.1.0";
3242
+ var version = "0.1.2";
3239
3243
 
3240
3244
  // src/rest/restUtils/rateLimitQueue.ts
3241
3245
  var import_axios3 = __toESM(require("axios"));
@@ -3765,8 +3769,12 @@ var Message = class extends Event {
3765
3769
  */
3766
3770
  handle(data) {
3767
3771
  return __async(this, null, function* () {
3772
+ var _a;
3768
3773
  const channel = this.client.channels.cache.get(data.channel);
3769
3774
  if (channel == null ? void 0 : channel.isText()) {
3775
+ if (((_a = data.user) == null ? void 0 : _a.bot) && this.client.options.ignoreBots) {
3776
+ return {};
3777
+ }
3770
3778
  const message = channel.messages._add(data);
3771
3779
  if (data.author !== SYSTEM_USER_ID && !data.webhook) {
3772
3780
  yield this.client.users.fetch(data.author, { force: false });
@@ -4099,7 +4107,9 @@ var EventManager = class {
4099
4107
  this.client = client3;
4100
4108
  /** A map of registered events, keyed by their names. */
4101
4109
  __privateAdd(this, _events, /* @__PURE__ */ new Map());
4102
- for (const Event2 of Object.values(EventMap)) {
4110
+ var _a;
4111
+ for (const [key, Event2] of Object.entries(EventMap)) {
4112
+ if ((_a = this.client.options.ignoreEvents) == null ? void 0 : _a.includes(key)) return;
4103
4113
  this.register(Event2);
4104
4114
  }
4105
4115
  }
@@ -4126,10 +4136,14 @@ _events = new WeakMap();
4126
4136
 
4127
4137
  // src/struct/clientUser.ts
4128
4138
  var ClientUser = class extends User {
4129
- constructor() {
4130
- super(...arguments);
4139
+ constructor(client3, data) {
4140
+ var _a;
4141
+ super(client3, data);
4131
4142
  /** The notes channel associated with the client user, if any. */
4132
4143
  this.notes = null;
4144
+ this.owner = null;
4145
+ this._patch(data);
4146
+ this.owner = ((_a = data.bot) == null ? void 0 : _a.owner) || null;
4133
4147
  }
4134
4148
  /**
4135
4149
  * Updates the username of the client user.