https://github.com/electrocute4u/tsumiki-buttons
Tsumiki buttons is an NPM package that features a lot of interesting additions to Discord Buttons and sliders. Mainly altered for Tsumiki Discord Bot.
https://github.com/electrocute4u/tsumiki-buttons
discord-js npm-package
Last synced: 3 months ago
JSON representation
Tsumiki buttons is an NPM package that features a lot of interesting additions to Discord Buttons and sliders. Mainly altered for Tsumiki Discord Bot.
- Host: GitHub
- URL: https://github.com/electrocute4u/tsumiki-buttons
- Owner: Electrocute4u
- License: apache-2.0
- Created: 2021-06-12T16:02:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-18T17:10:43.000Z (almost 4 years ago)
- Last Synced: 2024-11-28T06:15:28.590Z (7 months ago)
- Topics: discord-js, npm-package
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tsumiki Buttons
A simple NPM package for creating buttons on Discord \
Mainly created for [Tsumiki](https://github.com/Electrocute4u/Tsumiki), a Discord Bot written in Javascript.## Table of contents
"Click to expand"
- [Install](#install)
- [Dependencies](#dependencies)
- [Options](#options)
- [Setup](#setup)
- [Standard Method](#standard-method)
- [Example](#example)## Install
```sh
npm install tsumiki-buttons
```
## Dependencies
- `discord-buttons` v^3.2.1 ([LINK](https://www.npmjs.com/package/discord-buttons))## Options
| FIELD | TYPE | DESCRIPTION | DEFAULT |
| :------------- |:-------------:|:-----------:|:-------:|
| userID | Object | The Discord user ID who can control the buttons |
| timeout | Number | Timeout in milliseconds, max is 300000 (5 minutes) |
| color | string? | The button color. Currently supports Red, Green, Blurple and Gray | 'Gray'
| embeds | Array | The embeds to use for each page in chronological order. |
| emojiBack | string? | The Emoji used for the back button. This supports Custom Emojis! | `<<` |
| emojiNext | string? | The Emoji used for the next button. This supports Custom Emojis! | `>>`## Setup
```js
const discord = require('discord.js');
const client = new discord.Client();// Both of these have to be below your discord.Client()
// Replace with what you called your instance of the bot. (i.e bot)
require('discord-buttons')();
require('tsumiki-buttons')();
```## Standard Method
```js
.channel.createSlider(userID, timeout, color, embeds, emojiBack, emojiNext)
```
- userID refers to the one who can trigger the buttons. Make sure to get the user ID.
- The max timeout value is 5 minutes (300000), this value is in milliseconds.
- By default, the color value is Grey. However, it also supports Red, Green and Blurple.
- If you don't pass in a parameter for either `emojiBack` or `emojiNext` or only for one, they will automatically default to "<<" and ">>".## Example
- The order of the embeds in the array will be the order of the pages.
### Example - Ordinary Emoji
Get a Red button with 1 minute timeout, which has 4 different pages, using the two emojis that's not Discord emojis.
```js
.channel.createSlider(.author.id, 60000, "Red", [embed0, embed1, embed2, embed3], "⬅", "➡")
```### Example - Custom Discord Emoji
Get a Blurple button with 1 minute timeout, which have 2 different pages, using 2 Custom Discord Emojis as arrows.
```js
.channel.createSlider(.author.id, 60000, "Blurple", [embed0, embed1], "<:SmugTama:699030647024517200>", "<:02smug:587111714747711490>")
```
- You can also just copy the Emoji ID (i.e 699030647024517200 from "<:SmugTama:699030647024517200>") and place it in. \
Will not work for just the emoji name. But you can paste the entire emoji in the command and it will be automatically converted.