2024-07-18 19:06:49 +02:00
|
|
|
// 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 <https://www.gnu.org/licenses/>.
|
|
|
|
|
2023-12-05 16:47:54 +01:00
|
|
|
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,
|
|
|
|
SelfroleSettings,
|
|
|
|
SilenceSettings,
|
|
|
|
StaffSettings,
|
|
|
|
StickyRoleSettings,
|
|
|
|
TextCommandsSettings,
|
|
|
|
VoiceSettings,
|
|
|
|
WelcomerSettings,
|
|
|
|
WordFilterSettings,
|
|
|
|
WordWatcherSettings
|
|
|
|
} from './Settings.js';
|
|
|
|
import { ObjectId } from 'mongodb';
|
2024-09-30 16:56:24 +02:00
|
|
|
import { EntityData, EntitySettings } from './Client.ts';
|
2023-12-05 16:47:54 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
export type PartialGuildSettings = Partial<GuildSettings>
|
|
|
|
// {
|
|
|
|
// [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,
|
2024-09-30 16:56:24 +02:00
|
|
|
} & EntitySettings
|
2023-12-05 16:47:54 +01:00
|
|
|
|
|
|
|
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,
|
2024-07-12 15:25:13 +02:00
|
|
|
debug?: boolean,
|
2023-12-05 16:47:54 +01:00
|
|
|
_version?: string,
|
|
|
|
_imported?: {
|
|
|
|
[key: string]: boolean | undefined,
|
|
|
|
modlogs?: boolean,
|
|
|
|
settings?: boolean
|
|
|
|
}
|
2024-09-30 16:56:24 +02:00
|
|
|
} & EntityData
|
2023-12-05 16:47:54 +01:00
|
|
|
|
|
|
|
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,
|
2024-03-26 15:05:07 +01:00
|
|
|
time: number // In seconds
|
2023-12-05 16:47:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|