forked from ChrisChrome/weather-bot
Add perm check to subscribe command
This commit is contained in:
parent
e952ec60e7
commit
4bb679cef8
5
index.js
5
index.js
|
@ -832,6 +832,8 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
filterEvt = interaction.options.getString("filterevt") || null;
|
filterEvt = interaction.options.getString("filterevt") || null;
|
||||||
message = interaction.options.getString("message") || null;
|
message = interaction.options.getString("message") || null;
|
||||||
if (interaction.inGuild()) {
|
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) => {
|
db.get(`SELECT * FROM channels WHERE channelid = ? AND iemchannel = ?`, [interaction.channel.id, room], (err, row) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
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
|
} else { // We're in a DM
|
||||||
db.get(`SELECT * FROM userAlerts WHERE userid = ? AND iemchannel = ?`, [interaction.user.id, room], (err, row) => {
|
db.get(`SELECT * FROM userAlerts WHERE userid = ? AND iemchannel = ?`, [interaction.user.id, room], (err, row) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in a new issue