fixes for command arguments
parent
60550ee5b8
commit
0f39b55669
|
@ -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) {
|
||||||
|
|
|
@ -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 });
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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]);
|
||||||
|
|
Loading…
Reference in New Issue