mirror of
https://github.com/danbulant/discord.js
synced 2026-06-24 17:21:59 +00:00
Fix query.js to properly deal with users with spaces in their name.
This commit is contained in:
parent
365746f288
commit
7fd5f8f5a6
1 changed files with 7 additions and 7 deletions
|
|
@ -16,15 +16,15 @@ myBot.on( "message", function( message ) {
|
||||||
var channel = message.channel;
|
var channel = message.channel;
|
||||||
|
|
||||||
// Find all the arguments to the command.
|
// Find all the arguments to the command.
|
||||||
var arguments = message.content.split(" ");
|
var arguments = message.content.split( " " );
|
||||||
|
|
||||||
// Get the first argument specifically, as it contains the username
|
// Get the first argument specifically, as it contains the username
|
||||||
// to be queried for.
|
// to be queried for.
|
||||||
var username = arguments[1];
|
var username = arguments.slice( 1 ).join( " " );
|
||||||
|
|
||||||
// Exit the event handler unless the user exists.
|
// Exit the event handler unless the user exists.
|
||||||
if( !username ) {
|
if( !username ) {
|
||||||
myBot.sendMessage(channel, "That user doesn't exist!");
|
myBot.sendMessage( channel, "That user doesn't exist!" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,11 +39,11 @@ myBot.on( "message", function( message ) {
|
||||||
|
|
||||||
// Only continue if the message has been found
|
// Only continue if the message has been found
|
||||||
if( message ) {
|
if( message ) {
|
||||||
myBot.sendMessage(channel, "The last message from user " + username +
|
myBot.sendMessage( channel, "The last message from user " + username +
|
||||||
" is: \"" + message.content + "\".").
|
" is: \"" + message.content + "\"." ).
|
||||||
} else {
|
} else {
|
||||||
myBot.sendMessage("That user has not sent a message " +
|
myBot.sendMessage( "That user has not sent a message " +
|
||||||
"for the last 100 messages!")
|
"for the last 100 messages!" )
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue