Skip to content

Commit

Permalink
camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
Starman3787 committed Aug 19, 2024
1 parent 66214ab commit d75a0f7
Show file tree
Hide file tree
Showing 53 changed files with 1,044 additions and 1,966 deletions.
56 changes: 28 additions & 28 deletions src/gateway/eventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class EventHandler {
);

const role = new Role(this.#_client, data.role, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.GUILD_ROLE_CREATE, role);
Expand All @@ -161,7 +161,7 @@ class EventHandler {
.get(data.guild_id)
?.roles.get(data.role.id);
const newRole = new Role(this.#_client, data.role, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.GUILD_ROLE_UPDATE, oldRole, newRole);
Expand Down Expand Up @@ -235,7 +235,7 @@ class EventHandler {
`THREAD_CREATE ${data.guild_id}`,
);

const thread = new Thread(this.#_client, data, { guild_id: data.guild_id });
const thread = new Thread(this.#_client, data, { guildId: data.guild_id });

this.#_client.emit(EVENTS.THREAD_CREATE, thread);
}
Expand All @@ -250,7 +250,7 @@ class EventHandler {
.get(data.guild_id)
?.channels.get(data.id);
const newThread = new Thread(this.#_client, data, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.THREAD_UPDATE, oldThread, newThread);
Expand Down Expand Up @@ -279,7 +279,7 @@ class EventHandler {
const threads = [];
for (let i = 0; i < data.threads.length; i++)
threads.push(
new Thread(this.#_client, data.threads[i], { guild_id: data.guild_id }),
new Thread(this.#_client, data.threads[i], { guildId: data.guild_id }),
);

this.#_client.emit(EVENTS.THREAD_LIST_SYNC, threads);
Expand All @@ -292,8 +292,8 @@ class EventHandler {
);

const member = new Member(this.#_client, data, {
user_id: data.user.id,
guild_id: data.guild_id,
userId: data.user.id,
guildId: data.guild_id,
user: data.user,
});

Expand Down Expand Up @@ -338,8 +338,8 @@ class EventHandler {
.get(data.user.id, { useRules: true })
.then((oldMember) => {
const newMember = new Member(this.#_client, data, {
user_id: data.user.id,
guild_id: data.guild_id,
userId: data.user.id,
guildId: data.guild_id,
user: data.user,
});

Expand All @@ -355,8 +355,8 @@ class EventHandler {

for (let i = 0; i < data.members.length; i++)
new Member(this.#_client, data.members[i], {
user_id: data.members[i].user.id,
guild_id: data.guild_id,
userId: data.members[i].user.id,
guildId: data.guild_id,
user: data.members[i].user,
});
}
Expand Down Expand Up @@ -393,7 +393,7 @@ class EventHandler {
`INVITE_CREATE ${data.guild_id}`,
);

const invite = new Invite(this.#_client, data, { guild_id: data.guild_id });
const invite = new Invite(this.#_client, data, { guildId: data.guild_id });

this.#_client.emit(EVENTS.INVITE_CREATE, invite);
}
Expand Down Expand Up @@ -425,7 +425,7 @@ class EventHandler {
let newVoiceState;
if (data.channel_id)
newVoiceState = new VoiceState(this.#_client, data, {
guild_id: data.guild_id,
guildId: data.guild_id,
});
else {
newVoiceState = null;
Expand Down Expand Up @@ -453,8 +453,8 @@ class EventHandler {
);

const message = new Message(this.#_client, data, {
channel_id: data.channel_id,
guild_id: data.guild_id,
channelId: data.channel_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.MESSAGE_CREATE, message);
Expand All @@ -474,8 +474,8 @@ class EventHandler {
.get(data.id, { useRules: true })
.then((oldMessage) => {
const newMessage = new Message(this.#_client, data, {
channel_id: data.channel_id,
guild_id: data.guild_id,
channelId: data.channel_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.MESSAGE_UPDATE, oldMessage, newMessage);
Expand Down Expand Up @@ -536,8 +536,8 @@ class EventHandler {
switch (data.data.component_type) {
case COMPONENT_TYPES.BUTTON: {
const componentInteraction = new ButtonClick(this.#_client, data, {
guild_id: data.guild_id,
channel_id: data.channel_id,
guildId: data.guild_id,
channelId: data.channel_id,
});

this.#_client.emit(EVENTS.BUTTON_CLICK, componentInteraction);
Expand All @@ -551,8 +551,8 @@ class EventHandler {
case COMPONENT_TYPES.MENTIONABLE_SELECT_MENU:
case COMPONENT_TYPES.CHANNEL_SELECT_MENU: {
const componentInteraction = new OptionSelect(this.#_client, data, {
guild_id: data.guild_id,
channel_id: data.channel_id,
guildId: data.guild_id,
channelId: data.channel_id,
});

this.#_client.emit(EVENTS.MENU_SELECT, componentInteraction);
Expand Down Expand Up @@ -606,7 +606,7 @@ class EventHandler {
);

const auditLogEntry = new AuditLog(this.#_client, data, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.GUILD_AUDIT_LOG_ENTRY_CREATE, auditLogEntry);
Expand Down Expand Up @@ -646,7 +646,7 @@ class EventHandler {
);

const scheduledEvent = new ScheduledEvent(this.#_client, data, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.GUILD_SCHEDULED_EVENT_CREATE, scheduledEvent);
Expand All @@ -662,7 +662,7 @@ class EventHandler {
this.#_client.guilds.get(data.guild_id)?.scheduled_events.get(data.id) ||
null;
const newScheduledEvent = new ScheduledEvent(this.#_client, data, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(
Expand Down Expand Up @@ -799,7 +799,7 @@ class EventHandler {
}

const addedEmoji = new Emoji(this.#_client, addedEmojiRaw, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.GUILD_EMOJI_CREATE, addedEmoji);
Expand Down Expand Up @@ -842,7 +842,7 @@ class EventHandler {
const correspondingNewEmoji = new Emoji(
this.#_client,
correspondingNewEmojiRaw,
{ guild_id: data.guild_id },
{ guildId: data.guild_id },
);

const differences = deepCompare(
Expand Down Expand Up @@ -933,7 +933,7 @@ class EventHandler {
const finalData = data;

finalData.emoji = new Emoji(this.#_client, data.emoji, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.MESSAGE_REACTION_ADD, finalData);
Expand Down Expand Up @@ -962,7 +962,7 @@ class EventHandler {
const finalData = data;

finalData.emoji = new Emoji(this.#_client, data.emoji, {
guild_id: data.guild_id,
guildId: data.guild_id,
});

this.#_client.emit(EVENTS.MESSAGE_REACTION_REMOVE, finalData);
Expand Down
10 changes: 5 additions & 5 deletions src/managers/ChannelMessageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class ChannelMessageManager extends BaseCacheManager {
for (let i = 0; i < data.length; i++)
messages.push(
new Message(this.#_client, data[i], {
channel_id: data[i].channel_id,
guild_id: this.#channel.guild.id,
channelId: data[i].channel_id,
guildId: this.#channel.guild.id,
}),
);
return messages;
Expand Down Expand Up @@ -248,7 +248,7 @@ class ChannelMessageManager extends BaseCacheManager {

return new Message(client, data, {
channelId,
guild_id: guildId,
guildId,
});
}

Expand Down Expand Up @@ -345,8 +345,8 @@ class ChannelMessageManager extends BaseCacheManager {
for (let i = 0; i < data.length; i++)
messages.push(
new Message(client, data[i], {
channel_id: data[i].channel_id,
guild_id: guildId,
channelId: data[i].channel_id,
guildId,
}),
);
return messages;
Expand Down
2 changes: 1 addition & 1 deletion src/managers/GuildEmojisManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GuildEmojisManager extends BaseCacheManager {
emoji_id,
]);

return new Emoji(this.#_client, data, { guild_id: this.#guild.id });
return new Emoji(this.#_client, data, { guildId: this.#guild.id });
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/managers/GuildInviteManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class GuildInviteManager extends BaseCacheManager {
this.clear();

return data.map(
(raw) => new Invite(this.#_client, raw, { guild_id: this.#guild.id }),
(raw) => new Invite(this.#_client, raw, { guildId: this.#guild.id }),
);
}

Expand Down
10 changes: 6 additions & 4 deletions src/managers/GuildMemberManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class GuildMemberManager extends BaseCacheManager {
for (let i = 0; i < data.length; i++)
members.push(
new Member(this.#_client, data[i], {
user_id: data[i].user.id,
guild_id: this.#guild.id,
userId: data[i].user.id,
guildId: this.#guild.id,
user: data[i].user,
}),
);
Expand Down Expand Up @@ -179,6 +179,8 @@ class GuildMemberManager extends BaseCacheManager {
* @static
*/
static async search(client, guildId, query) {
if (!(client instanceof Client))
throw new TypeError("GLUON: Client must be a Client instance.");
if (typeof guildId !== "string")
throw new TypeError("GLUON: Guild ID is not a string.");
if (typeof query !== "string")
Expand All @@ -201,8 +203,8 @@ class GuildMemberManager extends BaseCacheManager {
for (let i = 0; i < data.length; i++)
members.push(
new Member(client, data[i], {
user_id: data[i].user.id,
guild_id: guildId.toString(),
userId: data[i].user.id,
guildId,
user: data[i].user,
}),
);
Expand Down
9 changes: 3 additions & 6 deletions src/managers/GuildRoleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class GuildRoleManager extends BaseCacheManager {
let matchedRole;
for (let i = 0; i < data.length; i++) {
const role = new Role(this.#_client, data[i], {
guild_id: this.#guild.id,
guildId: this.#guild.id,
});
if (role.id == role_id) matchedRole = role;
}
Expand Down Expand Up @@ -136,8 +136,6 @@ class GuildRoleManager extends BaseCacheManager {
if (typeof roleId !== "undefined" && typeof roleId !== "string")
throw new TypeError("GLUON: Role ID is not a string.");

const guild = client.guilds.get(guildId);

if (roleId) {
const cachedRole = GuildRoleManager.getRole(client, guildId, roleId);
if (cachedRole) return cachedRole;
Expand All @@ -151,12 +149,11 @@ class GuildRoleManager extends BaseCacheManager {

const data = await client.request.makeRequest("getRoles", [guildId]);

if (!roleId)
return data.map((role) => new Role(client, role, { guild_id: guildId }));
if (!roleId) return data.map((role) => new Role(client, role, { guildId }));

let matchedRole;
for (let i = 0; i < data.length; i++) {
const role = new Role(client, data[i], { guild_id: guildId });
const role = new Role(client, data[i], { guildId });
if (role.id === roleId) matchedRole = role;
}

Expand Down
4 changes: 2 additions & 2 deletions src/managers/GuildScheduledEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GuildScheduledEventManager extends BaseCacheManager {
for (let i = 0; i < data.length; i++)
eventsList.push(
new ScheduledEvent(this.#_client, data[i], {
guild_id: this.#guild.id,
guildId: this.#guild.id,
}),
);

Expand Down Expand Up @@ -70,7 +70,7 @@ class GuildScheduledEventManager extends BaseCacheManager {
);

return new ScheduledEvent(this.#_client, data, {
guild_id: this.#guild.id,
guildId: this.#guild.id,
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/managers/MessageReactionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MessageReactionManager {
this.#cache[messageReaction] = new Reaction(
this.#_client,
messageReactionValue,
{ guild_id: this.#guild.id },
{ guildId: this.#guild.id },
);
}

Expand All @@ -65,7 +65,7 @@ class MessageReactionManager {

if (!this.#cache[emoji])
this.#cache[emoji] = new Reaction(this.#_client, data, {
guild_id: this.#guild.id,
guildId: this.#guild.id,
});

this.#cache[emoji]._addReactor(user_id);
Expand Down
4 changes: 2 additions & 2 deletions src/structures/Attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Attachment {
* @param {Client} client The client instance.
* @param {Object} data Attachment data from Discord.
*/
constructor(client, data, { channel_id } = {}) {
constructor(client, data, { channelId } = {}) {
/**
* The client instance.
* @type {Client}
Expand Down Expand Up @@ -66,7 +66,7 @@ class Attachment {
* @type {BigInt?}
* @private
*/
if (channel_id) this.#_channel_id = BigInt(channel_id);
if (channelId) this.#_channel_id = BigInt(channelId);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/structures/AuditLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AuditLog {
* @param {Object} data Audit log data from Discord.
* @param {Array<Object>} users Resolved users who are involved with the audit log entries.
*/
constructor(client, data, { users, guild_id } = {}) {
constructor(client, data, { users, guildId } = {}) {
/**
* The client instance.
* @type {Client}
Expand All @@ -51,7 +51,7 @@ class AuditLog {
* @type {BigInt}
* @private
*/
this.#_guild_id = BigInt(guild_id);
this.#_guild_id = BigInt(guildId);

/**
* The type of action that occurred.
Expand Down
Loading

0 comments on commit d75a0f7

Please sign in to comment.