command.ts 847 B

123456789101112131415161718192021222324252627
  1. import { Message } from "discord.js";
  2. export type BotEvent = (actionsDone: boolean, ...params: any[]) => boolean;
  3. export interface IDocumentation {
  4. auth: boolean;
  5. description: string;
  6. };
  7. export type DocumentationSet = {
  8. [command: string] : IDocumentation;
  9. };
  10. export interface IBotCommand {
  11. pattern: string | RegExp;
  12. action(message: Message, strippedContents: string, matches?: RegExpMatchArray) : void;
  13. };
  14. export interface ICommand {
  15. commands?: Array<IBotCommand>;
  16. documentation?: DocumentationSet;
  17. onMessage?(actionsDone: boolean, m : Message, content: string) : boolean;
  18. onIndirectMention?(actionsDone: boolean, m: Message) : boolean;
  19. onDirectMention?(actionsDone: boolean, m: Message, content: string) : boolean;
  20. postMessage?(actionsDone: boolean, m: Message) : boolean;
  21. onStart?(): void;
  22. };