Verify working
diff --git a/src/api/index.ts b/src/api/index.ts
index d6d2a5a..c24327d 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -39,18 +39,16 @@
embeds: [
new EmojiEmbed()
.setTitle("Verify")
- .setDescription("Verification complete")
+ .setDescription("Verification complete! You can now dismiss this message")
.setStatus("Success")
.setEmoji("MEMBER.JOIN")
],
components: []
});
- // client.verify.filter((v: VerifySchema) => v.code !== code);
- // delete the key by creating a new object without the key
client.verify = Object.keys(client.verify)
.filter((k) => k !== code)
.reduce((obj, key) => {return { ...obj, [key]: client.verify[key]}}, {});
- const { log, NucleusColors, entry, renderUser } = client.logger;
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
try {
const data = {
meta: {
@@ -62,8 +60,8 @@
timestamp: new Date().getTime()
},
list: {
- memberId: entry(member.id, `\`${member.id}\``),
- member: entry(member.id, renderUser(member.user))
+ member: entry(member.id, renderUser(member.user)),
+ verified: entry(member.joinedTimestamp, renderDelta(member.joinedTimestamp!))
},
hidden: {
guild: guild.id
@@ -89,7 +87,7 @@
new EmojiEmbed()
.setTitle("Verify")
.setDescription(
- "Verify was opened in another tab or window, please complete the CAPTCHA there to continue"
+ "Verify was opened in another tab or window, please complete the check there to continue"
)
.setStatus("Success")
.setEmoji("MEMBER.JOIN")
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 405734e..7d5ac13 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -47,8 +47,9 @@
entry = client.logger.entry;
if (newChannel.parent && newChannel.parent.id === config.tickets.category) return;
- const auditLog: GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> = (await getAuditLog(newChannel.guild, AuditLogEvent.ChannelUpdate))
- .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildChannel)!.id === newChannel.id)[0] as GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate>;
+ const auditLog: null | GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> = (await getAuditLog(newChannel.guild, AuditLogEvent.ChannelUpdate))
+ .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildChannel)!.id === newChannel.id)[0] as GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> | null;
+ if (!auditLog) return;
if (auditLog.executor!.id === client.user!.id) return;
let emoji: string;
@@ -86,7 +87,6 @@
newTopic = "None";
}
const nsfw = ["", ""];
-console.log((oldChannel as TextChannel).rateLimitPerUser, (newChannel as TextChannel).rateLimitPerUser);
nsfw[0] = (oldChannel as TextChannel).nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
nsfw[1] = (newChannel as TextChannel).nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
if ((oldChannel as TextChannel).topic !== (newChannel as TextChannel).topic)
diff --git a/src/events/commandError.ts b/src/events/commandError.ts
index 8ed01d2..ff5f4ae 100644
--- a/src/events/commandError.ts
+++ b/src/events/commandError.ts
@@ -6,26 +6,19 @@
export const event = "commandError";
export async function callback(_: NucleusClient, interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction, error: string) {
+ const embed = new EmojiEmbed()
+ .setTitle("Something went wrong")
+ .setDescription(error)
+ .setStatus("Danger")
+ .setEmoji("CONTROL.BLOCKCROSS")
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
- embeds: [
- new EmojiEmbed()
- .setTitle("Something went wrong")
- .setDescription(error)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ],
+ embeds: [embed],
ephemeral: true
});
} else {
await interaction.reply({
- embeds: [
- new EmojiEmbed()
- .setTitle("Something went wrong")
- .setDescription(error)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ],
+ embeds: [embed],
ephemeral: true
});
}
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index e30fc35..8889f57 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -4,129 +4,126 @@
export const event = "guildMemberUpdate";
export async function callback(client: NucleusClient, before: GuildMember, after: GuildMember) {
- try {
- const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
- const auditLog = (await getAuditLog(after.guild, AuditLogEvent.EmojiCreate))
- .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0]!;
- if (auditLog.executor!.id === client.user!.id) return;
- if (before.nickname !== after.nickname) {
- await client.database.history.create(
- "nickname",
- after.guild.id,
- after.user,
- auditLog.executor,
- null,
- before.nickname ?? before.user.username,
- after.nickname ?? after.user.username
- );
- const data = {
- meta: {
- type: "memberUpdate",
- displayName: "Nickname Changed",
- calculateType: "guildMemberUpdate",
- color: NucleusColors.yellow,
- emoji: "PUNISH.NICKNAME.YELLOW",
- timestamp: new Date().getTime()
- },
- list: {
- memberId: entry(after.id, `\`${after.id}\``),
- name: entry(after.user.id, renderUser(after.user)),
- before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
- after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
- changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- changedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
- },
- hidden: {
- guild: after.guild.id
- }
- };
- log(data);
- } else if (
- (before.communicationDisabledUntilTimestamp ?? 0) < new Date().getTime() &&
- (after.communicationDisabledUntil ?? 0) > new Date().getTime() // TODO: test this
- ) {
- await client.database.history.create(
- "mute",
- after.guild.id,
- after.user,
- auditLog.executor,
- auditLog.reason,
- null,
- null,
- null
- );
- const data = {
- meta: {
- type: "memberMute",
- displayName: "Muted",
- calculateType: "guildMemberPunish",
- color: NucleusColors.yellow,
- emoji: "PUNISH.MUTE.YELLOW",
- timestamp: new Date().getTime()
- },
- list: {
- memberId: entry(after.id, `\`${after.id}\``),
- name: entry(after.user.id, renderUser(after.user)),
- mutedUntil: entry(
- after.communicationDisabledUntilTimestamp,
- renderDelta(after.communicationDisabledUntilTimestamp!)
- ),
- muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- mutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!)),
- reason: entry(auditLog.reason, auditLog.reason ? auditLog.reason : "\n> *No reason provided*")
- },
- hidden: {
- guild: after.guild.id
- }
- };
- log(data);
- client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil?.toISOString()!, {
- guild: after.guild.id,
- user: after.id,
- expires: after.communicationDisabledUntilTimestamp
- });
- } else if (
- after.communicationDisabledUntil === null &&
- before.communicationDisabledUntilTimestamp !== null &&
- new Date().getTime() >= auditLog.createdTimestamp
- ) {
- await client.database.history.create(
- "unmute",
- after.guild.id,
- after.user,
- auditLog.executor,
- null,
- null,
- null,
- null
- );
- const data = {
- meta: {
- type: "memberUnmute",
- displayName: "Unmuted",
- calculateType: "guildMemberPunish",
- color: NucleusColors.green,
- emoji: "PUNISH.MUTE.GREEN",
- timestamp: new Date().getTime()
- },
- list: {
- memberId: entry(after.id, `\`${after.id}\``),
- name: entry(after.user.id, renderUser(after.user)),
- unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- unmutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
- },
- hidden: {
- guild: after.guild.id
- }
- };
- log(data);
- client.database.eventScheduler.cancel("naturalUnmute", {
- guild: after.guild.id,
- user: after.id,
- expires: before.communicationDisabledUntilTimestamp
- });
- }
- } catch (e) {
- console.log(e);
+ const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
+ const auditLog = (await getAuditLog(after.guild, AuditLogEvent.EmojiCreate))
+ .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0];
+ if (!auditLog) return;
+ if (auditLog.executor!.id === client.user!.id) return;
+ if (before.nickname !== after.nickname) {
+ await client.database.history.create(
+ "nickname",
+ after.guild.id,
+ after.user,
+ auditLog.executor,
+ null,
+ before.nickname ?? before.user.username,
+ after.nickname ?? after.user.username
+ );
+ const data = {
+ meta: {
+ type: "memberUpdate",
+ displayName: "Nickname Changed",
+ calculateType: "guildMemberUpdate",
+ color: NucleusColors.yellow,
+ emoji: "PUNISH.NICKNAME.YELLOW",
+ timestamp: new Date().getTime()
+ },
+ list: {
+ memberId: entry(after.id, `\`${after.id}\``),
+ name: entry(after.user.id, renderUser(after.user)),
+ before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
+ after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
+ changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ changedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
+ },
+ hidden: {
+ guild: after.guild.id
+ }
+ };
+ log(data);
+ } else if (
+ (before.communicationDisabledUntilTimestamp ?? 0) < new Date().getTime() &&
+ (after.communicationDisabledUntil ?? 0) > new Date().getTime() // TODO: test this
+ ) {
+ await client.database.history.create(
+ "mute",
+ after.guild.id,
+ after.user,
+ auditLog.executor,
+ auditLog.reason,
+ null,
+ null,
+ null
+ );
+ const data = {
+ meta: {
+ type: "memberMute",
+ displayName: "Muted",
+ calculateType: "guildMemberPunish",
+ color: NucleusColors.yellow,
+ emoji: "PUNISH.MUTE.YELLOW",
+ timestamp: new Date().getTime()
+ },
+ list: {
+ memberId: entry(after.id, `\`${after.id}\``),
+ name: entry(after.user.id, renderUser(after.user)),
+ mutedUntil: entry(
+ after.communicationDisabledUntilTimestamp,
+ renderDelta(after.communicationDisabledUntilTimestamp!)
+ ),
+ muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ mutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!)),
+ reason: entry(auditLog.reason, auditLog.reason ? auditLog.reason : "\n> *No reason provided*")
+ },
+ hidden: {
+ guild: after.guild.id
+ }
+ };
+ log(data);
+ client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil?.toISOString()!, {
+ guild: after.guild.id,
+ user: after.id,
+ expires: after.communicationDisabledUntilTimestamp
+ });
+ } else if (
+ after.communicationDisabledUntil === null &&
+ before.communicationDisabledUntilTimestamp !== null &&
+ new Date().getTime() >= auditLog.createdTimestamp
+ ) {
+ await client.database.history.create(
+ "unmute",
+ after.guild.id,
+ after.user,
+ auditLog.executor,
+ null,
+ null,
+ null,
+ null
+ );
+ const data = {
+ meta: {
+ type: "memberUnmute",
+ displayName: "Unmuted",
+ calculateType: "guildMemberPunish",
+ color: NucleusColors.green,
+ emoji: "PUNISH.MUTE.GREEN",
+ timestamp: new Date().getTime()
+ },
+ list: {
+ memberId: entry(after.id, `\`${after.id}\``),
+ name: entry(after.user.id, renderUser(after.user)),
+ unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ unmutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
+ },
+ hidden: {
+ guild: after.guild.id
+ }
+ };
+ log(data);
+ client.database.eventScheduler.cancel("naturalUnmute", {
+ guild: after.guild.id,
+ user: after.id,
+ expires: before.communicationDisabledUntilTimestamp
+ });
}
}
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index 4977c64..573da5e 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -128,7 +128,7 @@
new EmojiEmbed()
.setTitle("Verify")
.setDescription(
- "Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake" +
+ "Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact a staff members if you believe this is a mistake" +
step(1)
)
.setStatus("Danger")