# Xfinity

Easy to use discord.js multipurpose package for your bot! Uses discord.js v13.

## Installation

```css
npm i xfinity
yarn add xfinity
pnpm add xfinity
```

## Getting Started

- [Xfinity](#xfinity)
  - [Installation](#installation)
  - [Getting Started](#getting-started)
  - [What's New?](#whats-new)
- [Functions](#functions)
  - [Button Suggest System](#button-suggest-system)
  - [Giveaway](#giveaway)
  - [Pagination Using Menus](#pagination-using-menus)
  - [Ticket with Buttons](#ticket-with-buttons)
  - [Transcript](#transcript)
  - [Handle Interaction Event](#handle-interaction-event)
- [Classes](#classes)
  - [Modlogs (👇)](#modlogs-)
- [Got some errors/bugs?](#got-some-errorsbugs)

## What's New?

1. Removed most unused functions
2. Converted the package to slash only
3. 75% Customization added.

# Functions

Currently it supports following functions:

## Button Suggest System

**Suggest system with buttons. Customizable also.**

```javascript
const xfinity = require("xfinity");

// For slash command first you need to define options just like this:
options: [
  {
    name: "suggestion", //dont change
    description: "What do you want to suggest?", // can be anything
    type: "STRING", //dont change
    required: true, // dont change
  },
],
  //slash command
  xfinity.suggestion(interaction, client, {
    chid: "your channel id",
    deny: "DARK_BUT_NOT_BLACK", //default: red
    suggest: "DARK_GOLD", //default: black
    accept: "DARK_GREEN", //default: green
  });
```

## Giveaway

**Reaction based giveaway system.**

```javascript
const xfinity = require("xfinity");

//slash command

xfinity.giveaway(interaction, {
  congratsmsg: "YOU WON", //optional
  color: "BLUE", //optional
});

//NOTE: YOU NEED TO DEFER YOUR INTERACTION BEFORE USING SLASH COMMAND.
```

## Pagination Using Menus

**You can use this to make multi page embeds using menus.**

```javascript
const xfinity = require("xfinity");
let pages = [
  new Discord.MessageEmbed().setAuthor("Page 1"),
  new Discord.MessageEmbed().setAuthor("page 2"),
];

//slash command

xfinity.mPagination(interaction, pages, {
  description: " Position #{position}", //optional
  label: "Click this to get to #{position}", //optional
});
```

## Ticket with Buttons

**So you like button? Well then this function is for you!**

```javascript
const xfinity = require("xfinity");

//in main file
xfinity.handleinteraction(client);

//if you want slash command
xfinity.bTicket(interaction, {
  bcolor: "green", //optional
});
```

## Transcript

**Want to generate a file for all messages in the channel? Use this function.**

```javascript
//transcript command

const xfinity = require("xfinity");
const { MessageAttachment } = require("discord.js");
//number of messages can be below 100
xfinity.fetchTranscript(message.channel, message, 100).then((data) => {
  const file = new MessageAttachment(data, "index.html");
  message.channel.send({ files: [file] });
});
```

## Handle Interaction Event

**Used for handling all buttons.**

```js
const xfinity = require("xfinity");
xfinity.handleinteraction(client, {
  closeButtonColor: "DANGER", // optional
  reopenButtonColor: "SUCCESS", // optional
  deleteButtonColor: "DANGER", // optional
  deleteChannelButtonColor: "DANGER", // optional
  trasncriptButtonColor: "PRIMARY", // optional
  yesButtonColor: "SECONDARY", // optional
  noButtonColor: "SUCCESS", // optional
  ticketName: "{username}", // optional
  spamMessage: "Test", // optional
  confirmationMessage: "Test", // optional
  ticketOpenMessage: "test", // optional
  ticketOpenEmbedColor: "RED", // optional
  confirmationEmbedColor: "GREEN", // optional
  ticketDeleteMessage: "TEST", // optional
  ticketDeleteCancelMessage: "TEST", // optional
  closeDescription: "ET", // optional
  parentId: "parent id here", // optional
});
```

# Classes

## Modlogs (👇)

**Examples [here](https://github.com/ishandev2004/xfinity/blob/main/docs/modlogs.md)**

# Got some errors/bugs?

**Join [here](https://discord.gg/PAjCtJ6Yjx) for help.**
