Migrating to Postgres
This commit is contained in:
parent
a8489deb40
commit
8ef34b0cdf
28
functions.js
28
functions.js
@ -108,22 +108,24 @@ module.exports = {
|
|||||||
.setFooter(`@${author.username}#${author.discriminator}`);
|
.setFooter(`@${author.username}#${author.discriminator}`);
|
||||||
},
|
},
|
||||||
saveGif(message, name, embed_url) {
|
saveGif(message, name, embed_url) {
|
||||||
fs.writeFile(`./gifs/${name}.js`, `module.exports = {\n\tname: '${name}',\n\tembed_url: '${embed_url}'\n}`, function(err) {
|
const gif = {
|
||||||
if (err) throw err;
|
name: name,
|
||||||
console.log('Saved file!');
|
embed_url: embed_url
|
||||||
const gif = require(`./gifs/${name}.js`);
|
};
|
||||||
message.client.gifs.set(gif.name, gif);
|
message.client.gifs.set(gif.name, gif);
|
||||||
});
|
this.uploadGIF(name, embed_url);
|
||||||
},
|
},
|
||||||
savePasta(message, name, content) {
|
savePasta(message, name, content) {
|
||||||
fs.writeFile(`./pastas/${name}.js`, `module.exports = {\n\tname: '${name}',\n\tcontent: '${content}'\n}`, function(err) {
|
const pasta = {
|
||||||
if (err) {
|
name: name,
|
||||||
return `There was a problem saving the copypasta.`;
|
content: content
|
||||||
}
|
};
|
||||||
const pasta = require(`./pastas/${name}.js`);
|
|
||||||
message.client.pastas.set(pasta.name, pasta);
|
message.client.pastas.set(pasta.name, pasta);
|
||||||
});
|
|
||||||
return `Copypasta saved successfully as ${name}.pasta`;
|
const query = `INSERT INTO pastas (name, content) VALUES ('${name}','${content}')`;
|
||||||
|
db.query(query);
|
||||||
|
|
||||||
|
return "Success";
|
||||||
},
|
},
|
||||||
createAirportEmbed(data, author, command) {
|
createAirportEmbed(data, author, command) {
|
||||||
const airport = data.airport[0];
|
const airport = data.airport[0];
|
||||||
@ -234,7 +236,7 @@ module.exports = {
|
|||||||
.setFooter(`@${message.author.username}#${message.author.discriminator}`);
|
.setFooter(`@${message.author.username}#${message.author.discriminator}`);
|
||||||
},
|
},
|
||||||
uploadGIF(name, embed_url) {
|
uploadGIF(name, embed_url) {
|
||||||
const query = `INSERT INTO gifs (name, embed_url) VALUES ('${name}','${embed_url})'`;
|
const query = `INSERT INTO gifs (name, embed_url) VALUES ('${name}','${embed_url}')`;
|
||||||
db.query(query)
|
db.query(query)
|
||||||
.then()
|
.then()
|
||||||
.catch(e => console.error(e));
|
.catch(e => console.error(e));
|
||||||
|
Loading…
Reference in New Issue
Block a user