import { Message , Guild } from 'discord.js' ; import { commandInterface } from '../../commands' ; import { permLevels } from '../../utils/permissions' ; import { Bot } from '../..' ; import { sendError } from '../../utils/messages' ; import { permToString } from '../../utils/parsers' ; import { CommandCache } from '../../database/schemas' ; const abc = [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z' ] ; var command = { name : 'abc' , path : '' , dm : true , permLevel : permLevels . member , togglable : true , help : { shortDescription : 'Does the abc with you' , longDescription : 'This command will make the bot follow the abc with you' , usages : [ '{command}' ] , examples : [ '{command}' ] } , run : async ( message , args , permLevel , dm , requestTime , commandCache ? ) => { try { Bot . mStats . logResponseTime ( command . name , requestTime ) ; Bot . mStats . logCommandUsage ( command . name ) ; if ( ! commandCache ) { message . channel . send ( 'Ok let\'s do the alphabet. I start:' ) ; Bot . mStats . logMessageSend ( ) ; message . channel . send ( abc [ 0 ] ) ; Bot . mStats . logMessageSend ( ) ; new CommandCache ( undefined , message . channel , message . author , command . name , 10000 , { index : 0 } ) ; } else { if ( abc [ commandCache . cache . index + 1 ] == args . toLocaleLowerCase ( ) ) { commandCache . cache . index += 2 ; if ( abc [ commandCache . cache . index ] ) { message . channel . send ( abc [ commandCache . cache . index ] ) ; Bot . mStats . logMessageSend ( ) ; commandCache . save ( 10000 ) ; } else { message . channel . send ( 'alphabet was finished' ) ; Bot . mStats . logMessageSend ( ) ; commandCache . remove ( ) ; } } else { message . channel . send ( `You were supposed to send \`${ abc [ commandCache . cache . index + 1 ] }\`` ) ; Bot . mStats . logMessageSend ( ) ; commandCache . remove ( ) ; } } return true ; } catch ( e ) { sendError ( message . channel , e ) ; Bot . mStats . logError ( e , command . name ) ; } } } ; export default command ;