fixes for command arguments

merge-requests/12/head
Matthew 2020-05-02 21:03:34 -04:00 committed by Bsian
parent 60550ee5b8
commit 0f39b55669
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
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]);