file description import type { GuildChannel } from "eris" ; import { Guild , TextChannel } from "eris" ; import { Event } from "./Event" ; export abstract class Logger extends Event { async getChannel ( channel , type , event , cfg ? ) { let guild ; if ( type !== "eventLogging" && type !== "memberLogging" && type !== "messageLogging" && type !== "pinChannel" ) type = "modLogging" ; if ( channel ?. constructor === Guild ) guild = channel ; else guild = ( channel as GuildChannel ) ?. guild ; if ( ! guild ) return ; const guildconfig = cfg || ( await this . bot . db . getGuildConfig ( guild . id ) ) ; if ( ! guildconfig ) return null ; if ( channel instanceof TextChannel && guildconfig ?. ignoredLoggingChannels ?. includes ?. ( ( channel as unknown ) as string ) ) { return null ; } if ( guildconfig . disabledEvents && guildconfig . disabledEvents . includes ( event ) ) return null ; let channelID = type ? guildconfig [ type ] : guildconfig . loggingChannel ; if ( channel instanceof Guild || channel . id !== channelID ) { if ( ! guild . channels . get ( channelID ) ) { delete guildconfig [ type || "loggingChannel" ] ; this . bot . db . replaceGuildConfig ( guild . id , guildconfig ) ; channelID = undefined ; } } return channelID ; } }