aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/about.js10
-rw-r--r--commands/addquote.js93
-rw-r--r--commands/ban.js2
-rw-r--r--commands/kick.js2
-rw-r--r--commands/leaveguild.js2
-rw-r--r--commands/quote.js73
-rw-r--r--commands/setlogchannel.js35
-rw-r--r--commands/setup.js46
-rw-r--r--commands/uptime.js11
9 files changed, 117 insertions, 157 deletions
diff --git a/commands/about.js b/commands/about.js
index 14daebb..be1c17d 100644
--- a/commands/about.js
+++ b/commands/about.js
@@ -20,12 +20,16 @@
module.exports.run = async (client, message) => {
const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js');
+ let Contributors = ('- Andrew Lee (Founder of this project)\n');
+ Contributors += ('- OfficialRain (Raina) (Uptime Command)\n');
+ Contributors += ('- jtsshieh (Command Handler)');
+
const aboutEmbed = new MessageEmbed()
.setAuthor(`AleeBot ${require('../storage/settings.json').abVersion}`, client.user.avatarURL())
.addField('About AleeBot', 'AleeBot is an all-in-one bot that\'s made from the Discord.JS API!')
.addField('License', 'GNU General Public License v3.0')
- .addField('Contributors', 'Andrew Lee (Founder of this project)\nOfficialRain (Raina) (Uptime Command)\njtsshieh (Command Handler)')
- .setFooter('© Copyright 2017-2022 Andrew Lee Projects')
+ .addField('Contributors', Contributors)
+ .setFooter('© Copyright 2017-2023 Andrew Lee Projects')
.setColor('#1fd619');
let inviteButton = new MessageActionRow()
@@ -36,7 +40,7 @@ module.exports.run = async (client, message) => {
.setURL('https://top.gg/bot/282547024547545109'),
new MessageButton()
.setStyle('LINK')
- .setLabel('Join Binaryworks Community')
+ .setLabel('Join Andrew Lee Projects')
.setURL('https://discord.gg/EFhRDqG')
);
diff --git a/commands/addquote.js b/commands/addquote.js
index 6334470..477d891 100644
--- a/commands/addquote.js
+++ b/commands/addquote.js
@@ -17,74 +17,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
-const mongo = require('../plugins/mongo');
-const quoteSchema = require('../schema/quote-schema');
+const quoteDB = require('../models/quote');
+const Discord = require("discord.js");
module.exports.run = async (client, message, args) => {
-/*
- let authorMessage;
- let authorImageMessage;
- let quoteMessage;
- let yearMessage;*/
-
if (!['242775871059001344'].includes(message.author.id)) return message.reply('**This command is disabled due to a new system being implemented.**');
- //await message.author.send('Welcome to AleeBot\'s quoting system!\nThis process will be easy.');
-
- if (!args.length) return message.reply("Error: Did not provide more context (message will be replaced eventually)");
-
- await mongo().then(async (mongoose) => {
- try {
- await new quoteSchema({
- author: args[0],
- authorImage: args[1],
- quote: args[2],
- year: args[3]
-
- }).save()
- } finally {
- await mongoose.connection.close();
- message.reply('Added this quote to the database...');
- }
- })
-
-/*
- let quoteState = {};
- let state = quoteState[message.author.id];
-
- if (message.content.toLowerCase() === "q"){
- await message.author.send("Process has been cancelled");
- state = null;
- } else {
- switch (state) {
- case 1:
- await message.author.send('Enter the author\'s name');
- authorMessage = message.content;
- console.log(authorMessage);
- state = 2;
- break;
- case 2:
- await message.author.send('author url here');
- authorImageMessage = message.content;
- console.log(authorImageMessage);
- state = 3;
- break;
- case 3:
- await message.author.send('quote here');
- quoteMessage = message.content;
- console.log(quoteMessage);
- state = 4;
- break;
- case 4:
- await message.author.send('year here');
- yearMessage = message.content;
- console.log(yearMessage);
- state = 5;
- break;
- case 5:
- await message.author.send('process complete');
- state = null;
- break;
- }
-*/
+ try {
+ let newAuthor;
+ let newAuthorImage;
+ let newQuote;
+ let newYear;
+
+ const quote = await quoteDB.create({
+ author: newAuthor,
+ authorImage: newAuthorImage,
+ quote: newQuote,
+ year: newYear
+ })
+
+ const setupEmbed = new Discord.MessageEmbed()
+ .setTitle('AleeBot Quote Setup', client.user.avatarURL())
+ .setDescription('Input the data to the following embed')
+ .addField('Author', newAuthor, true)
+ .addField('Author Image (URL)', newAuthorImage, true)
+ .addField('Quote', newQuote, true)
+ .addField('Year', newYear, true);
+
+ message.reply({embeds: [setupEmbed]});
+ } catch (error) {
+ console.log(error)
+ }
};
exports.conf = {
diff --git a/commands/ban.js b/commands/ban.js
index 1e8ee6e..b734be5 100644
--- a/commands/ban.js
+++ b/commands/ban.js
@@ -29,7 +29,7 @@ module.exports.run = async (client, message, args) => {
.setTitle('User Banned!')
.setColor('#1fd619')
.addField('**User:**', `${member.user.tag}`)
- .addField('**Reason:**', `\`\`\`${mreason}\`\`\``);
+ if (mreason) return banEmbed.addField('**Reason:**', `\`\`\`${mreason}\`\`\``);
await message.channel.send({embeds: [banEmbed]});
};
diff --git a/commands/kick.js b/commands/kick.js
index 1bf83db..c248afc 100644
--- a/commands/kick.js
+++ b/commands/kick.js
@@ -29,7 +29,7 @@ module.exports.run = async (client, message, args) => {
.setTitle('User Kicked!')
.setColor('#1fd619')
.addField('**User:**', `${member.user.tag}`)
- .addField('**Reason:**', `\`\`\`${mreason}\`\`\``);
+ if (mreason) return kickEmbed.addField('**Reason:**', `\`\`\`${mreason}\`\`\``);
await message.channel.send({embeds: [kickEmbed]});
};
diff --git a/commands/leaveguild.js b/commands/leaveguild.js
index f88f0bb..00a97fc 100644
--- a/commands/leaveguild.js
+++ b/commands/leaveguild.js
@@ -19,7 +19,7 @@
* *************************************/
module.exports.run = async (client, message) => {
if (!['242775871059001344', message.guild.ownerID].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.');
- await message.channel.send('Leaving server. If that\'s a mistake, you can re-invite me...');
+ await message.channel.send('Leaving server. If that\'s a mistake, you can re-invite me');
message.guild.leave();
};
diff --git a/commands/quote.js b/commands/quote.js
index 481cc9b..81f9142 100644
--- a/commands/quote.js
+++ b/commands/quote.js
@@ -17,72 +17,33 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
-const mongo = require('../plugins/mongo');
-const quoteSchema = require('../schema/quote-schema');
module.exports.run = async (client, message, args) => {
- if (!['242775871059001344'].includes(message.author.id)) return message.reply('**This command is disabled due to a new system being implemented.**');
+ const quoteDB = require('../models/quote');
const { MessageEmbed } = require('discord.js');
+ let quoteID = args[0];
-// let NewQuote;
-// let quo;
-
- let quoId;
- let quoAuthor;
- let quoAuthorImage;
- let quoQuote;
- let quoYear;
-
- if (args) {
- await mongo().then(async (mongoose) => {
- try {
- const quote = await quoteSchema.findOne({quoteID: args[1], author: quoAuthor, authorImage: quoAuthorImage, quote: quoQuote, year: quoYear})
- /*
- const embed = new MessageEmbed()
- .setAuthor(quoAuthor, quoAuthorImage)
- .setDescription(quoQuote)
- .setColor('#1fd619')
- .setFooter('- ' + quoYear);
-
- await message.channel.send({embeds:[embed]});*/
- console.log(quote);
- } finally {
- await mongoose.connection.close();
- }
- })
- } else {
-
+ if (quoteID === undefined) {
+ const quoteList = await quoteDB.findAll({ attributes: ['id'] })
+ quoteID = Math.floor(Math.random() * (quoteList.length - 1)) + 1
}
- /*
+ const quote = await quoteDB.findOne({ where: { id: quoteID } })
- function GetNewQuote(quoteNum = -1) {
- NewQuote = new Discord.MessageEmbed();
- let quo = require('../storage/quotes.json').quotes
+ if (quote) {
+ const embed = new MessageEmbed()
+ .setAuthor({ name: quote.author, iconURL: quote.authorImage})
+ .setDescription(quote.quote)
+ .setColor('#1fd619')
+ .setFooter('- ' + quote.year);
- if (quoteNum === -1) {
- quoteNum = Math.floor(Math.random() * 1000) % quo.length;
- quo=quo[quoteNum];
- }
-
- const author = quo.author;
- const authorImage = quo.authorImage;
- const quote = quo.quote;
- const year = quo.year;
- const url = quo.url;
-
- NewQuote.setAuthor(author, authorImage);
- NewQuote.setColor('#1fd619');
- NewQuote.setDescription(quote);
- NewQuote.setFooter('- ' + year);
- //NewQuote.setURL(url);
-
- return NewQuote;
+ await message.reply('Alright, here\'s your quote.')
+ await message.channel.send({embeds:[embed]});
+ } else {
+ message.reply('Cannot find quote');
}
- const newquote = GetNewQuote();
- message.reply('Alright, here\'s your quote.');
- await message.channel.send(newquote);*/
+
};
exports.conf = {
diff --git a/commands/setlogchannel.js b/commands/setlogchannel.js
index 902a210..c04e926 100644
--- a/commands/setlogchannel.js
+++ b/commands/setlogchannel.js
@@ -17,36 +17,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
-const mongo = require('../plugins/mongo');
-const logSchema = require('../schema/logging-schema');
+const guildDB = require ('../models/guild-settings')
module.exports.run = async (client, message) => {
//This will be replaced in the future possibly
if (!message.member.permissions.has('MANAGE_GUILD')) return message.reply('It looks like that you can\'t manage this server.');
const channel = await message.mentions.channels.first().id;
- const cache = {}
+ const [ guild ] = await guildDB.findOrCreate({ where: { id: message.guild.id } } )
- if (!channel) return message.reply('I cannot find that channel, please specify...');
-
- cache[message.guild.id] = channel
-
- await mongo().then(async (mongoose) => {
- try {
- await logSchema.findOneAndUpdate(
- {
- _id: message.guild.id,
- },
- {
- _id: message.guild.id,
- logChannel: channel
- },
- {
- upsert: true
- }
- )
- } finally {
- await mongoose.connection.close();
- }
- })
+ if (!channel) {
+ message.reply('No channel has been set, disabling the logging channel feature...');
+ await guild.update({ channelId: null } );
+ } else {
+ await guild.update({ channelId: message.guild.id } ) ;
+ }
await message.reply(`Logging channel has been set to <#${channel}>`);
};
@@ -58,6 +41,6 @@ exports.conf = {
exports.help = {
name: 'setlogchannel',
description: 'Set the log channel.',
- usage: 'setlogchannel [channel id]',
+ usage: 'setlogchannel #channel',
category: '- Moderation Commands',
};
diff --git a/commands/setup.js b/commands/setup.js
new file mode 100644
index 0000000..5c2f232
--- /dev/null
+++ b/commands/setup.js
@@ -0,0 +1,46 @@
+/****************************************
+ *
+ * Setup: Command for AleeBot
+ * Copyright (C) 2017-2021 Alee Productions
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * *************************************/
+
+module.exports.run = async (client, message) => {
+ if (!['242775871059001344', message.guild.ownerId].includes(message.author.id)) return message.reply(':warning: You must be a server owner or be the creator of the bot to access this command.');
+ message.reply('Look at your DMs.');
+ //message.reply("This feature is coming soon. Stay tuned!");
+ const Discord = require('discord.js');
+ const setupEmbed = new Discord.MessageEmbed()
+ .setTitle('AleeBot Setup', client.user.avatarURL())
+ .setDescription('Select the options')
+ .addField('Chat Logs', 'channelid', true)
+ .addField('Joining & Leaving Logs', 'placeholder', true)
+ .addField('Broadcast', 'placeholder', true)
+ .addField('Broadcast', 'placeholder', true);
+
+ message.author.send({embeds: [setupEmbed]});
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'setup',
+ description: 'Setting up AleeBot.',
+ usage: 'setup',
+ category: '- Settings Commands',
+};
diff --git a/commands/uptime.js b/commands/uptime.js
index 4753f70..7453ad5 100644
--- a/commands/uptime.js
+++ b/commands/uptime.js
@@ -23,12 +23,17 @@ module.exports.run = async (client, message) => {
let uptimeMinutes = Math.floor(uptime / 60);
const minutes = uptime % 60;
let hours = 0;
+ let days = 0;
while (uptimeMinutes >= 60) {
- hours++;
- uptimeMinutes = uptimeMinutes - 60;
+ hours++;
+ uptimeMinutes = uptimeMinutes - 60;
+ }
+ while (hours >= 24) {
+ days++;
+ hours = hours - 24;
}
const uptimeSeconds = minutes % 60;
- message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.');
+ message.channel.send(`:clock3: AleeBot has been up for ${days} days, ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`);
};
exports.conf = {