🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@amazebot/rocket-sims

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amazebot/rocket-sims

Populate Rocket.Chat with mock users and messages for testing.

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
8
300%
Maintainers
1
Weekly downloads
 
Created
Source

👩‍🎤 Rocket Sims

Populate Rocket.Chat with mock users and messages for testing.

Usage

See the main rocket-control README for general configuration.

This example script uses rocket-socket and rocket-sims to create a new bot user, connect to the general channel and stream all bot mentions to the console.

.lookup(username)

Get user data for existing users.

import { user } from '@amazebot/rocket-sims'
user.lookup('admin')
  .then((data) => console.log(data))

.create(user)

Register new user from given attributes and defaults.

import { user } from '@amazebot/rocket-sims'
async function registerSims {
  const u1 = await user.create({ username: 'sim1' })
  const u2 = await user.create({ username: 'sim2' })
}

You muse include username OR name. Other attributes and defaults are:

password: string // default: random
email: string // default: null account at test.smtp.org
roles: string[] // default: ['user']
joinDefaultChannels: boolean // default: false
requirePasswordChange: boolean // default: false
sendWelcomeEmail: boolean // default: false
verified: boolean // default: true

You can also include any key/value pairs for custom user fields.

Create methods returns a user record containing:

  • .id the created user ID
  • .account contains details from creation (params merged with defaults)
  • .login() logs in the user via websocket (DDP / Realtime API)
  • .delete() deletes this user from server

Login returns a websocket instance for the logged in user to make subsequent server method calls and subscriptions. e.g:

u1 = await user.create({ username: 'sim1' })
ws1 = await u1.login()
await ws1.call('joinRoom', 'general')

.random()

Creates a user with a random name. Returns the same as .create

.records

A collection of created users assigned to their ID.

.deleteAll()

Deletes all users created in the current session.

Keywords

rocket.chat

FAQs

Package last updated on 21 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts