Add perm check to subscribe command

This commit is contained in:
Christopher Cookman 2025-01-13 14:24:01 -07:00
parent e952ec60e7
commit 4bb679cef8

View file

@ -832,6 +832,8 @@ discord.on("interactionCreate", async (interaction) => {
filterEvt = interaction.options.getString("filterevt") || null;
message = interaction.options.getString("message") || null;
if (interaction.inGuild()) {
interaction.channel.send("Permission check").then((msg) => {
msg.delete();
db.get(`SELECT * FROM channels WHERE channelid = ? AND iemchannel = ?`, [interaction.channel.id, room], (err, row) => {
if (err) {
console.error(err.message);
@ -848,6 +850,9 @@ discord.on("interactionCreate", async (interaction) => {
}
});
});
}).catch((err) => {
interaction.reply({ content: "Failed to subscribe to room. Bot does not have send message permissions here!", ephemeral: true });
});
} else { // We're in a DM
db.get(`SELECT * FROM userAlerts WHERE userid = ? AND iemchannel = ?`, [interaction.user.id, room], (err, row) => {
if (err) {