Lots of Changes

This commit is contained in:
Daniel Odendahl Jr
2017-08-26 01:20:43 +00:00
parent d2008c749d
commit 56e72f7509
78 changed files with 393 additions and 389 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class BanCommand extends Command {
type: 'string',
validate: reason => {
if (reason.length < 140) return true;
return 'Reason must be under 140 characters.';
return 'Please keep the reason under 140 characters.';
}
}
]
+2 -2
View File
@@ -26,7 +26,7 @@ module.exports = class HackbanCommand extends Command {
type: 'string',
validate: reason => {
if (reason.length < 140) return true;
return 'Reason must be under 140 characters.';
return 'Please keep the reason under 140 characters.';
}
}
]
@@ -40,7 +40,7 @@ module.exports = class HackbanCommand extends Command {
if (id === msg.guild.ownerID) return msg.say('Don\'t you think that might be betraying your leader?');
let user;
try {
user = await this.client.fetchUser(id);
user = await this.client.users.fetch(id);
} catch (err) {
return msg.say('Could not resolve user.');
}
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class KickCommand extends Command {
type: 'string',
validate: reason => {
if (reason.length < 140) return true;
return 'Reason must be under 140 characters.';
return 'Please keep the reason under 140 characters.';
}
}
]
+30 -13
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
const { wait } = require('../../structures/Util');
module.exports = class LockdownCommand extends Command {
constructor(client) {
@@ -13,31 +14,47 @@ module.exports = class LockdownCommand extends Command {
userPermissions: ['ADMINISTRATOR'],
args: [
{
key: 'type',
prompt: 'Please enter either start or stop.',
key: 'action',
prompt: 'What action should be performed? Either start or stop.',
type: 'string',
default: 'start',
validate: type => {
if (['start', 'stop'].includes(type.toLowerCase())) return true;
return 'Please enter either start or stop.';
validate: action => {
if (['start', 'stop'].includes(action.toLowerCase())) return true;
return 'Invalid action, please enter either start or stop.';
},
parse: type => type.toLowerCase()
parse: action => action.toLowerCase()
},
{
key: 'time',
prompt: 'How long should the channel be locked down (in minutes)?',
type: 'integer',
default: '',
validate: time => {
if (time > 0 && time < 11) return true;
return 'Please keep the time under 10 minutes.';
},
parse: time => time * 60000
}
]
});
}
async run(msg, args) { // eslint-disable-line consistent-return
const { type } = args;
if (type === 'start') {
const { action, time } = args;
if (action === 'start') {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
return msg.say(stripIndents`
Lockdown Started, users without Administrator can no longer post messages.
Please use \`lockdown stop\` to end the lockdown.
await msg.say(stripIndents`
Lockdown started, users without overwrites can no longer post messages.
${time ? 'Please use `lockdown stop` to end the lockdown.' : `Please wait ${time / 60000} minutes.`}
`);
} else if (type === 'stop') {
if (!time) return null;
await wait(time);
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null });
return msg.say('Lockdown Ended.');
return msg.say('Lockdown ended, all users can now post messages.');
}
if (action === 'stop') {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null });
return msg.say('Lockdown ended, all users can now post messages.');
}
}
};
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class PruneCommand extends Command {
async run(msg, args) {
const { count } = args;
try {
const messages = await msg.channel.fetchMessages({ limit: count + 1 });
const messages = await msg.channel.messages.fetch({ limit: count + 1 });
await msg.channel.bulkDelete(messages, true);
return null;
} catch (err) {
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class SoftbanCommand extends Command {
type: 'string',
validate: reason => {
if (reason.length < 140) return true;
return 'Reason must be under 140 characters.';
return 'Please keep the reason under 140 characters.';
}
}
]
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class UnbanCommand extends Command {
type: 'string',
validate: reason => {
if (reason.length < 140) return true;
return 'Reason must be under 140 characters.';
return 'Please keep the reason under 140 characters.';
}
}
]
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class WarnCommand extends Command {
type: 'string',
validate: reason => {
if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.';
return 'Please keep the reason under 140 characters.';
}
}
]