From 99dadc5b34fdc36fd969dddaa1d20a5b147a2960 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 5 Mar 2021 15:51:37 -0700 Subject: [PATCH] dependencies and pagination readme --- README.md | 29 +++++++++++++++++++++++++++++ package-lock.json | 46 ---------------------------------------------- 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 4aed17a..2f94cab 100644 --- a/README.md +++ b/README.md @@ -45,4 +45,33 @@ Pass in your `message` object, the question to ask, the time - in ms - the user let name = await ask(message, "What is your name?", 30000); if (!name) {return;} // Function already sends a timeout message, just return here to stop the command from continuing. return message.channel.send(`Hiya there, ${name}!`); + +new Pagination() +``` + +### Pagination +> util/pagination.ts + +Create a pagination based on a list of Discord MessageEmbeds. + +Paginations work based off of reactions, and the pages are cycled with the click of the reaction. Pass in the message channel object, a list of embeds, the original message, and your Discord.Client object. + +```js +let pages = [/*List of Discord.MessageEmbeds*/]; +let help = new Pagination(message.channel, pages, message, client); + +await help.setPage(1); //Pages start at 1 +await help.setControllers(); //Set the reaction controllers + +// OR you can call .start() to do all of this for you. + +await help.start({ + endTime: 60000 /*Time in ms before the pagination times out to save memory*/, + startPage: 3 /*Page num to start on*/, + user: 'discord_member_id' /*ID of a member that the Pagination will only listen to*/ +}); //All of these are optional. ``` + +_Please note that the Pagination class is still in the works. Only one bug is currently known, and it's that the Pagination will error when a user tries to end the pagination in a DM channel, but this error is not extremely high-level and shouldn't have any major effects on your node process._ + +_Another note: you'll want to go into the pagination.js file and search for .setFooter() and change the name Natsuki to whatever name your bot is_ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 459bc73..50cceb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -546,52 +546,6 @@ "timed-out": "^4.0.1", "url-parse-lax": "^3.0.0", "url-to-options": "^1.0.1" - }, - "dependencies": { - "@sindresorhus/is": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", - "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==" - }, - "cacheable-request": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", - "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=", - "requires": { - "clone-response": "1.0.2", - "get-stream": "3.0.0", - "http-cache-semantics": "3.8.1", - "keyv": "3.0.0", - "lowercase-keys": "1.0.0", - "normalize-url": "2.0.1", - "responselike": "1.0.2" - }, - "dependencies": { - "lowercase-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", - "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=" - } - } - }, - "http-cache-semantics": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", - "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==" - }, - "keyv": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", - "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", - "requires": { - "json-buffer": "3.0.0" - } - }, - "p-cancelable": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", - "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==" - } } }, "http-cache-semantics": {