UNPKG

@averagehelper/corde

Version:

A simple library for Discord bot tests. (Republished fork to demonstrate a bugfix)

67 lines (66 loc) 3.4 kB
import { ColorResolvable, MessageEmbed, Snowflake } from "discord.js"; import { CordeBot } from "../core"; import { MessageData, RoleData } from "../types"; import { Colors } from "../utils/colors"; import { RolePermission } from "../utils/permission"; import { ExpectOperation } from "./expectMatches/operation"; import { RoleMatches, TestReport } from "./interfaces"; import { MessageMatches } from "./interfaces/messageMatches"; /** * Defines all functions that can be used * to check a bot reaction of a command. */ declare type Matches = MessageMatches & RoleMatches; /** * Defines the initial value of expectations from * **command** function. It includes all matches and * the *not* statement. Witch will deny the executed match */ export interface MatchWithNot extends Matches { /** * Defines that a command should **not** do something. * Use this if you can not precise what response a command will throw, * But know what it **can not** throw. */ not: Matches; } declare class ExpectMatches implements Matches { protected _commandName: string; protected _isNot: boolean; constructor(commandName: string, isNot: boolean); toEditMessage(message: MessageData, newValue: string | MessageEmbed): void; toPin(messageId: string): void; toPin(message: MessageData): void; toUnPin(messageId: string): void; toUnPin(message: MessageData): void; toReturn(expect: string | number | boolean | MessageEmbed): void; toAddReaction(...reaction: string[]): void; toRemoveReaction(...reactions: string[]): void; toRemoveReaction(reactions: string[]): void; toRemoveReaction(reactions: string, message: MessageData): void; toRemoveReaction(reactions: string[], message: MessageData): void; toSetRoleColor(color: Colors, id: Snowflake): void; toSetRoleColor(color: Colors, name: RoleData): void; toSetRoleColor(color: ColorResolvable, id: Snowflake): void; toSetRoleColor(color: ColorResolvable, name: RoleData): void; toDeleteRole(id: string): void; toDeleteRole(name: RoleData): void; toSetRoleMentionable(mentionable: boolean, id: string): void; toSetRoleMentionable(mentionable: boolean, roleData: RoleData): void; toSetRoleHoist(hoist: boolean, id: string): void; toSetRoleHoist(hoist: boolean, roleData: RoleData): void; toRenameRole(newName: string, id: string): void; toRenameRole(newName: string, roleData: RoleData): void; toSetRolePosition(newPosition: number, id: string): void; toSetRolePosition(newPosition: number, roleData: RoleData): void; toSetRolePermission(id: string, ...permissions: RolePermission[]): void; toSetRolePermission(roleData: RoleData, ...permissions: RolePermission[]): void; protected getRoleData(roleData: string | RoleData): RoleData; protected operationFactory<T extends ExpectOperation<P1>, P1>(type: new (cordeBot: CordeBot, command: string, isNot: boolean) => T, cordeBot: CordeBot, parameter1: P1): Promise<TestReport>; protected operationFactory<T extends ExpectOperation<P1, P2>, P1, P2>(type: new (cordeBot: CordeBot, command: string, isNot: boolean) => T, cordeBot: CordeBot, parameter1: P1, parameter2: P2): Promise<TestReport>; } export declare class ExpectMatchesWithNot extends ExpectMatches implements MatchWithNot { not: ExpectMatches; constructor(commandName: string); } export {};