4.0.0 • Published 2 years ago

winston-discordjs v4.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

Winston Discord.js Transport

npm Actions Status codecov Known Vulnerabilities

A Winston transport using Discord.js, written in TypeScript

Requirements

  • Node.js 16.6+

Usage

// Setup Discord.js client
const Discord = require('discord.js');
const client = new Discord.Client();
client.login("DISCORD_API_KEY");

// Find a channel to send log messages to
const discordChannel = client.channels.get(discordChannelId)

// Create and add the transport to a logger
const DiscordTransport = require('winston-discordjs');
logger.add(new DiscordTransport({
    discordChannel: discordChannel
});

Options

From the code:

export interface DiscordTransportStreamOptions
  extends Transport.TransportStreamOptions {
  discordClient?: Client
  discordToken?: string
  discordChannel?: TextChannel
}

Ideally a TextChannel is passed in, from an existing Discord.Client. Otherwise, the transport expects a Channel ID as a string

If an ID is passed in, the Transport requires a Discord.Client:

  • If one is passed in, we will use it
  • If one is not passed in, we will create one using the given discordToken
4.0.0

2 years ago

3.0.0

3 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago