import { Command , CommandClient } from 'detritus-client' ; import { CommandTypes } from '../../../constants' ; import { Formatter , Parameters , imageReply } from '../../../utils' ; import { BaseCommand , BaseImageCommand } from '../basecommand' ; export interface CommandArgsBefore { text : string ; url ? : null | string ; } export const COMMAND_NAME = 'meme' ; export default class MemeCommand extends BaseImageCommand < Formatter . Commands . ImageMeme . CommandArgs > { constructor ( client ) { super ( client , { name : COMMAND_NAME , metadata : { examples : [ COMMAND_NAME , `${ COMMAND_NAME } notsobot what an idiot` , `${ COMMAND_NAME } notsobot what an idiot | lmao` , ] , type : CommandTypes . IMAGE , usage : '<emoji,user:id|mention,url> <...text>' , } , type : [ { name : 'url' , type : Parameters . imageUrlPositional } , { name : 'text' , consume : true } , ] , } ) ; } onBeforeRun ( context , args ) { return ! ! args . text && super . onBeforeRun ( context , args ) ; } onCancelRun ( context , args ) { if ( ! args . text ) { return BaseCommand . prototype . onCancelRun . call ( this , context , args ) ; } return super . onCancelRun ( context , args ) ; } run ( context , args ) { return Formatter . Commands . ImageMeme . createMessage ( context , args ) ; } }