# discord-trivia

> Easily integrate trivia games into your Discord.JS client with discord-trivia

Latest version **3.0.2** (published 2024-03-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install discord-trivia
pnpm add discord-trivia
yarn add discord-trivia
bun add discord-trivia
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2024-03-25 |
| First published | 2022-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 66.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Elitezen |
| Maintainers | elitezen |
| Keywords | discord, trivia, discord.js, easy-trivia, discord-trivia, discord quiz, games, quiz, api |

## Links

- npm: https://www.npmjs.com/package/discord-trivia
- Repository: https://github.com/Elitezen/discord-trivia
- Homepage: https://github.com/Elitezen/discord-trivia#readme
- Issues: https://github.com/Elitezen/discord-trivia/issues
- npm.io page: https://npm.io/package/discord-trivia

## Dependencies (2)

- [discord.js](https://npm.io/package/discord.js.md) ^14.14.1
- [open-trivia-db](https://npm.io/package/open-trivia-db.md) ^2.1.5

## Recent versions

- 3.0.2 (latest) — 2024-03-25
- 3.0.1 — 2024-03-24
- 3.0.0 — 2024-02-15
- 2.0.3 — 2023-06-10
- 2.0.2 — 2023-03-23
- 2.0.1 — 2023-03-23
- 2.0.0 — 2023-03-23
- 1.2.3 — 2022-08-09
- 1.2.2 — 2022-07-26
- 1.2.1 — 2022-07-23
- 1.2.0 — 2022-07-19
- 1.1.0 — 2022-07-01
- 1.0.3 — 2022-06-17
- 1.0.2 — 2022-06-06
- 1.0.1 — 2022-05-20
- … 3 more at https://npm.io/package/discord-trivia/versions

## README

![Discord Trivia Logo](https://i.imgur.com/9gqrPGC.png)

# Discord Trivia 

A package that provides an easy way to create fully-fledged trivia games for Discord bots with Discord.JS. Includes support for +20 categories as well as customizable game settings, themes, and game messages. Comes with a built-in leaderboard system to track scores and rankings!

## CHANGELOG

### 3.0.2
- Additional bug fixes to answer checking.

## Basic Example

```js
import { GameManager } from 'discord-trivia';

const manager = new GameManager();

// -- Inside your command function --
const game = manager.createGame(interaction.channel);

try {
    await game.startQueue(interaction);
} catch (err) {
    console.error(`An error occurred: ${err}`);
}
```

## Custom Questions

```js
const customQuestions = [
  new BooleanQuestion()
    .setValue("discord-trivia is awesome!")
    .setCategory("My epic category")
    .setDifficulty('easy') 
    .setCorrectAnswer('true'),
  new MultipleChoiceQuestion()
    .setValue("What's the best pizza topping?")
    .setCategory("food")
    .setDifficulty('medium')
    .setCorrectAnswer("Chicken feet")
    .setIncorrectAnswers(["Pepperoni", "Sausage", "Olives"])

  // Add more custom questions here...
];

game.config.customQuestions = customQuestions;

game.startQueue(interaction);
```

## Full Guide
[Click here to view the full guide](https://elitezen.github.io/discord-trivia-website/)

---
_Source: https://npm.io/package/discord-trivia · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
