/save is broken, /edit still needs work
This commit is contained in:
parent
3df83d3890
commit
93626ff8e5
24
functions.js
24
functions.js
@ -496,16 +496,16 @@ const functions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
download: {
|
download: {
|
||||||
requests(client) {
|
async requests(client) {
|
||||||
const query = 'SELECT * FROM requests WHERE status = \'Active\' ORDER BY id DESC';
|
const query = 'SELECT * FROM requests WHERE status = \'Active\' ORDER BY id DESC';
|
||||||
db.query(query, (err, rows, fields) => {
|
await db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.requests(rows, client);
|
functions.collections.requests(rows, client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
pastas(client) {
|
async pastas(client) {
|
||||||
const query = 'SELECT * FROM pastas ORDER BY id ASC';
|
const query = 'SELECT * FROM pastas ORDER BY id ASC';
|
||||||
db.query(query, (err, rows, fields) => {
|
await db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.pastas(rows, client);
|
functions.collections.pastas(rows, client);
|
||||||
});
|
});
|
||||||
@ -517,16 +517,16 @@ const functions = {
|
|||||||
functions.collections.gifs(rows, client);
|
functions.collections.gifs(rows, client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
joints(client) {
|
async joints(client) {
|
||||||
const query = 'SELECT * FROM joints ORDER BY id ASC';
|
const query = 'SELECT * FROM joints ORDER BY id ASC';
|
||||||
db.query(query, (err, rows, fields) => {
|
await db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.joints(rows, client);
|
functions.collections.joints(rows, client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
strain(strainName, interaction) {
|
async strain(strainName, interaction) {
|
||||||
const query = `SELECT id, strain, type, effects, description, flavor, rating FROM strains WHERE strain = ${db.escape(strainName)}`;
|
const query = `SELECT id, strain, type, effects, description, flavor, rating FROM strains WHERE strain = ${db.escape(strainName)}`;
|
||||||
db.query(query, (err, rows, fields) => {
|
await db.query(query, (err, rows, fields) => {
|
||||||
if (rows != undefined) {
|
if (rows != undefined) {
|
||||||
const strainInfo = {
|
const strainInfo = {
|
||||||
id: `${rows[0].id}`,
|
id: `${rows[0].id}`,
|
||||||
@ -541,16 +541,16 @@ const functions = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
strains(client) {
|
async strains(client) {
|
||||||
const query = 'SELECT * FROM strains';
|
const query = 'SELECT * FROM strains';
|
||||||
db.query(query, (err, rows, fields) => {
|
await db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.strains(rows, client);
|
functions.collections.strains(rows, client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
medicalAdvice(client) {
|
async medicalAdvice(client) {
|
||||||
const query = 'SELECT * FROM medical_advice ORDER BY id ASC';
|
const query = 'SELECT * FROM medical_advice ORDER BY id ASC';
|
||||||
db.query(query, (err, rows, fields) => {
|
await db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.medicalAdvice(rows, client);
|
functions.collections.medicalAdvice(rows, client);
|
||||||
});
|
});
|
||||||
|
24
main.js
24
main.js
@ -30,18 +30,18 @@ const strings = require('./strings.json');
|
|||||||
const { GifData } = require('./CustomModules/NodBot.js');
|
const { GifData } = require('./CustomModules/NodBot.js');
|
||||||
const isDev = process.env.isDev;
|
const isDev = process.env.isDev;
|
||||||
|
|
||||||
client.once('ready', () => {
|
client.once('ready', async () => {
|
||||||
fn.collections.slashCommands(client);
|
fn.collections.slashCommands(client);
|
||||||
fn.collections.dotCommands(client);
|
fn.collections.dotCommands(client);
|
||||||
fn.collections.setvalidCommands(client);
|
fn.collections.setvalidCommands(client);
|
||||||
fn.download.gifs(client);
|
await fn.download.gifs(client);
|
||||||
fn.download.pastas(client);
|
await fn.download.pastas(client);
|
||||||
fn.download.joints(client);
|
await fn.download.joints(client);
|
||||||
fn.download.requests(client);
|
await fn.download.requests(client);
|
||||||
fn.download.strains(client);
|
await fn.download.strains(client);
|
||||||
fn.download.medicalAdvice(client);
|
await fn.download.medicalAdvice(client);
|
||||||
console.log('Ready!');
|
console.log('Ready!');
|
||||||
client.channels.fetch(statusChannelId).then(channel => {
|
await client.channels.fetch(statusChannelId).then(channel => {
|
||||||
channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`);
|
channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -203,6 +203,14 @@ client.on('interactionCreate', async interaction => {
|
|||||||
pastaChoices.map(choice => ({ name: choice, value: choice }))
|
pastaChoices.map(choice => ({ name: choice, value: choice }))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case "strain":
|
||||||
|
//TODO
|
||||||
|
const strainQuery = interaction.options.getFocused();
|
||||||
|
const strainChoices = fn.weed.strain.lookup(strainQuery, interaction.client);
|
||||||
|
await interaction.respond(
|
||||||
|
strainChoices.map(choice => ({ name: choice, value: choice }))
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -10,7 +10,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders');
|
|||||||
const { MessageActionRow, MessageButton } = require('discord.js');
|
const { MessageActionRow, MessageButton } = require('discord.js');
|
||||||
const fn = require('../functions.js');
|
const fn = require('../functions.js');
|
||||||
const strings = require('../strings.json');
|
const strings = require('../strings.json');
|
||||||
const { GifData } = require('../CustomModules/NodBot.js');
|
const { GifData, StrainData } = require('../CustomModules/NodBot.js');
|
||||||
const { emoji } = strings;
|
const { emoji } = strings;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -213,7 +213,17 @@ module.exports = {
|
|||||||
// Strain
|
// Strain
|
||||||
case "strain":
|
case "strain":
|
||||||
//TODO
|
//TODO
|
||||||
fn.upload.strain(interaction).then(res => {
|
const strainData = new StrainData().setInfo(
|
||||||
|
interaction.options.getString('name'),
|
||||||
|
{
|
||||||
|
type: interaction.options.getString('type'),
|
||||||
|
effects: interaction.options.getString('effects'),
|
||||||
|
flavor: interaction.options.getString('flavor'),
|
||||||
|
rating: interaction.options.getString('rating'),
|
||||||
|
description: interaction.options.getString('description')
|
||||||
|
}
|
||||||
|
);
|
||||||
|
fn.upload.strain(interaction, strainData).then(res => {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `The strain information has been saved. (${interaction.options.getString('name')})`,
|
content: `The strain information has been saved. (${interaction.options.getString('name')})`,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
|
Loading…
Reference in New Issue
Block a user