mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 07:48:32 +00:00
Trycatch
This commit is contained in:
parent
0e6f19ff67
commit
733de54d01
1 changed files with 18 additions and 14 deletions
|
@ -141,22 +141,26 @@ export default definePlugin({
|
||||||
authors: [Devs.Inbestigator],
|
authors: [Devs.Inbestigator],
|
||||||
flux: {
|
flux: {
|
||||||
async MESSAGE_CREATE({ optimistic, type, message, guildId, channelId }: IMessageCreate) {
|
async MESSAGE_CREATE({ optimistic, type, message, guildId, channelId }: IMessageCreate) {
|
||||||
if (optimistic || type !== "MESSAGE_CREATE") return;
|
try {
|
||||||
if (message.state === "SENDING") return;
|
if (optimistic || type !== "MESSAGE_CREATE") return;
|
||||||
if (!message.content) return;
|
if (message.state === "SENDING") return;
|
||||||
const currentUser = UserStore.getCurrentUser();
|
if (!message.content) return;
|
||||||
if (message.author.id === currentUser.id) return;
|
const currentUser = UserStore.getCurrentUser();
|
||||||
if (await PresenceStore.getStatus(currentUser.id) != 'dnd') return;
|
if (message.author.id === currentUser.id) return;
|
||||||
if ((bypasses.guilds.includes(guildId) || bypasses.channels.includes(channelId)) && (message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id))) {
|
if (await PresenceStore.getStatus(currentUser.id) != 'dnd') return;
|
||||||
await showChannelNotification(message);
|
if ((bypasses.guilds.includes(guildId) || bypasses.channels.includes(channelId)) && (message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id))) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (bypasses.users.includes(message.author.id)) {
|
|
||||||
if (channelId === await PrivateChannelsStore.getOrEnsurePrivateChannel(message.author.id)) {
|
|
||||||
await showUserNotification(message);
|
|
||||||
} else if ((message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id)) && settings.store.allowOutsideOfDms) {
|
|
||||||
await showChannelNotification(message);
|
await showChannelNotification(message);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (bypasses.users.includes(message.author.id)) {
|
||||||
|
if (channelId === await PrivateChannelsStore.getOrEnsurePrivateChannel(message.author.id)) {
|
||||||
|
await showUserNotification(message);
|
||||||
|
} else if ((message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id)) && settings.store.allowOutsideOfDms) {
|
||||||
|
await showChannelNotification(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue