diff --git a/index.js b/index.js index dd1ed07..09868a5 100644 --- a/index.js +++ b/index.js @@ -489,6 +489,37 @@ xmpp.on("stanza", (stanza) => { } ] }); + + discord.users.fetch(channel.guild.ownerId).then((user) => { + user.send({ + embeds: [ + { + title: "Issue with your subscribed channel.", + description: `There is likely an issue with permissions. Please check that I can send messages in <#${channel.id}>\nYour subscription has been removed, and you will need to resubscribe to get alerts.`, + color: 0xff0000, + fields: [ + { + name: "Guild", + value: `${channel.guild.name} (${channel.guild.id})` + }, + { + name: "Channel", + value: `${channel.name} (${channel.id})` + } + ] + } + ] + }).catch((err) => { + console.log(`${colors.red("[ERROR]")} Failed to send message to ${channel.guild.ownerId}`); + }).then(() => { + db.run(`DELETE FROM channels WHERE channelid = ? AND iemchannel = ?`, [channel.id, fromChannel], (err) => { + if (err) { + console.error(err.message); + } + console.log(`${colors.cyan("[INFO]")} Deleted channel ${channel.id} from database`); + }); + }) + }); }); }); }).catch((err) => {