Notify guild owners and remove subs
Some checks are pending
ptero-push / build (push) Waiting to run
Some checks are pending
ptero-push / build (push) Waiting to run
This commit is contained in:
parent
0227979176
commit
e952ec60e7
31
index.js
31
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) => {
|
||||
|
|
Loading…
Reference in a new issue