made minor fixed
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 37b703e..8644e26 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -29,7 +29,7 @@
if (!interaction.guild) return;
const user = (interaction.options.getMember("user") as GuildMember | null);
const channel = interaction.channel as GuildChannel;
- if (channel.isTextBased()) {
+ if (!channel.isTextBased()) {
return await interaction.reply({
embeds: [
new EmojiEmbed()
diff --git a/src/commands/nucleus/_meta.ts b/src/commands/nucleus/_meta.ts
index 521b338..bd7fd14 100644
--- a/src/commands/nucleus/_meta.ts
+++ b/src/commands/nucleus/_meta.ts
@@ -3,8 +3,6 @@
const name = "nucleus";
const description = "Commands relating to Nucleus itself";
-const subcommand = await command(name, description, `nucleus`)
+const subcommand = await command(name, description, `nucleus`, undefined, undefined, undefined, undefined, true);
-const allowedInDMs = true;
-
-export { name, description, subcommand as command, allowedInDMs };
+export { name, description, subcommand as command };
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index d88a13a..33c88b0 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -181,7 +181,7 @@
}
async function execute(check: Function | undefined, callback: Function | undefined, data: CommandInteraction) {
- console.log(client.commands["contextCommands/user/User info"])
+ // console.log(client.commands["contextCommands/user/User info"])
if (!callback) return;
if (check) {
let result;
diff --git a/src/utils/database.ts b/src/utils/database.ts
index b7971c3..88efc70 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -3,6 +3,7 @@
import { Collection, MongoClient } from "mongodb";
import config from "../config/main.js";
import client from "../utils/client.js";
+import * as crypto from "crypto";
const mongoClient = new MongoClient(config.mongoUrl);
await mongoClient.connect();
@@ -133,7 +134,8 @@
topRole: {
color: number;
badgeURL?: string;
- }
+ };
+ bot: boolean;
}
interface TranscriptAttachment {
@@ -178,7 +180,7 @@
async create(transcript: Omit<TranscriptSchema, "code">) {
let code;
do {
- code = Math.random().toString(36).substring(2, 16) + Math.random().toString(36).substring(2, 16);
+ code = crypto.randomBytes(64).toString("base64").replace(/=/g, "").replace(/\//g, "_").replace(/\+/g, "-");
} while (await this.transcripts.findOne({ code: code }));
const doc = await this.transcripts.insertOne(Object.assign(transcript, { code: code }));
@@ -200,7 +202,9 @@
id: member!.user.id,
topRole: {
color: member!.roles.highest.color
- }
+ },
+ iconURL: member!.user.displayAvatarURL({ forceStatic: true}),
+ bot: member!.user.bot
},
guild: interaction.guild!.id,
channel: interaction.channel!.id,
@@ -212,9 +216,12 @@
id: interaction.user.id,
topRole: {
color: interactionMember?.roles.highest.color ?? 0x000000
- }
+ },
+ iconURL: interaction.user.displayAvatarURL({ forceStatic: true}),
+ bot: interaction.user.bot
}
}
+ if(member.nickname) newOut.for.nickname = member.nickname;
if(interactionMember?.roles.icon) newOut.createdBy.topRole.badgeURL = interactionMember.roles.icon.iconURL()!;
messages.reverse().forEach((message) => {
const msg: TranscriptMessage = {
@@ -225,10 +232,13 @@
id: message.author.id,
topRole: {
color: message.member!.roles.highest.color
- }
+ },
+ iconURL: member!.user.displayAvatarURL({ forceStatic: true}),
+ bot: message.author.bot
},
createdTimestamp: message.createdTimestamp
};
+ if(message.member?.nickname) msg.author.nickname = message.member.nickname;
if (message.member!.roles.icon) msg.author.topRole.badgeURL = message.member!.roles.icon.iconURL()!;
if (message.content) msg.content = message.content;
if (message.embeds.length > 0) msg.embeds = message.embeds.map(embed => {
@@ -314,6 +324,7 @@
out += `[Attachment] ${attachment.filename} (${attachment.size} bytes) ${attachment.url}\n`;
}
}
+ out += "\n\n"
}
return out
}