djs-test-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Disclaimer

This small library was written to simplifiy testing for our bot. I am not familiar with all features of the discord.js API, and the test client currently only provides features needed to test our bot. However I am more than happy to implement any requests. If you want to request a change simply open a ticket describing the feature. If you want to contribute to the project yourself checkout "Contributing".

Installation

npm install discordjs-test-client

Setup

In order to connect the client needs a dicord API token. You can currently only provide this as an environment variable named DISCORD_CLIENT_TOKEN.

Description

Bots written in discord.js are often hard to test. To make it easier this testing client creates its own guild for every test suite or instance. It provides a sendMessage function to send customizable messages in to any provided channel in the guild and react to it.

Usage

Import the TestClient and create a new instance using the static connect function. This creates a new guild for testing purposes.

  • Use the createTextChannel or createVoicehannel functions to create a new Channel
  • Pass the created channel to the sendMessage function to send a message in this channel (The message your bot should react to)
  • Use getMessages to get the last n messages
  • Check if your bot reacted to the previously sent message properly

The full functionality can be looked up in the typedoc.

Contributing

You can contribute by creating a forkof this repository. Implement your changes and open a pull request on this repo.

Package Sidebar

Install

npm i djs-test-client

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

20.3 kB

Total Files

7

Last publish

Collaborators

  • realdegrees