fixes for command arguments

merge-requests/10/merge
Matthew 2020-05-02 21:03:34 -04:00
parent d2d70bae0e
commit b814db8dd6
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
4 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,7 @@ export default class Ban extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
const member = this.client.util.resolveMember(args[0], this.client.guilds.get(this.client.config.guildID)); const member = this.client.util.resolveMember(args[0], this.client.guilds.get(this.client.config.guildID));
let user: User; let user: User;
if (!member) { if (!member) {

View File

@ -15,7 +15,7 @@ export default class NPM extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.error(message.channel, 'You need to specify a module name.'); if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
const res = await axios.get(`https://registry.npmjs.com/${args[0]}`, { validateStatus: (_) => true }); const res = await axios.get(`https://registry.npmjs.com/${args[0]}`, { validateStatus: (_) => true });

View File

@ -15,7 +15,7 @@ export default class Roleinfo extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.error(message.channel, 'You need to specify a role ID or a role name.'); if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
let role: Role = this.client.guilds.get(this.client.config.guildID).roles.find((r: Role) => r.id === args[0]); let role: Role = this.client.guilds.get(this.client.config.guildID).roles.find((r: Role) => r.id === args[0]);
if (!role) { // if it's a role name if (!role) { // if it's a role name

View File

@ -14,6 +14,7 @@ export default class Unban extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
let user: User; let user: User;
try { try {
user = await this.client.getRESTUser(args[0]); user = await this.client.getRESTUser(args[0]);