commit
62de1e6b07
10
README.md
10
README.md
@ -97,4 +97,12 @@ tenorAPIKey=<Tenor API Key>
|
|||||||
ownerId=<your Discord user ID>
|
ownerId=<your Discord user ID>
|
||||||
statusChannelId=<Discord channel ID of channel used for status messages>
|
statusChannelId=<Discord channel ID of channel used for status messages>
|
||||||
clientId=<Discord user ID of your bot>
|
clientId=<Discord user ID of your bot>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
v3.0.1 - Migrate TenorJS API Endpoint
|
||||||
|
v3.0.2 - Add medical advice commands
|
||||||
|
v3.0.3 - Fix broken `/requests` command
|
||||||
|
v3.0.4 - Add ability to use multiple aliases
|
||||||
|
v3.0.5 - Add ability to save strains
|
19
functions.js
19
functions.js
@ -351,7 +351,7 @@ const functions = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Rating',
|
name: 'Rating',
|
||||||
value: `${strainInfo.rating}⭐️s`,
|
value: `⭐️${strainInfo.rating}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -440,6 +440,23 @@ const functions = {
|
|||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.download.medicalAdvice(client);
|
functions.download.medicalAdvice(client);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
strain(interaction) {
|
||||||
|
const strain = db.escape(interaction.options.getString('name'));
|
||||||
|
const type = db.escape(interaction.options.getString('type'));
|
||||||
|
const effects = db.escape(( interaction.options.getString('effects') || 'Unkown' ));
|
||||||
|
const description = db.escape(( interaction.options.getString('description') || 'Unknown' ));
|
||||||
|
const flavor = db.escape(( interaction.options.getString('flavor') || 'Unknown' ));
|
||||||
|
const rating = db.escape(( interaction.options.getString('rating') || '3' ));
|
||||||
|
const strainQuery = `INSERT INTO strains (strain, type, effects, description, flavor, rating) VALUES (${strain}, ${type}, ${effects}, ${description}, ${flavor}, ${rating})`;
|
||||||
|
console.log(strainQuery);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
db.query(strainQuery, (err, rows, fields) => {
|
||||||
|
if (err) reject(err);
|
||||||
|
functions.download.strains(interaction.client);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
download: {
|
download: {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "nodbot",
|
"name": "nodbot",
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"description": "Nods and Nod Accessories.",
|
"description": "Nods and Nod Accessories.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^0.6.0",
|
"@discordjs/builders": "^0.16.0",
|
||||||
"@discordjs/rest": "^0.1.0-canary.0",
|
"@discordjs/rest": "^0.1.0-canary.0",
|
||||||
"axios": "^0.21.4",
|
"axios": "^0.21.4",
|
||||||
"discord-api-types": "^0.22.0",
|
"discord-api-types": "^0.22.0",
|
||||||
"discord.js": "^13.1.0",
|
"discord.js": "~13.11.0",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"fuzzy-search": "^3.2.1",
|
"fuzzy-search": "^3.2.1",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
|
54
slash-commands/savestrain.js
Normal file
54
slash-commands/savestrain.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
|
const fn = require('../functions.js');
|
||||||
|
const { emoji } = require('../strings.json');
|
||||||
|
|
||||||
|
// Strain Name | Type | Effects | Flavor | Rating | Description
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('savestrain')
|
||||||
|
.setDescription('Store a new Strain in the database!')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('name')
|
||||||
|
.setDescription('Name of the Strain')
|
||||||
|
.setRequired(true))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('type')
|
||||||
|
.setDescription('Indica/Sativa/Hybrid')
|
||||||
|
.setRequired(true)
|
||||||
|
.addChoices(
|
||||||
|
{ name: "Indica", value: "Indica" },
|
||||||
|
{ name: "Hybrid", value: "Hybrid" },
|
||||||
|
{ name: "Sativa", value: "Sativa" }
|
||||||
|
))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('effects')
|
||||||
|
.setDescription('The effects given by the strain')
|
||||||
|
.setRequired(false))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('flavor')
|
||||||
|
.setDescription('Flavor notes')
|
||||||
|
.setRequired(false))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('rating')
|
||||||
|
.setDescription('Number of stars')
|
||||||
|
.setRequired(false))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('description')
|
||||||
|
.setDescription('Description of the strain')
|
||||||
|
.setRequired(false)),
|
||||||
|
async execute(interaction) {
|
||||||
|
fn.upload.strain(interaction).then(res => {
|
||||||
|
interaction.reply({
|
||||||
|
content: `The strain information has been saved. (${interaction.options.getString('name')})`,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(`E: ${err}`);
|
||||||
|
interaction.reply({
|
||||||
|
content: 'There was a problem saving the strain.',
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user