-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
126 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,128 @@ | ||
import { EventEmitter } from 'events'; | ||
import { EventEmitter } from "events"; | ||
import { | ||
PermissionResolvable, | ||
Snowflake, | ||
User, | ||
Guild, | ||
TextChannel, | ||
GuildMember, | ||
Message, | ||
DiscordAPIError, | ||
RichEmbed, | ||
MessageEmbed, | ||
Role | ||
} from 'discord.js'; | ||
declare module 'discord-anti-spam' { | ||
const _default: AntiSpam; | ||
export default _default; | ||
class AntiSpam extends EventEmitter { | ||
constructor(options?: AntiSpamOptions); | ||
public options: AntiSpamOptions; | ||
public data: AntiSpamData; | ||
|
||
public message(message: Message): Promise<boolean>; | ||
public resetData(): AntiSpamData; | ||
|
||
public on( | ||
event: 'banAdd' | 'kickAdd' | 'warnAdd' | 'muteAdd', | ||
listener: (member: GuildMember) => any | ||
): this; | ||
public on( | ||
event: 'spamThresholdBan' | 'spamThresholdKick' | 'spamThresholdWarn' | 'spamThresholdMute', | ||
listener: (member: GuildMember, duplicateMessages: boolean) => any | ||
): this; | ||
public on( | ||
event: 'error', | ||
listener: ( | ||
message: Message, | ||
error: DiscordAPIError, | ||
type: 'ban' | 'kick' | 'mute' | ||
) => any | ||
): this; | ||
} | ||
|
||
type AntiSpamData = { | ||
messageCache: { | ||
messageID: string; | ||
content: string; | ||
author: Snowflake; | ||
time: number; | ||
}[]; | ||
bannedUsers: Snowflake[]; | ||
kickedUsers: Snowflake[]; | ||
warnedUsers: Snowflake[]; | ||
}; | ||
|
||
type AntiSpamOptions = { | ||
warnThreshold?: number; | ||
banThreshold?: number; | ||
kickThreshold?: number; | ||
muteThreshold?: number; | ||
maxInterval?: number; | ||
warnMessage?: string | RichEmbed | MessageEmbed; | ||
banMessage?: string | RichEmbed | MessageEmbed; | ||
kickMessage?: string | RichEmbed | MessageEmbed; | ||
muteMessage?: string | RichEmbed | MessageEmbed; | ||
maxDuplicatesWarning?: number; | ||
maxDuplicatesBan?: number; | ||
maxDuplicatesKick?: number; | ||
maxDuplicatesMute?: number; | ||
deleteMessagesAfterBanForPastDays?: number; | ||
exemptPermissions?: PermissionResolvable[]; | ||
ignoreBots?: boolean; | ||
verbose?: boolean; | ||
debug?: boolean; | ||
ignoredMembers?: Snowflake[] | ((user: User) => boolean); | ||
ignoredRoles?: (Snowflake | string)[] | ((role: Role) => boolean); | ||
ignoredGuilds?: Snowflake[] | ((guild: Guild) => boolean); | ||
ignoredChannels?: Snowflake[] | ((channel: TextChannel) => boolean); | ||
warnEnabled?: boolean; | ||
kickEnabled?: boolean; | ||
banEnabled?: boolean; | ||
muteEnabled?: boolean; | ||
modLogsChannelName?: string; | ||
modLogsEnabled?: boolean; | ||
removeMessages?: boolean; | ||
}; | ||
PermissionResolvable, | ||
Snowflake, | ||
User, | ||
Guild, | ||
TextChannel, | ||
GuildMember, | ||
Message, | ||
DiscordAPIError, | ||
MessageEmbed, | ||
Role, | ||
} from "discord.js"; | ||
declare module "discord-anti-spam" { | ||
const _default: AntiSpam; | ||
export default _default; | ||
class AntiSpam extends EventEmitter { | ||
constructor(options?: AntiSpamOptions); | ||
public options: AntiSpamOptions; | ||
public data: AntiSpamData; | ||
|
||
public message(message: Message): Promise<boolean>; | ||
public resetData(): AntiSpamData; | ||
|
||
public on( | ||
event: "banAdd" | "kickAdd" | "warnAdd" | "muteAdd", | ||
listener: (member: GuildMember) => any | ||
): this; | ||
public on( | ||
event: | ||
| "spamThresholdBan" | ||
| "spamThresholdKick" | ||
| "spamThresholdWarn" | ||
| "spamThresholdMute", | ||
listener: (member: GuildMember, duplicateMessages: boolean) => any | ||
): this; | ||
public on( | ||
event: "error", | ||
listener: ( | ||
message: Message, | ||
error: DiscordAPIError, | ||
type: "ban" | "kick" | "mute" | ||
) => any | ||
): this; | ||
} | ||
|
||
type AntiSpamData = { | ||
messageCache: { | ||
messageID: string; | ||
content: string; | ||
author: Snowflake; | ||
time: number; | ||
}[]; | ||
bannedUsers: Snowflake[]; | ||
kickedUsers: Snowflake[]; | ||
warnedUsers: Snowflake[]; | ||
}; | ||
|
||
type AntiSpamOptions = { | ||
warnThreshold?: number; | ||
muteThreshold?: number; | ||
kickThreshold?: number; | ||
banThreshold?: number; | ||
|
||
maxInterval?: number; | ||
maxDuplicatesInterval?: number; | ||
|
||
maxDuplicatesWarn?: number; | ||
maxDuplicatesMute?: number; | ||
maxDuplicatesKick?: number; | ||
maxDuplicatesBan?: number; | ||
|
||
unMuteTime?: number; | ||
modLogsChannelName?: string; | ||
modLogsEnabled?: boolean; | ||
modLogsMode?: "embed" | "message"; | ||
|
||
warnMessage?: string; | ||
muteMessage?: string; | ||
kickMessage?: string; | ||
banMessage?: string; | ||
|
||
actionInEmbed?: boolean; | ||
actionEmbedIn?: "channel" | "dm"; | ||
actionEmbedColor?: string; | ||
embedFooterIconURL?: string; | ||
embedTitleIconURL?: string; | ||
|
||
warnEmbedTitle?: string; | ||
kickEmbedTitle?: string; | ||
muteEmbedTitle?: string; | ||
banEmbedTitle?: string; | ||
|
||
warnEmbedDescription?: string; | ||
kickEmbedDescription?: string; | ||
muteEmbedDescription?: string; | ||
banEmbedDescription?: string; | ||
|
||
warnEmbedFooter?: string; | ||
kickEmbedFooter?: string; | ||
muteEmbedFooter?: string; | ||
banEmbedFooter?: string; | ||
|
||
errorMessages?: boolean; | ||
kickErrorMessage?: string; | ||
banErrorMessage?: string; | ||
muteErrorMessage?: string; | ||
|
||
ignoredMembers?: Snowflake[] | ((user: User) => boolean); | ||
ignoredRoles?: (Snowflake | string)[] | ((role: Role) => boolean); | ||
ignoredGuilds?: Snowflake[] | ((guild: Guild) => boolean); | ||
ignoredChannels?: Snowflake[] | ((channel: TextChannel) => boolean); | ||
ignoredPermissions?: PermissionResolvable[]; | ||
ignoreBots?: boolean; | ||
|
||
warnEnabled?: boolean; | ||
kickEnabled?: boolean; | ||
banEnabled?: boolean; | ||
muteEnabled?: boolean; | ||
|
||
deleteMessagesAfterBanForPastDays?: number; | ||
verbose?: boolean; | ||
debug?: boolean; | ||
removeMessages?: boolean; | ||
|
||
MultipleSanctions?: boolean; | ||
}; | ||
} |