Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
V2.3.3 - DeepScan Errors Scanned | DeepScan.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Glitch (cytrusbot) committed Mar 17, 2019
1 parent a19881b commit c57204b
Show file tree
Hide file tree
Showing 28 changed files with 181 additions and 50 deletions.
1 change: 1 addition & 0 deletions .glitch-assets
@@ -1,2 +1,3 @@
{"name":"pikaOh.png","date":"2019-02-03T01:56:40.558Z","url":"https://cdn.glitch.com/1654f0f1-6c26-4af8-9359-621c155eff8d%2FpikaOh.png","type":"image/png","size":17739,"imageWidth":128,"imageHeight":128,"thumbnail":"https://cdn.glitch.com/1654f0f1-6c26-4af8-9359-621c155eff8d%2FpikaOh.png","thumbnailWidth":128,"thumbnailHeight":128,"dominantColor":null,"uuid":"YwbXthVDNOSDsUZb"}
{"name":"image.png","date":"2019-02-27T10:07:16.530Z","url":"https://cdn.glitch.com/1654f0f1-6c26-4af8-9359-621c155eff8d%2Fimage.png","type":"image/png","size":155176,"imageWidth":384,"imageHeight":331,"thumbnail":"https://cdn.glitch.com/1654f0f1-6c26-4af8-9359-621c155eff8d%2Fthumbnails%2Fimage.png","thumbnailWidth":330,"thumbnailHeight":285,"dominantColor":"rgb(4,4,4)","uuid":"6IwxHDYFJk72B4E0"}
{"name":"wiinoutenis.gif","date":"2019-03-16T12:31:03.243Z","url":"https://cdn.glitch.com/1654f0f1-6c26-4af8-9359-621c155eff8d%2Fwiinoutenis.gif","type":"image/gif","size":16475169,"imageWidth":1280,"imageHeight":720,"thumbnail":"https://cdn.glitch.com/1654f0f1-6c26-4af8-9359-621c155eff8d%2Fthumbnails%2Fwiinoutenis.gif","thumbnailWidth":330,"thumbnailHeight":186,"dominantColor":"rgb(251,252,245)","uuid":"UzNY0vz0jkZmYy5b"}
5 changes: 5 additions & 0 deletions app.js
Expand Up @@ -15,6 +15,9 @@ const client = new Discord.Client({
disabledEvents: ['TYPING_START']
});

//Define time of Startup
client.startup = new Date().getTime();

//Define Databases/Objects
client.items = new Enmap({name: 'glptmitems'});
client.money = new Enmap({name: 'glptm'});
Expand All @@ -25,8 +28,10 @@ client.spotify = new Enmap({name: 'spotify'});
client.settings = new Enmap({name: 'settings'});
client.notes = new Enmap({name: 'notes'});
client.bugs = new Enmap({name: 'bugreports'});
client.starboard = new Enmap({name: 'starboardmid'});
client.warns = new Enmap({name: 'warns'});
client.tags = new Enmap({name: 'tags'});
client.minecooldown = new Discord.Collection();
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
client.liusers = new Discord.Collection();
Expand Down
2 changes: 0 additions & 2 deletions commands/dashboard.js
@@ -1,5 +1,3 @@
const Discord = require('discord.js');

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
try {
let embed = new client.Embed('normal', {
Expand Down
5 changes: 4 additions & 1 deletion commands/destroy.js
Expand Up @@ -2,7 +2,10 @@ exports.run = async (client, message, args, level) => { // eslint-disable-line n
try {
let res = await client.awaitReply(message, 'Are you sure you want to destroy the client?');

if (res == 'yes') message.channel.send('Destroying client...');
if (res == 'yes') {
message.channel.send('Destroying client...');
client.destroy();
}
else message.channel.send('Aborted.');
} catch (err) {
message.channel.send('Their was an error!\n' + err).catch();
Expand Down
2 changes: 0 additions & 2 deletions commands/fact.js
@@ -1,5 +1,3 @@
const Discord = require('discord.js');

exports.run = async (client, message, args, level) => {
try {
require('request')({url: 'https://nekos.life/api/v2/fact', json: true}, (req, res, json) => {
Expand Down
23 changes: 16 additions & 7 deletions commands/fetchmessage.js
Expand Up @@ -3,14 +3,23 @@ const Discord = require('discord.js');
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
try {
let fetched = await message.channel.fetchMessage(args[0]);
let afiles = [];

let embed = new Discord.RichEmbed()
.setTitle(fetched.id)
.setColor('#eeeeee')
.setURL(fetched.url)
.setThumbnail(fetched.author.avatarURL)
.setDescription(fetched.content)
.setFooter('Message created by ' + fetched.author.tag);
fetched.attachments.forEach((attachment) => {
afiles.push({
name: attachment.filename,
attachment: attachment.url
});
});

let embed = new client.Embed('normal', {
title: fetched.id,
url: fetched.url,
thumbnail: fetched.author.avatarURL,
footer: 'Message created by ' + fetched.author.tag,
description: fetched.content || 'No Message',
files: afiles
});

message.channel.send(embed);
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion commands/forceban.js
Expand Up @@ -7,7 +7,7 @@ exports.run = async (client, message, args, level) => {

if (user) {
message.guild.ban(user).then(() => {
message.reply(`Successfully banned the user!`);
message.reply('Successfully banned the user!');

const modLogChannel = settings.modLogChannel;
if (modLogChannel && message.guild.channels.find(c => c.name === settings.modLogChannel)) {
Expand Down
10 changes: 5 additions & 5 deletions commands/nou.js → commands/gamergirl.js
@@ -1,8 +1,8 @@
const Discord = require('discord.js');

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
exports.run = async (client, message, args, level) => {
try {
message.channel.send(new Discord.Attachment('https://im5.ezgif.com/tmp/ezgif-5-4468d259ce0a.gif'));
message.channel.send(new Discord.Attachment('https://cdn.discordapp.com/attachments/502236124308307968/556413748416479242/images16.gif'));
} catch (err) {
message.channel.send('There was an error!\n' + err).catch();
}
Expand All @@ -16,8 +16,8 @@ exports.conf = {
};

exports.help = {
name: 'nou',
name: 'gamergirl',
category: 'Fun',
description: 'Returns a No U gif',
usage: 'nou'
description: 'Gamer girls',
usage: 'gamergirl'
};
1 change: 0 additions & 1 deletion commands/google.js
@@ -1,4 +1,3 @@
const Discord = require('discord.js');
const google = require('google');

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
Expand Down
2 changes: 1 addition & 1 deletion commands/info.js
Expand Up @@ -5,7 +5,7 @@ exports.run = async (client, message, args, level) => { // eslint-disable-line n
const embed = new Discord.RichEmbed()
.setColor('#eeeeee')
.setTitle('Cytrus Github')
.setFooter('Made by CelestialCrafter#0770 and EnderGirlGamer#5370')
.setFooter('Made by CelestialCrafter#6830 and EnderGirlGamer#5370')
.setDescription(`Github: [Production Github](https://github.com/CelestialCrafter/cytrus)
Website: [Website](https://cytrus.ga)
API: [API](https://api.cytrus.ga/api)
Expand Down
1 change: 0 additions & 1 deletion commands/kitsu.js
@@ -1,4 +1,3 @@
const Discord = require('discord.js');
const Kitsu = require('node-weeb').anime;

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
Expand Down
32 changes: 32 additions & 0 deletions commands/love.js
@@ -0,0 +1,32 @@
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
try {
let i = [];

if (!message.mentions.members.first()) message.guild.members.forEach(member => {
if (!member.user.bot) i.push(member);
});
else i.push(message.mentions.members.first());

let member = i.random();
await message.channel.send(new client.Embed('normal', {
title: 'Love',
description: message.author.username + ' is ' + Math.floor(Math.random() * 100 + 1) + '% in love with ' + member.user.username
}));
} catch (err) {
message.channel.send('Their was an error!\n' + err).catch();
}
};

exports.conf = {
enabled: true,
aliases: [],
guildOnly: false,
permLevel: 'User'
};

exports.help = {
name: 'love',
category: 'Fun',
description: 'Shows how much in love tou are with a user',
usage: 'love [user]'
};
6 changes: 3 additions & 3 deletions commands/achievement.js → commands/mcachievement.js
Expand Up @@ -4,21 +4,21 @@ exports.run = async (client, message, args, level) => { // eslint-disable-line n
try {
if (!args[0]) return message.reply('You need to input somthing to make an achievement!');

message.channel.send(new Discord.Attachment('https://www.minecraftskinstealer.com/achievement/a.php?i=20&h=Achievment+Get!&t=' + args.join('+').replace('#', '%23'), 'mc.png'))
message.channel.send(new Discord.Attachment(encodeURI('https://www.minecraftskinstealer.com/achievement/a.php?i=20&h=Achievment+Get!&t=' + args.join('+').replace('#', '%23'), 'mc.png')))
} catch (err) {
message.channel.send('There was an error!\n' + err).catch();
}
};

exports.conf = {
enabled: true,
aliases: ['mcs'],
aliases: ['mca'],
guildOnly: false,
permLevel: 'User'
};

exports.help = {
name: 'achievement',
name: 'mcachievement',
category: 'Fun',
description: 'Creates an achievement from Minecraft',
usage: 'achievement <string>'
Expand Down
7 changes: 3 additions & 4 deletions commands/mine.js
@@ -1,5 +1,4 @@
const Discord = require('discord.js');
const cooldown = new Discord.Collection();

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
try {
Expand All @@ -8,11 +7,11 @@ exports.run = async (client, message, args, level) => { // eslint-disable-line n
stone: 250
});

if (cooldown.has(message.author.id)) return message.reply('You need to wait 10 minutes to mine again!');
else cooldown.set(message.author.id, true);
if (client.minecooldown.has(message.author.id)) return message.reply('You need to wait 10 minutes to mine again!');
else client.minecooldown.set(message.author.id, true);

setTimeout(async () => {
cooldown.delete(message.author.id);
client.minecooldown.delete(message.author.id);
}, 600000);

let stone = client.money.get(message.author.id, 'stone');
Expand Down
1 change: 0 additions & 1 deletion commands/ping.js
@@ -1,4 +1,3 @@

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
try {
let msg = await message.channel.send('<@'+message.author.id+'>');
Expand Down
2 changes: 1 addition & 1 deletion commands/reverse.js
Expand Up @@ -2,7 +2,7 @@
exports.run = async (client, message, args, level) => {
try {
const str = args.join(' ');
let msg = message.reply(str.split('').reverse().join(''));
let msg = await message.reply(str.split('').reverse().join(''));
msg.react('🔁');
} catch (err) {
message.channel.send('Their was an error!\n' + err).catch();
Expand Down
1 change: 1 addition & 0 deletions commands/status.js
Expand Up @@ -21,6 +21,7 @@ Discord.js: v${version}
CPU Usage: ${Math.round(stats.cpu)}%
Node.js: ${process.version}
Dependencies: ${Object.keys(require('../package').dependencies).length}
Startup Time: ${client.startuptime}ms
Voice Connections: ${client.voiceConnections.size}`)
.setColor('#eeeeee');

Expand Down
14 changes: 14 additions & 0 deletions dash/routes/commands.js
@@ -0,0 +1,14 @@
const router = require('express').Router();
const client = require('../../app');

router.get('/', async (req, res) => {
if (!req.session.user || req.session.guild) res.redirect('/');

if (req.query.command) {
if (!client.commands.has(req.query.command)) return res.redirect('/commands');

res.render('command', {user: req.session.user, guilds: req.session.guilds, djsclient: client, command: req.query.command});
} else res.render('commands', {user: req.session.user, guilds: req.session.guilds, djsclient: client});
});

module.exports = router;
Binary file modified data/enmap.sqlite-shm
Binary file not shown.
Binary file modified data/enmap.sqlite-wal
Binary file not shown.
30 changes: 19 additions & 11 deletions events/messageReactionAdd.js
Expand Up @@ -9,21 +9,29 @@ const Star = class {
const message = reaction.message;
const settings = this.client.getSettings(message.guild.id);
if (reaction.emoji.name !== '⭐') return;
if (message.guild.channels.find(c => c.name == settings.starboardChannel) == null) return;
if (message.author.bot) return message.channel.send('<@' + user.id + '>, You cant star bot messages!');
if (user.id == message.author.id) return message.reply('You cant star your own messages');
if (!message.guild.channels.find(c => c.name == settings.starboardChannel)) return;

if (!this.client.starboard.has(message.id)) this.client.starboard.set(message.id, 1);
else this.client.starboard.inc(message.id);
this.client.starboard.ensure(message.id, 0);
this.client.starboard.inc(message.id);

let embed = new Discord.RichEmbed()
.setTitle('Star')
.setThumbnail(message.author.avatarURL)
.setDescription(`${user.tag} (${user.id}) starred ${message.author.tag} (${message.author.id})'s message!
${this.client.starboard.get(message.id)} | ${message.id}`)
.addField('Author', '<@' + message.author.id + '>')
.addField('Channel', '<#' + message.channel.id + '>')
.setColor('#eeeeee');
let embed = new this.client.Embed('normal', {
title: 'Star',
thumbnail: message.author.avatarURL,
description: `${user.tag} starred ${message.author.tag}'s message!
${this.client.starboard.get(message.id)} | ${message.id}`,
fields: [
{
title: 'Author',
text: '<@' + message.author.id + '>'
},
{
title: 'Channel',
text: '<#' + message.channel.id + '>'
}
]
});

message.guild.channels.find(c => c.name == settings.starboardChannel).send({embed: embed}).catch();
}
Expand Down
8 changes: 5 additions & 3 deletions events/ready.js
Expand Up @@ -27,12 +27,14 @@ module.exports = async client => {
client.logger.log(`Channels: ${client.channels.size.toLocaleString()}`, 'ready');
client.logger.log(`Discord.js: v${require('discord.js').version}`, 'ready');
client.logger.log(`Node.js: ${process.version}`, 'ready');
client.logger.log('Cytrus V' + require('../package').version + ' | https://github.com/CelestialCrafter/cytrus');

//Starts the web server/API
require('../modules/web')(client);
await require('../modules/web')(client);

//Post stats to the bot list
require('../modules/botlist')(client);
await require('../modules/botlist')(client);

client.logger.log('Cytrus V' + require('../package').version + ' | https://github.com/CelestialCrafter/cytrus');
client.startuptime = new Date().getTime() - client.startup;
client.logger.log('It took ' + client.startuptime + 'ms to start Cytrus');
};
2 changes: 1 addition & 1 deletion modules/botlist.js
@@ -1,6 +1,6 @@
const request = require('request');

module.exports = (client) => {
module.exports = async (client) => {
const options = {
url: 'https://discordbotlist.com/api/bots/' + client.user.id + '/stats',
json: {
Expand Down
3 changes: 2 additions & 1 deletion modules/web.js
Expand Up @@ -48,13 +48,14 @@ const initWeb = (client) => {
'discord1js': `v${require('discord.js').version}`,
'cpu_usage': `${Math.round(stats.cpu)}%`,
'node1js': `${process.version}`,
'startup_time': `${client.startuptime}ms`,
'voice_connections': `${client.voiceConnections.size}`,
'dependencies': `${Object.keys(require('../package').dependencies).length}`
}
});
});
});
app.get('/commands', (req, res) => res.render('../views/commands.ejs', {user: req.session.user, djsclient: client}));
app.get('/commands', (req, res) => require('../dash/routes/commands'));
app.get('/api', (req, res) => res.sendFile('/app/views/api/docs.html'));
app.get('/api/invite', (req, res) => res.send({status: 200, invite: 'https://discordapp.com/oauth2/authorize?client_id=526593597118873620&scope=bot&permissions=8'}));
app.get('/api/server', (req, res) => res.send({status: 200, server: 'https://discord.gg/VfTE9GH'}));
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "cytrus",
"version": "2.3.2",
"version": "2.3.3",
"description": "A multipurpose bot to handle all your needs.",
"main": "app.js",
"scripts": {
Expand All @@ -18,7 +18,7 @@
"type": "git",
"url": "https://github.com/CelestialCrafter/cytrus"
},
"author": "CelestialCrafter#0001, EnderGirlGamer#5370",
"author": "CelestialCrafter#6830, EnderGirlGamer#5370",
"license": "MIT",
"dependencies": {
"better-sqlite-pool": "^0.2.2",
Expand Down
50 changes: 50 additions & 0 deletions views/command.ejs
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<%- include('partials/header.ejs') %>
<body>
<%- include('partials/navbar.ejs') %>

<div>
<% let cmd = djsclient.commands.get(command); %>
<h2><%= cmd.help.name %></h2>
<br>
<p>
<%= cmd.help.description} %>
<br>
Usage: <%= cmd.help.usage %>
<br>
Aliases: <%= cmd.conf.aliases.join(' | ') || 'none' %>
</p>
<br><br>
<h3>
Permission Level
<br>
<%= djsclient.levelCache[cmd.conf.permLevel] %> - <%= cmd.conf.permLevel %>
</h3>
<br><br>
<h3>
Category
<br>
<%= cmd.help.category %>
</h3>
<br><br>
<h3>
Guild Only
<br>
<%= cmd.conf.guildOnly ? 'Yes' : 'No' %>
</h3>
<br><br>
<h3>
Enabled
<br>
<%= cmd.conf.enabled ? 'Yes' : 'No' %>
</h3>
<br><br>
<h3>
NSFW

<%= cmd.conf.nsfw ? 'Yes' : 'No' %>
</h3>
</div>
</body>
</html>

0 comments on commit c57204b

Please sign in to comment.