Compare commits
1 Commits
a8519af9cc
...
ff3a423a30
| Author | SHA1 | Date | |
|---|---|---|---|
| ff3a423a30 |
@ -46,48 +46,6 @@ module.exports = {
|
|||||||
this.content = typeof content === 'string' ? content : this.content;
|
this.content = typeof content === 'string' ? content : this.content;
|
||||||
this.iconUrl = typeof iconUrl === 'string' ? iconUrl : this.iconUrl;
|
this.iconUrl = typeof iconUrl === 'string' ? iconUrl : this.iconUrl;
|
||||||
|
|
||||||
return this; // For chaining
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// StrainData
|
|
||||||
StrainData: class {
|
|
||||||
constructor() {
|
|
||||||
this.id = 0;
|
|
||||||
this.name = "Unknown";
|
|
||||||
this.type = "Unknown";
|
|
||||||
this.effects = "Unknown";
|
|
||||||
this.flavor = "Unknown";
|
|
||||||
this.rating = "0.0";
|
|
||||||
this.description = "Unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initial Strain configuration
|
|
||||||
// Can also be used to update the data piecemeal
|
|
||||||
setInfo(name, details, id) {
|
|
||||||
/* details contains all the optional pieces of data
|
|
||||||
This is to prevent having to call setInfo(name, undefined, undefined, undefined, 0) or something
|
|
||||||
details: {
|
|
||||||
type: String,
|
|
||||||
effects: String,
|
|
||||||
rating: String,
|
|
||||||
description: String
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Check for existing or incoming name
|
|
||||||
if ((this.name === "") && (typeof name !== 'string')) throw `Error: This Strain doesn't have existing name, and no name is going to be set.`;
|
|
||||||
|
|
||||||
// Property is set if the variable is the right type,
|
|
||||||
// otherwise it keeps the existing property
|
|
||||||
this.id = typeof id === 'number' ? id : this.id;
|
|
||||||
this.name = typeof name === 'string' ? name : this.name;
|
|
||||||
this.type = typeof details.type === 'string' ? details.type : this.type;
|
|
||||||
this.effects = typeof details.effects === 'string' ? details.effects : this.effects;
|
|
||||||
this.flavor = typeof details.flavor === 'string' ? details.flavor : this.flavor;
|
|
||||||
this.rating = typeof details.rating === 'string' ? details.rating : this.rating;
|
|
||||||
this.description = typeof details.description === 'string' ? details.description : this.description;
|
|
||||||
|
|
||||||
|
|
||||||
return this; // For chaining
|
return this; // For chaining
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,4 +5,4 @@ WORKDIR /usr/src/app
|
|||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
COPY . .
|
||||||
CMD ["/bin/sh", "-c", "node main.js 2> /logs/$(date +%Y-%m-%d_%H-%M-%S)-error.txt 1> /logs/$(date +%Y-%m-%d_%H-%M-%S)-status.txt"]
|
CMD ["/bin/sh", "-c", "node main.js 2> /logs/nodbot.error 1> /logs/nodbot.log"]
|
||||||
@ -10,10 +10,7 @@ module.exports = {
|
|||||||
// message.reply(fn.spongebob(commandData)).then(() => {
|
// message.reply(fn.spongebob(commandData)).then(() => {
|
||||||
// message.delete();
|
// message.delete();
|
||||||
// });
|
// });
|
||||||
// Check if the message is replying to another message
|
|
||||||
if (message.reference != undefined) {
|
if (message.reference != undefined) {
|
||||||
// Check if the message is just ".sb" or ".spongebob" (empty arguments)
|
|
||||||
if (commandData.args === "") {
|
|
||||||
const repliedMessageId = message.reference.messageId;
|
const repliedMessageId = message.reference.messageId;
|
||||||
message.channel.messages.fetch(repliedMessageId)
|
message.channel.messages.fetch(repliedMessageId)
|
||||||
.then(repliedMessage => {
|
.then(repliedMessage => {
|
||||||
@ -24,18 +21,6 @@ module.exports = {
|
|||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
} else { // If there is content before the .sb, meaning the reply is just for reference...
|
|
||||||
const repliedMessageId = message.reference.messageId;
|
|
||||||
message.channel.messages.fetch(repliedMessageId)
|
|
||||||
.then(repliedMessage => {
|
|
||||||
repliedMessage.reply(fn.spongebob({ args: commandData.args })).then(() => {
|
|
||||||
if (message.deletable) message.delete();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
message.channel.send(fn.spongebob(commandData)).then(() => {
|
message.channel.send(fn.spongebob(commandData)).then(() => {
|
||||||
if (message.deletable) message.delete();
|
if (message.deletable) message.delete();
|
||||||
|
|||||||
77
functions.js
77
functions.js
@ -42,11 +42,10 @@ const config = require('./config.json');
|
|||||||
const strings = require('./strings.json');
|
const strings = require('./strings.json');
|
||||||
const slashCommandFiles = fs.readdirSync('./slash-commands/').filter(file => file.endsWith('.js'));
|
const slashCommandFiles = fs.readdirSync('./slash-commands/').filter(file => file.endsWith('.js'));
|
||||||
const dotCommandFiles = fs.readdirSync('./dot-commands/').filter(file => file.endsWith('.js'));
|
const dotCommandFiles = fs.readdirSync('./dot-commands/').filter(file => file.endsWith('.js'));
|
||||||
const https = require('https');
|
|
||||||
|
|
||||||
// MySQL database connection
|
// MySQL database connection
|
||||||
const mysql = require('mysql');
|
const mysql = require('mysql');
|
||||||
const { GifData, PastaData, StrainData } = require('./CustomModules/NodBot');
|
const { GifData, PastaData } = require('./CustomModules/NodBot');
|
||||||
const db = new mysql.createPool({
|
const db = new mysql.createPool({
|
||||||
connectionLimit: 10,
|
connectionLimit: 10,
|
||||||
host: dbHost,
|
host: dbHost,
|
||||||
@ -152,18 +151,11 @@ const functions = {
|
|||||||
if (!client.strains) client.strains = new Discord.Collection();
|
if (!client.strains) client.strains = new Discord.Collection();
|
||||||
client.strains.clear();
|
client.strains.clear();
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
const strainData = new StrainData().setInfo(
|
const strain = {
|
||||||
row.strain,
|
id: row.id,
|
||||||
{
|
name: row.strain,
|
||||||
type: row.type,
|
};
|
||||||
effects: row.effects,
|
client.strains.set(strain.name, strain);
|
||||||
rating: row.rating,
|
|
||||||
description: row.description,
|
|
||||||
flavor: row.flavor
|
|
||||||
},
|
|
||||||
row.id
|
|
||||||
);
|
|
||||||
client.strains.set(strainData.name, strainData);
|
|
||||||
// if (isDev) console.log(strain)
|
// if (isDev) console.log(strain)
|
||||||
}
|
}
|
||||||
if (isDev) console.log('Strains Collection Built');
|
if (isDev) console.log('Strains Collection Built');
|
||||||
@ -373,7 +365,7 @@ const functions = {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return { embeds: [ strainEmbed ]};
|
interaction.reply({ embeds: [ strainEmbed ]});
|
||||||
},
|
},
|
||||||
dalle(prompt, imageUrl, size) {
|
dalle(prompt, imageUrl, size) {
|
||||||
const dalleEmbed = new Discord.MessageEmbed()
|
const dalleEmbed = new Discord.MessageEmbed()
|
||||||
@ -478,8 +470,14 @@ const functions = {
|
|||||||
functions.download.medicalAdvice(client);
|
functions.download.medicalAdvice(client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
strain(interaction, strainData) {
|
strain(interaction) {
|
||||||
const strainQuery = `INSERT INTO strains (strain, type, effects, description, flavor, rating) VALUES (${db.escape(strainData.name)}, ${db.escape(strainData.type)}, ${db.escape(strainData.effects)}, ${db.escape(strainData.description)}, ${db.escape(strainData.flavor)}, ${db.escape(strainData.rating)}) ON DUPLICATE KEY UPDATE type=${db.escape(strainData.type)}, effects=${db.escape(strainData.effects)}, description=${db.escape(strainData.description)}, flavor=${db.escape(strainData.flavor)}, rating=${db.escape(strainData.rating)}`;
|
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}) ON DUPLICATE KEY UPDATE strain=${db.escape(strain)}, type=${db.escape(type)}, effects=${db.escape(effects)}, description=${db.escape(description)}, flavor=${db.escape(flavor)}, rating=${db.escape(rating)}`;
|
||||||
console.log(strainQuery);
|
console.log(strainQuery);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
db.query(strainQuery, (err, rows, fields) => {
|
db.query(strainQuery, (err, rows, fields) => {
|
||||||
@ -497,16 +495,16 @@ const functions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
download: {
|
download: {
|
||||||
async requests(client) {
|
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';
|
||||||
await 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);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async pastas(client) {
|
pastas(client) {
|
||||||
const query = 'SELECT * FROM pastas ORDER BY id ASC';
|
const query = 'SELECT * FROM pastas ORDER BY id ASC';
|
||||||
await db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.pastas(rows, client);
|
functions.collections.pastas(rows, client);
|
||||||
});
|
});
|
||||||
@ -518,17 +516,16 @@ const functions = {
|
|||||||
functions.collections.gifs(rows, client);
|
functions.collections.gifs(rows, client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async joints(client) {
|
joints(client) {
|
||||||
const query = 'SELECT * FROM joints ORDER BY id ASC';
|
const query = 'SELECT * FROM joints ORDER BY id ASC';
|
||||||
await db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.joints(rows, client);
|
functions.collections.joints(rows, client);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async strain(strainName, interaction) {
|
strain(strainName, interaction) {
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
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)}`;
|
||||||
await db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (rows != undefined) {
|
if (rows != undefined) {
|
||||||
const strainInfo = {
|
const strainInfo = {
|
||||||
id: `${rows[0].id}`,
|
id: `${rows[0].id}`,
|
||||||
@ -539,23 +536,20 @@ const functions = {
|
|||||||
flavor: `${rows[0].flavor}`,
|
flavor: `${rows[0].flavor}`,
|
||||||
rating: `${rows[0].rating}`,
|
rating: `${rows[0].rating}`,
|
||||||
};
|
};
|
||||||
const embed = functions.embeds.strain(strainInfo, interaction);
|
functions.embeds.strain(strainInfo, interaction);
|
||||||
resolve(embed);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async strains(client) {
|
strains(client) {
|
||||||
const query = 'SELECT * FROM strains';
|
const query = 'SELECT id, strain FROM strains';
|
||||||
await 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);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async medicalAdvice(client) {
|
medicalAdvice(client) {
|
||||||
const query = 'SELECT * FROM medical_advice ORDER BY id ASC';
|
const query = 'SELECT * FROM medical_advice ORDER BY id ASC';
|
||||||
await db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
functions.collections.medicalAdvice(rows, client);
|
functions.collections.medicalAdvice(rows, client);
|
||||||
});
|
});
|
||||||
@ -671,19 +665,6 @@ const functions = {
|
|||||||
}
|
}
|
||||||
const errorId = digits.join("");
|
const errorId = digits.join("");
|
||||||
return errorId;
|
return errorId;
|
||||||
},
|
|
||||||
async sendHeartbeat(url) {
|
|
||||||
if (isDev) console.log("Heartbeat Sent: " + url);
|
|
||||||
https.get(url, async (response) => {
|
|
||||||
let data = '';
|
|
||||||
|
|
||||||
response.on('data', (chunk) => data += chunk);
|
|
||||||
|
|
||||||
response.on('end', () => {
|
|
||||||
parsedData = JSON.parse(data);
|
|
||||||
if ( !(parsedData.ok) ) console.error("Heartbeat failed");
|
|
||||||
});
|
|
||||||
}).on("error", (error) => console.error(error));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
41
main.js
41
main.js
@ -3,16 +3,9 @@
|
|||||||
// dotenv for handling environment variables
|
// dotenv for handling environment variables
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
const isDev = process.env.isDev === 'true';
|
|
||||||
const token = process.env.TOKEN;
|
const token = process.env.TOKEN;
|
||||||
const statusChannelId = process.env.statusChannelId;
|
const statusChannelId = process.env.statusChannelId;
|
||||||
const heartbeatUrl = process.env.HEARTBEAT_URL;
|
|
||||||
const sendHeartbeat = typeof heartbeatUrl === 'string';
|
|
||||||
if (sendHeartbeat) {
|
|
||||||
if (isDev) console.log("Hearbeat Enabled: " + heartbeatUrl);
|
|
||||||
} else {
|
|
||||||
if (isDev) console.log("Hearbeat Disabled: " + heartbeatUrl + " (" + typeof heartbeatUrl + ")");
|
|
||||||
}
|
|
||||||
// Discord.JS
|
// Discord.JS
|
||||||
const { Client, Intents } = require('discord.js');
|
const { Client, Intents } = require('discord.js');
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
@ -35,28 +28,22 @@ const fn = require('./functions.js');
|
|||||||
const config = require('./config.json');
|
const config = require('./config.json');
|
||||||
const strings = require('./strings.json');
|
const strings = require('./strings.json');
|
||||||
const { GifData } = require('./CustomModules/NodBot.js');
|
const { GifData } = require('./CustomModules/NodBot.js');
|
||||||
|
const isDev = process.env.isDev;
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', () => {
|
||||||
fn.collections.slashCommands(client);
|
fn.collections.slashCommands(client);
|
||||||
fn.collections.dotCommands(client);
|
fn.collections.dotCommands(client);
|
||||||
fn.collections.setvalidCommands(client);
|
fn.collections.setvalidCommands(client);
|
||||||
await fn.download.gifs(client);
|
fn.download.gifs(client);
|
||||||
await fn.download.pastas(client);
|
fn.download.pastas(client);
|
||||||
await fn.download.joints(client);
|
fn.download.joints(client);
|
||||||
await fn.download.requests(client);
|
fn.download.requests(client);
|
||||||
await fn.download.strains(client);
|
fn.download.strains(client);
|
||||||
await fn.download.medicalAdvice(client);
|
fn.download.medicalAdvice(client);
|
||||||
console.log('Ready!');
|
console.log('Ready!');
|
||||||
await client.channels.fetch(statusChannelId).then(channel => {
|
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`);
|
||||||
});
|
});
|
||||||
// Heartbeat Timer
|
|
||||||
if (sendHeartbeat) {
|
|
||||||
setInterval(() => {
|
|
||||||
fn.sendHeartbeat(heartbeatUrl);
|
|
||||||
}, 30000);
|
|
||||||
if (isDev) console.log("Heartbeat interval set.");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// slash-commands
|
// slash-commands
|
||||||
@ -216,14 +203,6 @@ 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;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const tenor = require('tenorjs').client({
|
|||||||
|
|
||||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
const { MessageActionRow, MessageButton } = require('discord.js');
|
const { MessageActionRow, MessageButton } = require('discord.js');
|
||||||
const { GifData, PastaData, StrainData } = require('../CustomModules/NodBot');
|
const { GifData, PastaData } = require('../CustomModules/NodBot');
|
||||||
const fn = require('../functions.js');
|
const fn = require('../functions.js');
|
||||||
const strings = require('../strings.json');
|
const strings = require('../strings.json');
|
||||||
const { emoji } = strings;
|
const { emoji } = strings;
|
||||||
@ -54,54 +54,6 @@ module.exports = {
|
|||||||
.setDescription('The new content of the copypasta')
|
.setDescription('The new content of the copypasta')
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
// Strain
|
|
||||||
.addSubcommand(subcommand =>
|
|
||||||
subcommand
|
|
||||||
.setName('strain')
|
|
||||||
.setDescription('Edit a strain\'s data')
|
|
||||||
.addStringOption(option =>
|
|
||||||
option
|
|
||||||
.setName('name')
|
|
||||||
.setDescription('Name of the strain')
|
|
||||||
.setRequired(true)
|
|
||||||
.setAutocomplete(true)
|
|
||||||
)
|
|
||||||
.addStringOption(option =>
|
|
||||||
option
|
|
||||||
.setName('type')
|
|
||||||
.setDescription('Indica/Sativa/Hybrid')
|
|
||||||
.setRequired(false)
|
|
||||||
.addChoices(
|
|
||||||
{ name: "Indica", value: "Indica" },
|
|
||||||
{ name: "Hybrid", value: "Hybrid" },
|
|
||||||
{ name: "Sativa", value: "Sativa" }
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.addStringOption(option =>
|
|
||||||
option
|
|
||||||
.setName('effects')
|
|
||||||
.setDescription('What effects does the strain produce?')
|
|
||||||
.setRequired(false)
|
|
||||||
)
|
|
||||||
.addStringOption(option =>
|
|
||||||
option
|
|
||||||
.setName('flavor')
|
|
||||||
.setDescription('Flavor Profile')
|
|
||||||
.setRequired(false)
|
|
||||||
)
|
|
||||||
.addStringOption(option =>
|
|
||||||
option
|
|
||||||
.setName('rating')
|
|
||||||
.setDescription('Star rating of the strain on Leaf.ly')
|
|
||||||
.setRequired(false)
|
|
||||||
)
|
|
||||||
.addStringOption(option =>
|
|
||||||
option
|
|
||||||
.setName('description')
|
|
||||||
.setDescription('Summary of the strain')
|
|
||||||
.setRequired(false)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
@ -130,7 +82,6 @@ module.exports = {
|
|||||||
// Strain
|
// Strain
|
||||||
case "strain":
|
case "strain":
|
||||||
//TODO
|
//TODO
|
||||||
await this.editStrain(interaction);
|
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
// Default
|
// Default
|
||||||
@ -155,19 +106,5 @@ module.exports = {
|
|||||||
await fn.upload.pasta(pastaData, interaction.client);
|
await fn.upload.pasta(pastaData, interaction.client);
|
||||||
await fn.download.gifs(interaction.client);
|
await fn.download.gifs(interaction.client);
|
||||||
await interaction.editReply(`I've updated ${name}.pasta`);
|
await interaction.editReply(`I've updated ${name}.pasta`);
|
||||||
},
|
|
||||||
async editStrain(interaction) {
|
|
||||||
const details = {
|
|
||||||
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')
|
|
||||||
};
|
|
||||||
const strainData = interaction.client.strains.get(interaction.options.getString('name'));
|
|
||||||
strainData.setInfo(interaction.options.getString('name'), details);
|
|
||||||
await fn.upload.strain(interaction, strainData);
|
|
||||||
const reply = await fn.download.strain(strainData.name, interaction);
|
|
||||||
await interaction.editReply(reply);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -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, StrainData } = require('../CustomModules/NodBot.js');
|
const { GifData } = require('../CustomModules/NodBot.js');
|
||||||
const { emoji } = strings;
|
const { emoji } = strings;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -213,17 +213,7 @@ module.exports = {
|
|||||||
// Strain
|
// Strain
|
||||||
case "strain":
|
case "strain":
|
||||||
//TODO
|
//TODO
|
||||||
const strainData = new StrainData().setInfo(
|
fn.upload.strain(interaction).then(res => {
|
||||||
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
|
||||||
|
|||||||
@ -12,8 +12,6 @@ module.exports = {
|
|||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.setAutocomplete(true)),
|
.setAutocomplete(true)),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
fn.download.strain(interaction.options.getString('name'), interaction);
|
||||||
const reply = await fn.download.strain(interaction.options.getString('name'), interaction);
|
|
||||||
await interaction.editReply(reply);
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Loading…
Reference in New Issue
Block a user