Skip to content

Commit

Permalink
Fixed typescript notations
Browse files Browse the repository at this point in the history
  • Loading branch information
Scraayp committed Jul 22, 2022
1 parent 803ba1d commit 2abb488
Showing 1 changed file with 126 additions and 85 deletions.
211 changes: 126 additions & 85 deletions index.d.ts
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;
};
}

0 comments on commit 2abb488

Please sign in to comment.