@swiizyy/plugin-influxdb
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

Neko Plugins Logo

@kaname-png/plugin-influxdb

Plugin for @sapphire/framework to publish stats to an InfluxDB instance.

GitHub codecov npm (scoped) npm

Description

This plugin lets you send your bot's statistics to InfluxDB

More information about InfluxDB can be found on its website.

Features

  • Fully ready for TypeScript!
  • Includes ESM ready entrypoint
  • Easy to use

Installation

@kaname-png/plugin-influxDB depends on the following packages. Be sure to install these along with this package!

You can use the following command to install this package, or replace npm install with your package manager of choice.

npm install @influxdata/influxdb-client  @sapphire/framework discord.js

PS: You can view events by default here.


Usage

If your register the plugin:

import '@kaname-png/plugin-influxdb/register'

const client = new SapphireClient({
	/* your bot options */
	analytics: {
		loadDefaultListeners: true, // (Optional) Load the default events .
		// option to passed influxdb deps
	}
});

async function main() {
	await client.login();
}

void main();

OR

The first step, is to import the Client from the package:

import { Client } from '@kaname-png/plugin-influxdb';

You can choose between defining the options explicitly, in the following manner:

const client = new Client({ url: 'https://example.org', token: 'my-secret-token' });

Or defining the options via environment variables, they are:

Client:

  • INFLUX_OPTIONS_STRING: A connection string, overrides all the options below.
  • INFLUX_URL: ConnectionOptions.url, the base URL to be used.
  • INFLUX_PROXY_URL: ConnectionOptions.proxyUrl, the full HTTP web proxy URL including schema.
  • INFLUX_TIMEOUT: ConnectionOptions.timeout, the socket timeout, defaults to 10 seconds. If defined, this will be parsed and validated to a number.
  • INFLUX_TOKEN: ConnectionOptions.token, the authentication token.

API:

  • INFLUX_ORG: Client.Options.org, the organization to use for the query and write APIs.
  • INFLUX_WRITE_BUCKET: Client.Options.writeBucket, the bucket to write to in the write API.
  • INFLUX_WRITE_PRECISION: Client.Options.writePrecision, the write precision to use in the write API.

Note: If Client.Options.org is unset, none of the APIs will be created. Note: If Client.Options.writeBucket is unset, the Write API will not be created.


**The default listeners:

  • plugin-api: "error"
  • plugin-subcommands: "MessageSubcommandError", "chatInputSubcommandError"
  • plugin-scheduled-tasks: "scheduledTaskError"
  • framework: "messageCommandError", "chatInputCommandError", "contextMenuCommandError", "commandAutocompleteInteractionError", "error", "listenerError" and "interactionHandlerError"

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Kaname

💻 🐛 📖 🚇 🚧 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

Package Sidebar

Install

npm i @swiizyy/plugin-influxdb

Weekly Downloads

2

Version

1.4.1

License

MIT

Unpacked Size

122 kB

Total Files

94

Last publish

Collaborators

  • swiizyy