aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore2
-rw-r--r--Dockerfile15
-rw-r--r--To be worked on/addquote.js132
-rw-r--r--bot_discord.js66
-rw-r--r--commands/addquote.js61
-rw-r--r--commands/help.js5
-rw-r--r--commands/interrogate.js4
-rw-r--r--commands/quote.js12
-rw-r--r--commands/serverinfo.js6
-rw-r--r--commands/slowdown.js2
-rw-r--r--commands/suggest.js6
-rw-r--r--commands/suggestfeature.js14
-rw-r--r--commands/userinfo.js2
-rw-r--r--package.json8
-rw-r--r--storage/activities.js4
-rw-r--r--storage/settings.json2
16 files changed, 218 insertions, 123 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..5171c54
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+node_modules
+npm-debug.log \ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1256d22
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,15 @@
+FROM node:alpine
+
+WORKDIR /usr/src/bot
+
+COPY package.json ./
+
+COPY tokens.json ./
+
+COPY yarn.lock ./
+
+RUN yarn install
+
+COPY . .
+
+CMD ["node", "bot_discord.js"]
diff --git a/To be worked on/addquote.js b/To be worked on/addquote.js
new file mode 100644
index 0000000..5f2b9bc
--- /dev/null
+++ b/To be worked on/addquote.js
@@ -0,0 +1,132 @@
+/** **************************************
+ *
+ * AddQuote: 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/>.
+ *
+ * *************************************/
+const quoteDB = require('../models/quote');
+const { MessageEmbed } = require("discord.js");
+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.**');
+ try {
+ let newAuthor;
+ let newAuthorImage;
+ let newQuote;
+ let newYear;
+
+ let quoteOriginator;
+
+ let isSetupRunning = false;
+
+ const setupProcess = [
+ 'Provide the name of the author.',
+ 'Submit the image of the author\nYou need to use a picture link that ends in .jpg or .png (like those from IMGUR or Google Images), and the picture should be either 128x128 pixels or 512x512 pixels in size.',
+ 'Enter the quote',
+ 'Specify the year from which the quote originates.'
+ ]
+
+ let setupMessage = "Welcome to the AleeBot Quote Setup!\n"
+ setupMessage += "Please follow these rules when submitting quotes\n"
+ setupMessage += "```1. Do not use profanity or offensive language.\n"
+ setupMessage += "2. Do not send any personal information.\n"
+ setupMessage += "3. Only send noteworthy quotes.```\n"
+ setupMessage += "We reserve the right to reject any quotes that do not meet our criteria.\n"
+
+ let counter = 0
+
+ if (isSetupRunning) {
+ return await message.reply('You are already setting up the quote.');
+ }
+ const filter = m => m.author.id === message.author.id
+
+ isSetupRunning = true;
+ await message.reply(':arrow_left: Check your DMs to continue.')
+ await message.author.send(setupMessage);
+ await message.author.send(setupProcess[counter++]);
+
+ const collector = message.channel.createMessageCollector({
+ filter,
+ max: setupProcess.length,
+ time: 1000 * 60
+ });
+
+ collector.on('collect', message => {
+ console.log(`Collected ${message.content} from ${message.author.tag}`)
+ if (setupProcess.length > setupProcess.length + 1) {
+ message.author.send(setupProcess[counter++]);
+ }
+ });
+
+ collector.on('end', collected => {
+ if (collected.size === 0 && collected.size < 2) {
+ message.author.send('Quote setup was not completed, rerun the command.')
+ } else {
+ let quoteContent = [];
+
+ collected.forEach((message) => {
+ quoteContent.push(message.content)
+ })
+
+ newAuthor = quoteContent[0]
+ newAuthorImage = quoteContent[1]
+ newQuote = quoteContent[2]
+ newYear = quoteContent[3]
+
+ const setupEmbed = new MessageEmbed()
+ .setAuthor('AleeBot Quote Setup', client.user.avatarURL())
+ .setDescription('Are you happy with this quote?\nThis quote will be sent for manual approval')
+ .addField('Author', newAuthor)
+ .addField('Author Image (URL)', newAuthorImage)
+ .addField('Quote', newQuote)
+ .addField('Year', newYear);
+
+ message.author.send({embeds:[setupEmbed]})
+ quoteOriginator = message.author.tag
+ console.log(`This quote has been originated from ${quoteOriginator}`)
+ isSetupRunning = false;
+ }
+
+ });
+
+ /*await quoteDB.create({
+ author: newAuthor,
+ authorImage: newAuthorImage,
+ quote: newQuote,
+ year: newYear,
+ });*/
+
+ //let messageReact = await message.author.send({embeds: [setupEmbed]});
+ /*await messageReact.react('🧑');
+ await messageReact.react('📷');
+ await messageReact.react('🖋️');
+ await messageReact.react('📅');*/
+
+ } catch (error) {
+ console.log(error)
+ }
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: true,
+};
+exports.help = {
+ name: 'addquote',
+ description: 'Adds a quote to the database.',
+ usage: 'addquote',
+ category: '- Quote Commands',
+};
+
diff --git a/bot_discord.js b/bot_discord.js
index 00afe45..b32e018 100644
--- a/bot_discord.js
+++ b/bot_discord.js
@@ -23,7 +23,7 @@ const client = new Discord.Client({
parse: ['users', 'roles'],
repliedUser: true
},
- intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS']
+ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILD_MESSAGE_REACTIONS']
});
const moment = require('moment');
const express = require('express');
@@ -37,12 +37,12 @@ const api = require('./tokens.json');
const { activity } = require('./storage/activities');
const active = new Map();
let autoRole = true;
-let readyEmbedMessage = false;
+let readyEmbedMessage = true;
const ownerID = '242775871059001344';
let logChannel = '318874545593384970';
let statusChannelID = '606602551634296968';
let serverWhitelist = "243022206437687296";
-let roleWhitelist = "657426918416580614"
+let roleWhitelist = "657426918416580614";
const log = (message) => {
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`.white);
@@ -130,23 +130,14 @@ rl.on('line', function(cmd) {
}
}
break;
- case 'channels':
- if (!args[1]) {
- console.log('[!] Please insert the guild\'s ID.'.yellow);
- } else {
- let guild = client.guilds.get(args[1]);
- console.log('[i] These are the channels that this guild have:'.blue);
- for ([id, channel, guild] of guild && client.channels) {
- console.log(` Channel: #${channel.name} - ID: ${channel.id}`.blue);
- }
- }
- break;
case 'leave':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.'.yellow);
} else {
- let guild = client.guilds.get(args[1]);
- guild.leave();
+ let guild = client.guilds.cache.get(args[1]);
+ guild.leave().then(guild => {
+ console.log(`AleeBot has left ${guild.name}`)
+ });
}
break;
case 'broadcast':
@@ -155,11 +146,13 @@ rl.on('line', function(cmd) {
} else {
const broadcast = args.join(' ').slice(48);
let guild = null;
- guild = client.guilds.get(args[1]);
+ guild = client.guilds.cache.get(args[1]);
let channel = null;
- channel = guild.channels.get(args[2]);
+ channel = guild.channels.cache.get(args[2]);
if (channel != null) {
- channel.send(broadcast);
+ channel.send(`**[Broadcast]** ${broadcast}`);
+ } else {
+ console.log('[X] Broadcast cannot be blank'.red)
}
}
break;
@@ -169,12 +162,17 @@ rl.on('line', function(cmd) {
let uptimeMinutes = Math.floor(uptime / 60);
const minutes = uptime % 60;
let hours = 0;
+ let days = 0;
while (uptimeMinutes >= 60) {
hours++;
uptimeMinutes = uptimeMinutes - 60;
}
+ while (hours >= 24) {
+ days++;
+ hours = hours - 24;
+ }
const uptimeSeconds = minutes % 60;
- console.log(`[i] AleeBot has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`.blue);
+ console.log(`[i] AleeBot has been up for ${days} days, ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`);
break;
case 'activity':
console.log('[i] Generating new activity'.blue);
@@ -198,7 +196,6 @@ rl.on('line', function(cmd) {
case 'help':
let msg = ('AleeBot '+ settings.abVersion +' Console Help\n\n');
msg += ('guilds - Shows all guilds that AleeBot\'s on.\n');
- msg += ('channels - Shows all the channels that the guilds have.\n');
msg += ('leave - Leaves a guild.\n');
msg += ('broadcast - Broadcasts a message to a server.\n');
msg += ('uptime - Shows the uptime for AleeBot.\n');
@@ -239,7 +236,7 @@ client.on('ready', async () => {
.setDescription('AleeBot has started')
.addField('Version', settings.abVersion, true)
.addField('Discord.JS Version', Discord.version, true)
- .addField('Prefix', `\`${settings.prefix}\``, true)
+ .addField('Prefix', `\`${settings.prefix}\``)
.setColor('#5cd65c');
let statusChannel = client.channels.cache.get(statusChannelID);
if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
@@ -388,12 +385,25 @@ client.on('guildDelete', (guild) => {
statusChannel.send({ embeds: [logEmbed]});
});
-/*
-AutoPoster(api.dbltoken, client)
- .on('posted', () => {
- log('[>] Posted stats to Top.gg!'.blue);
- })
-*/
+client.on("messageReactionAdd", async (reaction, user) => {
+ // When a reaction is received, check if the structure is partial
+ if (reaction.partial) {
+ // If the message this reaction belongs to was removed, the fetching might result in an API error which should be handled
+ try {
+ await reaction.fetch();
+ } catch (error) {
+ console.error('Something went wrong when fetching the message:', error);
+ // Return as `reaction.message.author` may be undefined/null
+ return;
+ }
+ }
+
+ // Now the message has been cached and is fully available
+ console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
+ // The reaction is now also fully available and the properties will be reflected accurately:
+ console.log(`${reaction.count} user(s) have given the same reaction to this message!`);
+});
+
client.on('messageCreate', async(msg) => {
if (!client.application?.owner) await client.application?.fetch();
if (msg.author.bot) return;
diff --git a/commands/addquote.js b/commands/addquote.js
deleted file mode 100644
index 477d891..0000000
--- a/commands/addquote.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/** **************************************
- *
- * AddQuote: 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/>.
- *
- * *************************************/
-const quoteDB = require('../models/quote');
-const Discord = require("discord.js");
-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.**');
- 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 = {
- aliases: [],
- guildOnly: true,
-};
-exports.help = {
- name: 'addquote',
- description: 'Sets the guild prefix.',
- usage: 'addquote [author] [authorImage] [quote] [year]',
- category: '- Quote Commands',
-};
-
diff --git a/commands/help.js b/commands/help.js
index e925754..0b9191e 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -40,8 +40,9 @@ module.exports.run = async (client, message) => {
const prefix = prefixes[message.guild.id].prefixes;
if (!message.guild.members.cache.get(client.user.id).permissions.has('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links, please enable them to use the full help.');
const embed = new Discord.MessageEmbed()
- .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help | Serving in ${client.guilds.cache.size} servers`, client.user.avatarURL())
- .setDescription('[!] Currently on the Alpha-Temp branch. Meaning that experimental features are enabled in this bot...')
+ .setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help`, client.user.avatarURL())
+ .setDescription('Every command you input into AleeBot is `ab:`')
+ .setFooter(`Currently serving on ${client.guilds.cache.size} servers`)
.setColor('#1fd619')
categories.forEach(function(x) {
diff --git a/commands/interrogate.js b/commands/interrogate.js
index 16a1887..3386352 100644
--- a/commands/interrogate.js
+++ b/commands/interrogate.js
@@ -18,7 +18,7 @@
*
* *************************************/
module.exports.run = async (client, message, args) => {
- if (message.guild.id != '243022206437687296') return message.reply('This is a Binaryworks exclusive command.');
+ if (message.guild.id !== '243022206437687296') return message.reply('This is a Binaryworks exclusive command.');
if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
if (!message.guild.members.cache.get(client.user.id).permissions.has('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
@@ -38,5 +38,5 @@ exports.help = {
name: 'interrogate',
description: 'Interrogates a member',
usage: 'interrogate [user]',
- category: '- Binaryworks Exclusive Commands',
+ category: '- ALP Exclusive Commands',
};
diff --git a/commands/quote.js b/commands/quote.js
index 81f9142..37f5714 100644
--- a/commands/quote.js
+++ b/commands/quote.js
@@ -24,23 +24,23 @@ module.exports.run = async (client, message, args) => {
if (quoteID === undefined) {
const quoteList = await quoteDB.findAll({ attributes: ['id'] })
- quoteID = Math.floor(Math.random() * (quoteList.length - 1)) + 1
+ const random = crypto.getRandomValues(new Uint32Array(1));
+ quoteID = quoteList[random[0] % quoteList.length].id;
}
const quote = await quoteDB.findOne({ where: { id: quoteID } })
if (quote) {
- const embed = new MessageEmbed()
- .setAuthor({ name: quote.author, iconURL: quote.authorImage})
+ const quoteEmbed = new MessageEmbed()
+ .setAuthor({ name: quote.author, iconURL: quote.authorImage })
.setDescription(quote.quote)
.setColor('#1fd619')
.setFooter('- ' + quote.year);
- await message.reply('Alright, here\'s your quote.')
- await message.channel.send({embeds:[embed]});
+ await message.reply({ content: 'Alright, here\'s your quote.', embeds: [quoteEmbed] })
} else {
- message.reply('Cannot find quote');
+ message.reply('Cannot find quote, specify the correct quote id.');
}
diff --git a/commands/serverinfo.js b/commands/serverinfo.js
index 0a2e077..67442a2 100644
--- a/commands/serverinfo.js
+++ b/commands/serverinfo.js
@@ -20,14 +20,14 @@
module.exports.run = async (client, message) => {
const Discord = require('discord.js');
const listedChannels = [];
+ let guildOwner = await message.guild.fetchOwner();
let memberCountNoBots = await message.guild.members.fetch().then((members) => members.filter(member => !member.user.bot).size);
const embed = new Discord.MessageEmbed()
.setAuthor(`${message.guild.name}`, `${message.guild.iconURL()}`)
.setDescription('Server Information')
.setThumbnail(message.guild.iconURL())
- .addField('Server Name:', `${message.guild.name}`)
- .addField('Server ID:', `${message.guild.id}`)
- .addField('Created At:', `${message.guild.createdAt.toUTCString()}`)
+ .addField('Main Information', `**Server Name:** ${message.guild.name}\n**Server ID:** ${message.guild.id}\n**Server Owner:** ${guildOwner.user.tag}`)
+ .addField('Join Dates', `**Created At:** ${message.guild.createdAt.toUTCString()}\n**AleeBot Joined:** ${message.guild.joinedAt.toUTCString()}`)
/*message.guild.channels.cacheType.forEach(channel => {
listedChannels.push(channel)
})*/
diff --git a/commands/slowdown.js b/commands/slowdown.js
index 44d8230..55e441b 100644
--- a/commands/slowdown.js
+++ b/commands/slowdown.js
@@ -21,7 +21,7 @@ module.exports.run = async (client, message, args) => {
if (!message.member.permissions.has('MANAGE_CHANNELS')) return message.reply('It looks like that you don\'t have the permissions to slowdown channels.');
if (isNaN(args[0])) return message.reply('Please input a valid number to slowdown a channel.');
await message.channel.setRateLimitPerUser(args[0]);
- message.channel.send(`This channel has been slowdowned for ${args[0]} second(s).`);
+ message.channel.send(`This channel has been slowdown for ${args[0]} second(s).`);
};
diff --git a/commands/suggest.js b/commands/suggest.js
index 0ca21b8..b503139 100644
--- a/commands/suggest.js
+++ b/commands/suggest.js
@@ -18,7 +18,7 @@
*
* *************************************/
module.exports.run = async (client, message, args) => {
- if (message.guild.id != '243022206437687296') return message.reply('This is a Binaryworks exclusive command.');
+ if (message.guild.id !== '243022206437687296') return message.reply('This is a Andrew Lee Projects exclusive command.');
const {MessageEmbed} = require('discord.js');
client.channels.cache.get('427495678390960148').send({ embeds: [
new MessageEmbed()
@@ -39,7 +39,7 @@ exports.conf = {
};
exports.help = {
name: 'suggest',
- description: 'Suggest a feature in Binaryworks.',
+ description: 'Suggest a feature in Andrew Lee Projects.',
usage: 'suggest [suggestion]',
- category: '- Binaryworks Exclusive Commands',
+ category: '- ALP Exclusive Commands',
};
diff --git a/commands/suggestfeature.js b/commands/suggestfeature.js
index c7623d2..21b6849 100644
--- a/commands/suggestfeature.js
+++ b/commands/suggestfeature.js
@@ -1,5 +1,5 @@
/****************************************
- *
+ *
* SuggestFeature: Command for AleeBot
* Copyright (C) 2017-2021 Alee Productions
*
@@ -15,11 +15,11 @@
*
* 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, args) => {
const { MessageEmbed } = require('discord.js');
-
+
client.channels.cache.get('427495678390960148').send({ embeds: [
new MessageEmbed()
.setColor('#1fd619')
@@ -28,10 +28,10 @@ module.exports.run = async (client, message, args) => {
.addField('Suggestion Contents', args.join(' '))
.setFooter(`Sending from ${message.guild.name}`, message.guild.iconURL())]}
);
- await message.reply('Your suggestion has been shown to the Binaryworks discord server!');
-
+ await message.reply('Your suggestion has been shown to the Andrew Lee Projects discord server!');
+
};
-
+
exports.conf = {
aliases: [],
guildOnly: false,
@@ -42,4 +42,4 @@ exports.help = {
usage: 'suggestfeature [suggestion]',
category: '- General Commands',
};
-
+
diff --git a/commands/userinfo.js b/commands/userinfo.js
index a812dc4..bc7ec8e 100644
--- a/commands/userinfo.js
+++ b/commands/userinfo.js
@@ -23,7 +23,7 @@ module.exports.run = async (client, message) => {
.setAuthor(message.author.tag, message.author.avatarURL())
.setDescription('User Information')
.setThumbnail(message.author.avatarURL())
- .addField('Names', `**Username:** ${message.author.username}\n**Current Nickname:** ${message.member.displayName}`)
+ .addField('Names', `**Display Name:** ${message.member.displayName}\n**Username:** ${message.author.username}\n**Server Nickname:** ${message.member.displayName}`)
.addField('Identity', `**User ID:** ${message.author.id} `)
.addField('Create and Join Times', `**Created At:** ${message.member.user.createdAt.toUTCString()}\n**Joined Guild At:** ${message.member.joinedAt.toUTCString()}`)
.setColor('#1fd619');
diff --git a/package.json b/package.json
index 91c283c..4c23498 100644
--- a/package.json
+++ b/package.json
@@ -18,25 +18,19 @@
},
"homepage": "https://github.com/Alee14/AleeBot#readme",
"dependencies": {
- "@top-gg/sdk": "^3.1.2",
"blessed": "^0.1.81",
"colors": "^1.3.0",
"discord.js": "^13.0.1",
"eslint": "^7.1.0",
"express": "^4.17.1",
- "fs": "0.0.1-security",
"git-last-commit": "^0.3.0",
"i18next": "^19.4.4",
"moment": "^2.21.0",
- "mongoose": "^5.11.8",
- "node-opus": "^0.3.0",
"os": "^0.1.1",
"parse-ms": "^1.0.1",
"readline": "^1.3.0",
"sequelize": "^6.30.0",
- "sqlite3": "^5.1.6",
- "topgg-autoposter": "^2.0.0",
- "ytdl-core": "^0.20.4"
+ "sqlite3": "^5.1.6"
},
"devDependencies": {
"nodemon": "^2.0.2"
diff --git a/storage/activities.js b/storage/activities.js
index 418a038..2b2a286 100644
--- a/storage/activities.js
+++ b/storage/activities.js
@@ -87,12 +87,14 @@ const activities = [
'MythOS',
'Also try Scratch!',
'Funky!',
+ 'Apple Vision Pro',
'What is Web3?',
'GNU\'s NOT UNIX!',
'Linux, but actually GNU/Linux',
- 'Praise RMS!',
+ 'Praise RMS! (dont)',
'Praying to St IGNUcius',
'Debloating my ThinkPad',
+ 'Turbotastic!',
'Goddamn Idiotic Truckload of Windows',
`Now running on Discord.JS ${version}!`
];
diff --git a/storage/settings.json b/storage/settings.json
index 8f0e530..83932cc 100644
--- a/storage/settings.json
+++ b/storage/settings.json
@@ -1,4 +1,4 @@
{
- "abVersion": "2.13.0 Alpha Temp Branch",
+ "abVersion": "2.13.0 Beta",
"prefix": "abb:"
}