FUCK
This commit is contained in:
parent
df8ff0016e
commit
f62538ee0c
28
functions.js
28
functions.js
@ -61,7 +61,7 @@ const functions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isDev) console.log('Valid Commands Added to Config');
|
if (isDev) console.log(`Valid Commands Added to Config\n${config.validCommands}`);
|
||||||
},
|
},
|
||||||
dotCommands(client) {
|
dotCommands(client) {
|
||||||
if (!client.dotCommands) client.dotCommands = new Discord.Collection();
|
if (!client.dotCommands) client.dotCommands = new Discord.Collection();
|
||||||
@ -133,9 +133,10 @@ const functions = {
|
|||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
const strain = {
|
const strain = {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
name: row.name,
|
name: row.strain,
|
||||||
};
|
};
|
||||||
client.strains.set(strain.name, strain);
|
client.strains.set(strain.name, strain);
|
||||||
|
// if (isDev) console.log(strain)
|
||||||
}
|
}
|
||||||
if (isDev) console.log('Strains Collection Built');
|
if (isDev) console.log('Strains Collection Built');
|
||||||
}
|
}
|
||||||
@ -145,6 +146,7 @@ const functions = {
|
|||||||
const commandData = {};
|
const commandData = {};
|
||||||
// Split the message content at the final instance of a period
|
// Split the message content at the final instance of a period
|
||||||
const finalPeriod = message.content.lastIndexOf('.');
|
const finalPeriod = message.content.lastIndexOf('.');
|
||||||
|
if(isDev) console.log(message.content);
|
||||||
// If the final period is the last character, or doesn't exist
|
// If the final period is the last character, or doesn't exist
|
||||||
if (finalPeriod < 0) {
|
if (finalPeriod < 0) {
|
||||||
if (isDev) console.log(finalPeriod);
|
if (isDev) console.log(finalPeriod);
|
||||||
@ -310,7 +312,8 @@ const functions = {
|
|||||||
strainEmbed.addFields([
|
strainEmbed.addFields([
|
||||||
{
|
{
|
||||||
name: 'Strain Name',
|
name: 'Strain Name',
|
||||||
value: `${strainInfo.name}`,
|
value: `${strainInfo.strain}`,
|
||||||
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Type',
|
name: 'Type',
|
||||||
@ -323,8 +326,8 @@ const functions = {
|
|||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Treats',
|
name: 'Flavor',
|
||||||
value: `${strainInfo.ailments}`,
|
value: `${strainInfo.flavor}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -332,6 +335,11 @@ const functions = {
|
|||||||
value: `${strainInfo.rating}⭐️s`,
|
value: `${strainInfo.rating}⭐️s`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Description',
|
||||||
|
value: `${strainInfo.description}`,
|
||||||
|
inline: false,
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
message.reply({ embeds: [ strainEmbed ]});
|
message.reply({ embeds: [ strainEmbed ]});
|
||||||
@ -439,23 +447,25 @@ const functions = {
|
|||||||
},
|
},
|
||||||
strain(commandData, message) {
|
strain(commandData, message) {
|
||||||
const { strainName } = commandData;
|
const { strainName } = commandData;
|
||||||
const query = `SELECT id, name, type, effects, ailment, flavor FROM strains WHERE name = ${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) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
|
if (err) throw err;
|
||||||
if (rows != undefined) {
|
if (rows != undefined) {
|
||||||
commandData.strainInfo = {
|
commandData.strainInfo = {
|
||||||
id: `${rows[0].id}`,
|
id: `${rows[0].id}`,
|
||||||
name: `${rows[0].name}`,
|
strain: `${rows[0].strain}`,
|
||||||
type: `${rows[0].type}`,
|
type: `${rows[0].type}`,
|
||||||
effects: `${rows[0].effects}`,
|
effects: `${rows[0].effects}`,
|
||||||
ailments: `${rows[0].ailment}`,
|
description: `${rows[0].description}`,
|
||||||
flavor: `${rows[0].flavor}`,
|
flavor: `${rows[0].flavor}`,
|
||||||
|
rating: `${rows[0].rating}`,
|
||||||
};
|
};
|
||||||
functions.embeds.strain(commandData, message);
|
functions.embeds.strain(commandData, message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
strains(client) {
|
strains(client) {
|
||||||
const query = 'SELECT id, name FROM strains';
|
const query = 'SELECT id, strain FROM strains';
|
||||||
db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.strains(rows, client);
|
functions.collections.strains(rows, client);
|
||||||
|
Loading…
Reference in New Issue
Block a user