Browse Source

Allow mentions for user queries

master
Abheek Dhawan 4 years ago
parent
commit
c93ff40647
  1. 12
      bot.js

12
bot.js

@ -479,9 +479,9 @@ async function userInfo(message) {
const members = message.guild.members.cache.filter(member => { const members = message.guild.members.cache.filter(member => {
if (member.nickname) { if (member.nickname) {
return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase());
} else { } else {
return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase())
} }
}); });
@ -638,9 +638,9 @@ async function ban(message) {
const members = message.guild.members.cache.filter(member => { const members = message.guild.members.cache.filter(member => {
if (member.nickname) { if (member.nickname) {
return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase());
} else { } else {
return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase())
} }
}); });
@ -704,9 +704,9 @@ async function kick(message) {
const members = message.guild.members.cache.filter(member => { const members = message.guild.members.cache.filter(member => {
if (member.nickname) { if (member.nickname) {
return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase());
} else { } else {
return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase())
} }
}); });

Loading…
Cancel
Save