fixed intents
diff --git a/src/api/index.ts b/src/api/index.ts
index c37b25d..4b849f1 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -177,7 +177,7 @@
const id = req.params.id;
if (id === undefined) return res.status(400).send("No id provided");
const channel = await client.channels.fetch(id);
- if (channel === null) return res.status(404).send("Could not find a channel by that id");
+ if (channel === null) return res.status(400).send("Could not find a channel by that id");
if (channel.isDMBased()) return res.status(400).send("Cannot get a DM channel");
return res.status(200).send(channel.name);
});
diff --git a/src/commands/settings/tracks.ts b/src/commands/settings/tracks.ts
index cbc5f17..7e341c4 100644
--- a/src/commands/settings/tracks.ts
+++ b/src/commands/settings/tracks.ts
@@ -327,11 +327,11 @@
} else {
if (!current.track.includes(role)) {
current.track.push(role);
- await interaction.editReply({ embeds: LoadingEmbed, components: [] });
} else {
previousMessage = "That role is already on this track";
}
}
+ await interaction.editReply({ embeds: LoadingEmbed, components: [] });
break;
}
}
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index b106d61..fe2e27c 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -6,6 +6,7 @@
import client from "../utils/client.js";
import { callback as statsChannelUpdate } from "../reflex/statsChannelUpdate.js";
import { ChannelType, Message, ThreadChannel } from "discord.js";
+import singleNotify from "../utils/singleNotify.js";
export const event = "messageCreate";
@@ -19,7 +20,11 @@
message.channel.type === ChannelType.GuildAnnouncement &&
message.reference === null
) {
- await message.crosspost();
+ if(message.channel.permissionsFor(message.guild.members.me!)!.has("ManageMessages")) {
+ await message.crosspost();
+ } else {
+ singleNotify(`I don't have permissions to publish in <#${message.channel.id}>`, message.guild.id, true);
+ }
}
if (message.author.bot) return;
diff --git a/src/index.ts b/src/index.ts
index 3d0972d..875bf45 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -16,6 +16,8 @@
client.fetchedCommands = await client.application?.commands.fetch()!;
}
await client.database.premium.checkAllPremium();
+ await client.database.guilds.updateAllGuilds();
+
});
process.on("unhandledRejection", (err) => {
diff --git a/src/utils/client.ts b/src/utils/client.ts
index f443d24..f07c8aa 100644
--- a/src/utils/client.ts
+++ b/src/utils/client.ts
@@ -50,7 +50,7 @@
> = {};
fetchedCommands = new Collection<string, Discord.ApplicationCommand>();
constructor(database: typeof NucleusClient.prototype.database) {
- super({ intents: 0b1100011011011111111111 });
+ super({ intents: 3276543 });
this.database = database;
}
}
diff --git a/src/utils/database.ts b/src/utils/database.ts
index b6864b8..8f37466 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -46,6 +46,19 @@
return entry ?? {};
}
+ async updateAllGuilds() {
+ const guilds = await this.guilds.find().toArray();
+ for (const guild of guilds) {
+ let guildObj;
+ try {
+ guildObj = await client.guilds.fetch(guild.id);
+ } catch (e) {
+ guildObj = null;
+ }
+ if(!guildObj) await this.delete(guild.id);
+ }
+ }
+
async read(guild: string): Promise<GuildConfig> {
// console.log("Guild read")
const entry = await this.guilds.findOne({ id: guild });