import { Plugin } from '../../common/plugin' ; import { ChannelType , IContainer , IMessage } from '../../common/types' ; export default class DiceRollPlugin extends Plugin { public commandName : string = 'dice' ; public name : string = 'Dice Roll' ; public description : string = 'Roll a die' ; public usage : string = 'dice <number>' ; public override pluginAlias = [ ] ; public permission : ChannelType = ChannelType . All ; public override commandPattern : RegExp = /^(\d+)?$/ ; constructor ( public container ) { super ( ) ; } public async execute ( message , args ) { const upperBound = args . length > 0 ? + args [ 0 ] : 6 ; const randomNumber = Math . ceil ( Math . random ( ) * upperBound ) ; await message . channel . send ( `You rolled a \`${ randomNumber }\`` ) ; } }