Linting
This commit is contained in:
@@ -2,20 +2,30 @@ import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.addons.linkCop");
|
||||
import { gptHandler } from "../modules/gptHandler.mjs";
|
||||
import dotenv from "dotenv";
|
||||
import { getGuildConfig, setGuildConfig } from "../../modules/mongo-wrappers/mongoConfigWrappers.mjs";
|
||||
import {
|
||||
getGuildConfig,
|
||||
setGuildConfig,
|
||||
} from "../../modules/mongo-wrappers/mongoConfigWrappers.mjs";
|
||||
dotenv.config();
|
||||
|
||||
const linkRegExp = /http[s]?:\/\/\S+/g;
|
||||
|
||||
export const linkCop = async (nodeIo, message) => {
|
||||
// Set the channel IDs based on the guild the message was sent in
|
||||
const approvedLinksChannel = await getGuildConfig(message.guild.id, "approvedLinksChannel") || "767303243285790721";
|
||||
const restrictedChannelIds = await getGuildConfig(message.guild.id, "restrictedChannelIds");
|
||||
const approvedLinksChannel =
|
||||
(await getGuildConfig(message.guild.id, "approvedLinksChannel")) ||
|
||||
"767303243285790721";
|
||||
const restrictedChannelIds = await getGuildConfig(
|
||||
message.guild.id,
|
||||
"restrictedChannelIds",
|
||||
);
|
||||
|
||||
// Check if the message was sent in an restricted channel
|
||||
if (
|
||||
message.channel.id == approvedLinksChannel || !Array.isArray(restrictedChannelIds) ||
|
||||
(Array.isArray(restrictedChannelIds) || !restrictedChannelIds.includes(message.channel.id))
|
||||
message.channel.id == approvedLinksChannel ||
|
||||
!Array.isArray(restrictedChannelIds) ||
|
||||
Array.isArray(restrictedChannelIds) ||
|
||||
!restrictedChannelIds.includes(message.channel.id)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user