aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/routes/quotes.js17
-rw-r--r--commands/quote.js6
-rw-r--r--package.json2
-rw-r--r--storage/settings.json2
4 files changed, 23 insertions, 4 deletions
diff --git a/api/routes/quotes.js b/api/routes/quotes.js
index 39aba7b..9c933f8 100644
--- a/api/routes/quotes.js
+++ b/api/routes/quotes.js
@@ -16,6 +16,23 @@ router.get('/pending-quotes', async (req, res) => {
}
});
+router.post('/add-quote', async (req, res) => {
+ const { author, authorImage, quote, year, submitterID } = req.body;
+ try {
+ await approvedQuote.create({
+ author: author,
+ authorImage: authorImage,
+ quote: quote,
+ year: year,
+ submitter: submitterID
+ });
+ res.status(200).send('Added a new quote');
+ } catch (error) {
+ console.error('Something went wrong:', error);
+ res.status(500).send('Internal Server Error');
+ }
+});
+
router.post('/approve-quote', async (req, res) => {
const { id } = req.body;
try {
diff --git a/commands/quote.js b/commands/quote.js
index f19675f..72bd07b 100644
--- a/commands/quote.js
+++ b/commands/quote.js
@@ -28,14 +28,16 @@ module.exports.run = async (client, message, args) => {
quoteID = quoteList[random[0] % quoteList.length].id;
}
- const quote = await quoteDB.findOne({ where: { id: quoteID } })
+ const quote = await quoteDB.findOne({ where: { id: quoteID } });
+
+ let userSubmitter = await client.users.fetch(quote.submitter);
if (quote) {
const quoteEmbed = new MessageEmbed()
.setAuthor({ name: quote.author, iconURL: quote.authorImage })
.setDescription(quote.quote)
.setColor('#1fd619')
- .setFooter(`- ${quote.year}\nSubmitted by ${quote.submitter}`);
+ .setFooter(`- ${quote.year}\nSubmitted by ${userSubmitter.username}`);
await message.reply({ embeds: [quoteEmbed] })
} else {
diff --git a/package.json b/package.json
index 404b4a5..312e314 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "aleebot",
- "version": "2.13.0",
+ "version": "2.13.1",
"description": "A chat bot for discord written in discord.js.",
"main": "bot_discord.js",
"scripts": {
diff --git a/storage/settings.json b/storage/settings.json
index 4a6911c..b196429 100644
--- a/storage/settings.json
+++ b/storage/settings.json
@@ -1,4 +1,4 @@
{
- "abVersion": "2.13.0",
+ "abVersion": "2.13.1",
"prefix": "ab:"
}