import { Command , CommandClient } from 'detritus-client' ; import { CommandTypes , GoogleLocales } from '../../../constants' ; import { Formatter , Parameters , DefaultParameters } from '../../../utils' ; import { BaseSearchCommand } from '../basecommand' ; export interface CommandArgs { locale : GoogleLocales ; query : string ; randomize : boolean ; safe : boolean ; } export const COMMAND_NAME = 'image2' ; export default class Image2Command extends BaseSearchCommand < CommandArgs > { constructor ( client ) { super ( client , { name : COMMAND_NAME , aliases : [ 'g image2' , 'g img2' , 'g im2' , 'google image2' , 'google img2' , 'google im2' , 'img2' , 'im2' ] , args : [ { name : 'language' , aliases : [ 'locale' ] , default : DefaultParameters . locale , type : Parameters . locale } , { name : 'randomize' , aliases : [ 'r' , 'random' ] , type : Boolean } , { name : 'safe' , default : DefaultParameters . safe , type : ( ) => true } , ] , metadata : { description : 'Search Google Images, but with less data displayed' , examples : [ `${ COMMAND_NAME } notsobot` , `${ COMMAND_NAME } notsobot -locale russian` , `${ COMMAND_NAME } something nsfw -safe` , `${ COMMAND_NAME } notsobot -randomize` , `${ COMMAND_NAME } notsobot -r` , ] , type : CommandTypes . SEARCH , usage : '<query> (-locale <language>) (-randomize) (-safe)' , } , } ) ; } async run ( context , args ) { return Formatter . Commands . SearchGoogleImages . createMessage ( context , { ... args , simple : true , } ) ; } }