galactic-bot/@types/Guild.d.ts

227 lines
5.3 KiB
TypeScript
Raw Normal View History

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,
RejoinSettings,
2023-12-05 16:47:54 +01:00
SelfroleSettings,
SilenceSettings,
StaffSettings,
StickyRoleSettings,
TextCommandsSettings,
VoiceSettings,
WelcomerSettings,
WordFilterSettings,
WordWatcherSettings
} from './Settings.js';
import { ObjectId } from 'mongodb';
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
| RejoinSettings
2023-12-05 16:47:54 +01:00
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,
rejoin: RejoinSettings
} & 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,
debug?: boolean,
2023-12-05 16:47:54 +01:00
_version?: string,
_imported?: {
[key: string]: boolean | undefined,
modlogs?: boolean,
settings?: boolean
}
} & 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,
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
}