Skip to content

Commit

Permalink
Improved sweep command
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtraction committed Apr 4, 2017
1 parent 36fe105 commit 56078c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions changes.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"date": "April 3, 2017",
"date": "April 4, 2017",
"updated": [
"Some improvements to todo module",
"Some fixes to pagination",
"Some improvements"
"Some improvements",
"Improved `sweep` command"
],
"added": [
"`addSelfAssignableRoles` command",
Expand Down
10 changes: 4 additions & 6 deletions modules/queries/sweep.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,20 @@
*/

exports.run = (Bastion, message, args) => {
let members = message.channel.members.filter(m => !m.user.bot).map(m => m.user.id);
let sweepedUserId = members[Math.floor(Math.random()*members.length)];
let sweepedUser = message.channel.members.get(sweepedUserId).user;
let sweepedUser = message.channel.members.filter(m => !m.user.bot).random();

message.channel.sendMessage('', {embed: {
color: 6651610,
title: 'Sweeped user',
fields: [
{
name: 'User',
value: `**${sweepedUser.username}**#${sweepedUser.discriminator}`,
value: `**${sweepedUser.user.username}**#${sweepedUser.user.discriminator}`,
inline: true
},
{
name: 'ID',
value: sweepedUserId,
value: sweepedUser.id,
inline: true
}
]
Expand All @@ -50,7 +48,7 @@ exports.config = {

exports.help = {
name: 'sweep',
description: 'Shows a random user from the server.',
description: 'Shows a random user from the channel.',
permission: '',
usage: 'sweep',
example: []
Expand Down

0 comments on commit 56078c6

Please sign in to comment.