Skip to content

Commit

Permalink
Create mocking command, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMonDon committed Jan 3, 2025
1 parent 02c158e commit 751854b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/Fun/clap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Clap extends Command {
constructor(client) {
super(client, {
name: 'clap',
description: 'Clappify your text',
description: 'Clapify your text',
usage: 'clap <text>',
examples: ['clap add emojis to this'],
category: 'Fun',
Expand Down
31 changes: 31 additions & 0 deletions commands/Fun/mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const Command = require('../../base/Command.js');

class Mock extends Command {
constructor(client) {
super(client, {
name: 'mock',
description: 'Converts your text to a mocking pattern',
usage: 'mock <text>',
examples: ['mock this is fun'],
category: 'Fun',
requiredArgs: 1,
});
}

async run(msg, args) {
// Combine user input into one string
const input = args.join(' ');
const lengthLimited = this.client.util.limitStringLength(input);
const mock = await this.client.util.clean(this.client, lengthLimited);

// Convert to "mOcKiNg" style
const mockedText = mock
.split('')
.map((char, index) => (index % 2 === 0 ? char.toLowerCase() : char.toUpperCase()))
.join('');

return msg.channel.send(mockedText);
}
}

module.exports = Mock;

0 comments on commit 751854b

Please sign in to comment.