Merge pull request #17 from voidf1sh/3.0.8
3.0.8 Add page selection to Requests
This commit is contained in:
commit
d968bed644
@ -108,3 +108,4 @@ v3.0.4 - Add ability to use multiple aliases
|
|||||||
v3.0.5 - Add ability to save strains
|
v3.0.5 - Add ability to save strains
|
||||||
v3.0.6 - Move `.strain` to `/strain` and add Autocomplete
|
v3.0.6 - Move `.strain` to `/strain` and add Autocomplete
|
||||||
v3.0.7 - Add `.spongebob` replies
|
v3.0.7 - Add `.spongebob` replies
|
||||||
|
v3.0.8 - Add ability to open requests by pages
|
@ -459,7 +459,7 @@ const functions = {
|
|||||||
},
|
},
|
||||||
download: {
|
download: {
|
||||||
requests(client) {
|
requests(client) {
|
||||||
const query = 'SELECT * FROM requests WHERE status = \'Active\' ORDER BY id DESC LIMIT 10';
|
const query = 'SELECT * FROM requests WHERE status = \'Active\' ORDER BY id DESC';
|
||||||
db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.requests(rows, client);
|
functions.collections.requests(rows, client);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodbot",
|
"name": "nodbot",
|
||||||
"version": "3.0.7",
|
"version": "3.0.8",
|
||||||
"description": "Nods and Nod Accessories.",
|
"description": "Nods and Nod Accessories.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -5,8 +5,14 @@ const fn = require('../functions.js');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('requests')
|
.setName('requests')
|
||||||
.setDescription('Get a list of Active requests from the database'),
|
.setDescription('Get a list of Active requests from the database')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option
|
||||||
|
.setName('page')
|
||||||
|
.setDescription('Page Number')
|
||||||
|
.setRequired(true)),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
|
const pageNum = interaction.options.getString('page');
|
||||||
const commandData = {
|
const commandData = {
|
||||||
author: interaction.user.tag,
|
author: interaction.user.tag,
|
||||||
command: interaction.commandName,
|
command: interaction.commandName,
|
||||||
@ -19,12 +25,14 @@ module.exports = {
|
|||||||
request: e.request,
|
request: e.request,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
for (const row of requestsMap) {
|
for (let i = ( 10 * ( pageNum - 1 ) ); i < ( 10 * pageNum ); i++) {
|
||||||
commandData.requests.push({
|
if (requestsMap[i] != undefined) {
|
||||||
id: row.id,
|
commandData.requests.push({
|
||||||
author: row.author,
|
id: requestsMap[i].id,
|
||||||
request: row.request,
|
author: requestsMap[i].author,
|
||||||
});
|
request: requestsMap[i].request,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
interaction.reply(fn.embeds.requests(commandData));
|
interaction.reply(fn.embeds.requests(commandData));
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user