UNPKG

psyduck-plugin-joingate

Version:
32 lines (31 loc) 1.33 kB
/// <reference types="command-line-args" /> import { BotPlugin } from 'psyduck-contracts'; import * as Discord from 'discord.js'; import { CommandLineOptions } from 'command-line-args'; export default class PsyduckExample implements BotPlugin { gateCommand: string; gateChannelId: string; roleId: string; constructor(options: { gateCommand: string; gateChannelId: string; roleId: string; }); /** * This event is emitted from Psyduck when a message is recieved in a discord channel. From there you may do as you with with it in your plugin. */ onMessage(message: Discord.Message): void; updateUser(message: Discord.Message): Promise<void>; /** * If you command will use the command-line-args package, you can use this RegEx to extract the parts in to an array for use with hydrateOptions. */ parseParameters(messageContent: string): string[]; /** * Hydrate an object with the shape if your options definition. */ hydrateOptions(parameters: string[]): CommandLineOptions; /** * If you need to extract a userId from a mention for later use, you can pass the raw mention to this method. <@1234567890> => 1234567890 | undefined */ extractUserId(userId: string): string | undefined; }