@skybloxsystems/ticket-bot
Version:
60 lines (40 loc) • 1.83 kB
Markdown
# Discord Transcript
<p align="center"><a href="https://nodei.co/npm/discord-transcript/"><img alt="npm package stats" src="https://nodei.co/npm/discord-transcript.png"></a></p>
* NPM package that creates a HTML Transcript of a channel messages that can be saved for later use
* Useful for users that wants to store messages
* Useful for Tickets
Check out our website [dtranscript.cf](https://dtranscript.cf) _coming soon_.
# Install from [NPM](https://www.npmjs.com/package/discord-transcript)
`$ npm i discord-transcript --save`
# Usage
- `generate(message, MessageCollection, Channel` - Generate Transcript
- `message`: Last Message of the channel
- `MessageCollection`: Discord.js Collection of Messages | <message>.channel.messages.fetch({limit:number})
- `Channel`: Channel object of the channel | <message>.channel
- `getTranscript(msg, id` - Get Transcript url
- `msg`: Last Message of the channel | <message>
- `id`: ID of the channel where the transcript was generated | <message>.channel.id
# Examples
```javascript
const tranascript = require('discord-transcript');
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("message", async(message) => {
let channel = message.channel;
let messagecollection = message.channel.messages.fetch({
limit: 100
});
let link = await transcript.generate(message, messagecollection, channel);
return message.channel.send(link);
});
/*
OUTPUT:
{
"url": "https://discord-archive.herokuapp.com/view?id=841050751571853342",
"id": "841050751571853342",
}
*/
```
# Contributing
Feel free to create any issues and PRs in our [github repository](https://github.com/JustBeingAbdi/Discord-Transcript) if you want to contribute.
© Abdi Hassan, 2020-2021