// Galactic - Discord moderation bot // Copyright (C) 2024 Navy.gif // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see . import { ChannelType, Snowflake } from 'discord.js'; import { AutomodSettings, AutoroleSettings, CommandSettings, DMInfractionSettings, ErrorLogSettings, GrantableSettings, IgnoreSettings, IndexingSettings, InviteFilterSettings, LinkfilterSettings, LocaleSettings, MemberLogSettings, MentionFilterSettings, MessagesSettings, ModerationPointsSettings, ModerationSettings, MuteSettings, NicknameLogSettings, PermissionSettings, ProtectionSettings, RaidprotectionSettings, RejoinSettings, SelfroleSettings, SilenceSettings, StaffSettings, StickyRoleSettings, TextCommandsSettings, VoiceSettings, WelcomerSettings, WordFilterSettings, WordWatcherSettings } from './Settings.js'; import { ObjectId } from 'mongodb'; import { EntityData, EntitySettings } from './Client.ts'; export type GuildSettingTypes = | AutomodSettings | AutoroleSettings | CommandSettings | DMInfractionSettings | ErrorLogSettings | GrantableSettings | IgnoreSettings | IndexingSettings | InviteFilterSettings | LinkfilterSettings | MemberLogSettings | MentionFilterSettings | MessagesSettings | ModerationPointsSettings | ModerationSettings | MuteSettings | NicknameLogSettings | PermissionSettings | ProtectionSettings | SelfroleSettings | SilenceSettings | StaffSettings | StickyRoleSettings | TextCommandsSettings | VoiceSettings | WelcomerSettings | WordFilterSettings | WordWatcherSettings | LocaleSettings | RejoinSettings export type PartialGuildSettings = Partial // { // [key: string]: unknown // } export type GuildSettings = { [key: string]: GuildSettingTypes, locale: LocaleSettings, textcommands: TextCommandsSettings, wordfilter: WordFilterSettings moderation: ModerationSettings, dminfraction: DMInfractionSettings, protection: ProtectionSettings, modpoints: ModerationPointsSettings, automod: AutomodSettings, permissions: PermissionSettings, grantable: GrantableSettings, mute: MuteSettings, silent: SilenceSettings, ignore: IgnoreSettings, commands: CommandSettings, indexing: IndexingSettings, errors: ErrorLogSettings, messages: MessagesSettings, staff: StaffSettings, voice: VoiceSettings, selfrole: SelfroleSettings, members: MemberLogSettings, nicknames: NicknameLogSettings, stickyrole: StickyRoleSettings, autorole: AutoroleSettings, welcomer: WelcomerSettings, wordwatcher: WordWatcherSettings, linkfilter: LinkfilterSettings, invitefilter: InviteFilterSettings, mentionfilter: MentionFilterSettings, raidprotection: RaidprotectionSettings, rejoin: RejoinSettings } & EntitySettings export type PermissionSet = { global: string[], channels: { [id: Snowflake]: string[] } } export type GuildPermissions = { guildId: Snowflake, [roleId: Snowflake]: PermissionSet | Snowflake } export type GuildData = { [key: string]: unknown caseId?: number, settings?: GuildSettings, premium?: number, debug?: boolean, _version?: string, _imported?: { [key: string]: boolean | undefined, modlogs?: boolean, settings?: boolean } } & EntityData export type CallbackData = { type: string, created: number, time: number, id: string } export type PollData = { user: string, duration: number, message: string, channel: string, startedIn: string, questions: string[], multiChoice?: boolean } export type ReminderData = { user: string, channel: string, reminder: string, time: number // In seconds } export type ChannelJSON = { id: Snowflake, type: ChannelType, name: string, parent: Snowflake | null } export type RoleJSON = { id: Snowflake, name: string, position: number, } export type GuildJSON = { channels: ChannelJSON[], roles: RoleJSON[] } export type AttachmentData = { size: number, attachmentId: string, name: string, index: ObjectId, id: string, extension: string, buffer: { buffer: Buffer } } export type MessageLogEntry = { attachments: AttachmentData[] } export type RoleCacheEntry = { member: string, guild: string, roles: string[], timestamp: number } export type WordWatcherEntry = { message: string, target: string, channel: string, timestamp: number } export type WebhookEntry = { feature: string, guild: string, hookId: string, token: string }