Constructor
new Neos(optionsopt)
Creates an instance of the NeosJS Client.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
NeosGeneratorOptions |
<optional> |
Properties
|
Extends
- EventEmitter
Members
(static, readonly) CloudX
Properties:
Name | Type | Description |
---|---|---|
Shared |
Shared | |
Util |
Util |
CloudX Library, Contains all Classes and Files
(readonly) CurrentSession
Get the Current Session
(readonly) CurrentUser
Get the Current User
(readonly) CurrentUserGroupInfos
(readonly) CurrentUserMemberships
Get User Memberships
Methods
AddFriend(friend)
Send or Accept a friend request
- pass the Friend Object
Parameters:
Name | Type | Description |
---|---|---|
friend |
String | Friend |
Returns:
void
CountPresentFriends(session) → {Number}
Get the number of friends in a Session
Parameters:
Name | Type | Description |
---|---|---|
session |
SessionInfo |
Returns:
Friends in Session
- Type
- Number
FetchRecord(ownerId, recordId)
Not yet Implimented
Parameters:
Name | Type | Description |
---|---|---|
ownerId |
* | |
recordId |
* |
FindRecords(record)
Not Yet Implimented
Parameters:
Name | Type | Description |
---|---|---|
record |
SearchParameters |
GetAllUserMessages() → {List.<Message>}
Get all Cached messages
Returns:
- Type
- List.<Message>
(async) GetCurrencyRates(baseCurrencyopt) → {CurrencyRates}
Get currency transaction rates
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
baseCurrency |
string |
<optional> |
"USD"
|
Returns:
- Type
- CurrencyRates
GetFriend(friendId) → {User}
get a user from your friend list
Parameters:
Name | Type | Description |
---|---|---|
friendId |
string |
Returns:
- Type
- User
(async) GetFriends(userId) → {List.<Friend>}
Get the friends list of a user
Parameters:
Name | Type | Description |
---|---|---|
userId |
string |
Returns:
(async) GetGroup(groupId) → {Group}
Get a Neos Group
Parameters:
Name | Type | Description |
---|---|---|
groupId |
* |
Returns:
- Type
- Group
(async) GetGroupMember(groupId, userId) → {Member}
Get a Member from a Group
Parameters:
Name | Type | Description |
---|---|---|
groupId |
String | |
userId |
String |
Returns:
- Type
- Member
(async) GetGroupMembers(groupId) → {List.<Member>}
Get the Members of a group and their Byte Usage
Parameters:
Name | Type | Description |
---|---|---|
groupId |
String |
Returns:
- Type
- List.<Member>
(async) GetMessageHistory(userId, maxItemsopt) → {List.<Message>}
Get History of messages with a user
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
userId |
String | |||
maxItems |
number |
<optional> |
100
|
Returns:
Messages
- Type
- List.<Message>
(async) GetMessages(fromTimeopt, maxItemsopt, useropt, unreadOnlyopt) → {List.<Message>}
Get messages and add them to the cache
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fromTime |
Date |
<optional> |
new Date
|
|
maxItems |
Number |
<optional> |
100
|
|
user |
String |
<optional> |
null
|
|
unreadOnly |
boolean |
<optional> |
false
|
Returns:
- Type
- List.<Message>
(async) GetRandomExitMessage() → {ExitMessage}
Get a random Exit Message
Returns:
- Type
- ExitMessage
(async) GetStatus(userId) → {UserStatus}
Get the status of a user
Parameters:
Name | Type | Description |
---|---|---|
userId |
String |
Returns:
UserStatus
- Type
- UserStatus
(async) GetUser(userId) → {User}
Get a specific User by their UserId
Parameters:
Name | Type | Description |
---|---|---|
userId |
string |
Returns:
User Object
- Type
- User
(async) GetUserByName(username) → {User}
get a specific User by their username
Parameters:
Name | Type | Description |
---|---|---|
username |
string |
Returns:
- Type
- User
(async) GetUserMessages(UserId) → {UserMessages}
Get cached messages with a user
Parameters:
Name | Type | Description |
---|---|---|
UserId |
String |
Returns:
- Type
- UserMessages
(async) GetUsers(username) → {List.<User>}
Search neos for username
Parameters:
Name | Type | Description |
---|---|---|
username |
string |
Returns:
IgnoreRequest(friend)
Ignore a Friend Request
- pass the Friend Object
Parameters:
Name | Type | Description |
---|---|---|
friend |
* |
Returns:
void
IsFriend(friendId) → {Boolean}
Check if a user is friends
Parameters:
Name | Type | Description |
---|---|---|
friendId |
string |
Returns:
- Type
- Boolean
(async) Login(credential, passwordopt, sessionTokenopt, machineId, rememberMeopt, recoverCodeopt) → {Promise.<CloudResult.<UserSession>>}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
credential |
string | Email, UserId, or Account Username | ||
password |
string |
<optional> |
Not required if sessionToken is set, - Set as new password if recoverCode is set | |
sessionToken |
string |
<optional> |
Session Token to login without storing the password | |
machineId |
string | Unique Machine ID, If another instance is logged in using the same machine id, the new one will replace the old. | ||
rememberMe |
boolean |
<optional> |
false
|
SessionToken will be valid for 7 days |
recoverCode |
string |
<optional> |
Recovery Code sent via Email, Use to set a new password |
Returns:
- Type
- Promise.<CloudResult.<UserSession>>
Logout(manualopt)
Logout
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
manual |
boolean |
<optional> |
true
|
MarkMessagesRead(messageIds)
Send a Read Reciept, Messages will not show in UnreadMessages query
Parameters:
Name | Type | Description |
---|---|---|
messageIds |
Array.<String> | List.<String> | String |
Returns:
*
NeosDBToHttp(neosdb, endpoint) → {String}
Example
Neos.GetUser("U-bombitmanbomb").then((User)=>{
console.log(Neos.NeosDBToHttp(User.Profile.IconUrl))
})
Parameters:
Name | Type | Description |
---|---|---|
neosdb |
String | neosdb:///URL |
endpoint |
Number | Options: - 0 - Default - 1 - Blob - 2 - CDN - 3 - VideoCDN - null - Default |
Returns:
http address to neosdb asset
- Type
- String
RemoveFriend(friend)
Remove a user from your friends list
- pass the Friend Object
Parameters:
Name | Type | Description |
---|---|---|
friend |
* |
Returns:
void
(async) SendTextMessage(UserId, Message)
Send a Text Message.
If Message is longer than 128 characters it will be chunked as there is a character limit
if a Message element in an Array is longer than 128 characters it will be cut off with "..." by the server
Parameters:
Name | Type | Description |
---|---|---|
UserId |
String | Neos User Id to send |
Message |
String | Array.<String> | Message or Array of Messages to Send |
(async) SendTransaction(UserId, Message) → {Promise.<any>}
Parameters:
Name | Type | Description |
---|---|---|
UserId |
* | |
Message |
* |
Returns:
- Type
- Promise.<any>
UpdateStatus()
Update the Neos Account status
Events
debug
Console Event
Type:
- any
Example
Neos.on("debug", (info)=>{console.log(info))})
Parameters:
Name | Type | Description |
---|---|---|
info |
any |
error
Error Event
Type:
- Error
Example
Neos.on("error", (err)=>{console.error(err)})
Parameters:
Name | Type | Description |
---|---|---|
err |
Error |
friendAdded
membershipsUpdated
Type:
friendRemoved
membershipsUpdated
Type:
friendRequestCountChanged
membershipsUpdated
Type:
- Number
friendsChanged
membershipsUpdated
friendUpdated
membershipsUpdated
Type:
groupMemberUpdated
membershipsUpdated
Type:
- Member
groupUpdated
membershipsUpdated
login
Properties:
Name | Type | Description |
---|---|---|
CurrentUser |
Object | Current User |
CurrentSession |
Object | Current Session |
Login Event
Type:
- Object
Example
Neos.on("login", ()=>{
Neos.SendTestMesssage("U-BotOwner", "Bot Online");
...
})
logout
Logout Event
membershipsUpdated
membershipsUpdated
messageCountChanged
membershipsUpdated
Type:
- Number
messageReceived
Message Received
Type:
- Message
Example
Neos.on("messageReceived", (message)=>{
switch(message.MessageType){
case "Text":
Commands.Run(message)
break
default:
Neos.SendTextMessage(message.SenderId, "I Only can handle Text")
}
})
sessionChanged
Session Changed
Type:
- UserSession
sessionUpdated
Session Updated
userUpdated
User Updated