accept user ID's
This commit is contained in:
parent
abe8c824e3
commit
c58df67896
4 changed files with 58 additions and 38 deletions
|
@ -36,7 +36,9 @@ module.exports = class {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.toLowerCase() !== 'add' || action.toLowerCase() !== 'remove') {
|
action = action.toLowerCase();
|
||||||
|
|
||||||
|
if (action !== 'add' & action !== 'remove') {
|
||||||
return message.channel.createMessage(`${client.emojis.userError} You didn't specify a valid action. Usage: \`${this.help.usage}\``);
|
return message.channel.createMessage(`${client.emojis.userError} You didn't specify a valid action. Usage: \`${this.help.usage}\``);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,17 +46,27 @@ module.exports = class {
|
||||||
`${client.emojis.userError} You didn't specify a user. Usage: \`${message.prefix + this.help.usage}\``
|
`${client.emojis.userError} You didn't specify a user. Usage: \`${message.prefix + this.help.usage}\``
|
||||||
);
|
);
|
||||||
|
|
||||||
let member = message.mentions[0];
|
let member;
|
||||||
|
|
||||||
if (!member) member = await message.channel.guild.searchMembers(user.join(' '), 2);
|
if (message.mentions.length > 0) {
|
||||||
|
member = await client.functions.getMember(message.channel.guild, message.mentions[0].id);
|
||||||
|
} else {
|
||||||
|
member = await client.functions.validateUserID(message.channel.guild, user[0]);
|
||||||
|
|
||||||
|
if (!member) {
|
||||||
|
member = await message.channel.guild.searchMembers(user.join(' '), 2);
|
||||||
|
|
||||||
|
if (member.length === 0) return message.channel.createMessage(
|
||||||
|
`${client.emojis.userError} No users found. Check for mispellings, or ping the user instead.`
|
||||||
|
);
|
||||||
|
|
||||||
if (member.length > 1) return message.channel.createMessage(
|
if (member.length > 1) return message.channel.createMessage(
|
||||||
`${client.emojis.userError} Found more than one user, try refining your search or pinging the user instead.`
|
`${client.emojis.userError} Found more than one user, try refining your search or pinging the user instead.`
|
||||||
);
|
);
|
||||||
|
|
||||||
action = action.toLowerCase();
|
|
||||||
|
|
||||||
member = member[0];
|
member = member[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const blocklist = data.guild.blocklist;
|
const blocklist = data.guild.blocklist;
|
||||||
|
|
||||||
|
|
|
@ -18,30 +18,34 @@ module.exports = class {
|
||||||
|
|
||||||
async run (client, message, args, data) { //eslint-disable-line no-unused-vars
|
async run (client, message, args, data) { //eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
let user = message.author;
|
let member = message.member;
|
||||||
|
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
user = message.mentions[0];
|
if (message.mentions.length > 0) {
|
||||||
|
member = await client.functions.getMember(message.channel.guild, message.mentions[0].id);
|
||||||
|
} else {
|
||||||
|
member = await client.functions.validateUserID(message.channel.guild, args[0]);
|
||||||
|
|
||||||
if (!user) {
|
if (!member) {
|
||||||
user = await message.channel.guild.searchMembers(args.join(' '), 2);
|
member = await message.channel.guild.searchMembers(args.join(' '), 2);
|
||||||
|
|
||||||
if (user.length < 1) return message.channel.createMessage(
|
if (member.length === 0) return message.channel.createMessage(
|
||||||
`${client.emojis.userError} No users found. Check for mispellings, or ping the user instead.`
|
`${client.emojis.userError} No users found. Check for mispellings, or ping the user instead.`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (user.length > 1) return message.channel.createMessage(
|
if (member.length > 1) return message.channel.createMessage(
|
||||||
`${client.emojis.userError} Found more than one user, try refining your search or pinging the user instead.`
|
`${client.emojis.userError} Found more than one user, try refining your search or pinging the user instead.`
|
||||||
);
|
);
|
||||||
|
|
||||||
user = user[0].user;
|
member = member[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const embed = new client.RichEmbed()
|
const embed = new client.RichEmbed()
|
||||||
.setTitle(user.username + '#' + user.discriminator)
|
.setTitle(member.user.username + '#' + member.user.discriminator)
|
||||||
.setColour(client.functions.displayHexColour(message.channel.guild, user.id))
|
.setColour(client.functions.displayHexColour(message.channel.guild, member))
|
||||||
.setImage(user.avatarURL);
|
.setImage(member.user.avatarURL);
|
||||||
|
|
||||||
message.channel.createMessage({ embed: embed });
|
message.channel.createMessage({ embed: embed });
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,9 @@ module.exports = class {
|
||||||
if (message.mentions.length > 0) {
|
if (message.mentions.length > 0) {
|
||||||
member = await client.functions.getMember(message.channel.guild, message.mentions[0].id);
|
member = await client.functions.getMember(message.channel.guild, message.mentions[0].id);
|
||||||
} else {
|
} else {
|
||||||
|
member = await client.functions.validateUserID(message.channel.guild, args[0]);
|
||||||
|
|
||||||
|
if (!member) {
|
||||||
member = await message.channel.guild.searchMembers(args.join(' '), 2);
|
member = await message.channel.guild.searchMembers(args.join(' '), 2);
|
||||||
|
|
||||||
if (member.length === 0) return message.channel.createMessage(
|
if (member.length === 0) return message.channel.createMessage(
|
||||||
|
@ -39,6 +42,7 @@ module.exports = class {
|
||||||
member = member[0];
|
member = member[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const badges = [];
|
const badges = [];
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Functions {
|
||||||
let hexadecimal = object.color.toString(16);
|
let hexadecimal = object.color.toString(16);
|
||||||
while (hexadecimal.length < 6) {
|
while (hexadecimal.length < 6) {
|
||||||
hexadecimal = '0' + hexadecimal;
|
hexadecimal = '0' + hexadecimal;
|
||||||
};
|
}
|
||||||
|
|
||||||
return '#' + hexadecimal;
|
return '#' + hexadecimal;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue