Skip to content

Commit

Permalink
fix: додана перевірка на наявність каналу логів
Browse files Browse the repository at this point in the history
  • Loading branch information
GamesTwoLife committed Dec 15, 2023
1 parent 1bf965f commit 7765f9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ process.on('unhandledRejection', async (error) => {
*/
const channel = client.channels.cache.get(channelId);

if (!channel || !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(error);
if (!channel || channel && !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(error);

try {
const webhooks = await channel.fetchWebhooks();
Expand Down Expand Up @@ -100,7 +100,7 @@ process.on('uncaughtException', async (error) => {
*/
const channel = client.channels.cache.get(channelId);

if (!channel || !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(error);
if (!channel || channel && !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(error);

try {
const webhooks = await channel.fetchWebhooks();
Expand Down Expand Up @@ -141,7 +141,7 @@ process.on('rejectionHandled', async (error) => {
*/
const channel = client.channels.cache.get(channelId);

if (!channel || !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(error);
if (!channel || channel && !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(error);

try {
const webhooks = await channel.fetchWebhooks();
Expand Down Expand Up @@ -182,7 +182,7 @@ process.on('warning', async (warning) => {
*/
const channel = client.channels.cache.get(channelId);

if (!channel || !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(warning);
if (!channel || channel && !channel.permissionsFor(client.user.id).has([PermissionsBitField.Flags.ManageChannels, PermissionsBitField.Flags.ManageWebhooks])) return console.error(warning);

try {
const webhooks = await channel.fetchWebhooks();
Expand Down

0 comments on commit 7765f9a

Please sign in to comment.