first commit

This commit is contained in:
Raven Scott
2021-04-23 14:20:48 -05:00
commit d4ad7600e7
22 changed files with 1422 additions and 0 deletions

View File

@ -0,0 +1,20 @@
const fs = require("fs");
const dateFormat = require("dateformat");
require('dotenv').config()
exports.run = async (bot, message, args, functions) => {
message.channel.send(`= STATISTICS =\n RavenBot v0.1 Base Version
• Mem Usage :: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB
• Users :: ${bot.users.cache.size}
• Servers :: ${bot.guilds.cache.size}
• Channels :: ${bot.channels.cache.size}`, { code: "asciidoc" });
};
exports.help = {
name: "about",
aliases: ["a", "about"],
category: "System",
description: "Information about the bot",
usage: "about"
};

View File

@ -0,0 +1,49 @@
const { getEmoji, getAllEmoji, getThemes } = require('random-text-meme');
const Discord = require("discord.js");
const fs = require("fs");
const dateFormat = require("dateformat");
exports.run = async (bot, message, args, functions) => {
let argscmd = message.content.split(" ").slice(1);
let word = argscmd.slice(0).join(" "); // yes, start at 0, not 1. I hate that too.
//if (!word) return message.reply("Please give me a word to look up.");
message.delete();
const date = require('date-and-time');
const now = new Date();
const channel = bot.channels.cache.find(channel => channel.name === "bot-logs")
channel.send({
"embed": {
"color": 2899536,
"footer": {
"text": date.format(now, 'MM/DD/YYYY hh:mm:ss')
},
"fields": [
{
"name": "[RavenBot LOG]",
"value": message.author.username + ` ran \cMoji - Param: ` + word,
"inline": true
}
]
}
});
message.channel.send(getEmoji());
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ['c'],
permLevel: "User"
};
exports.help = {
name: "cmoji",
category: "Troll",
description: "Returns a Cute Emoji",
usage: "cmoji"
};

View File

@ -0,0 +1,68 @@
var unirest = require('unirest');
var giphy = require('apigiphy');
const { Client, MessageAttachment } = require('discord.js');
giphy = giphy({
api_key: process.env.GIFYAPIKEY
});
const Discord = require("discord.js");
const fs = require("fs");
const dateFormat = require("dateformat");
exports.run = async (bot, message, args, functions) => {
let argscmd = message.content.split(" ").slice(1);
let word = argscmd.slice(0).join(" ");
if (!word) return message.reply("Please give me a search word.");
message.delete();
const date = require('date-and-time');
const now = new Date();
const channel = bot.channels.cache.find(channel => channel.name === "bot-logs")
channel.send({
"embed": {
"color": 2899536,
"footer": {
"text": date.format(now, 'MM/DD/YYYY hh:mm:ss')
},
"fields": [
{
"name": "[RavenBot LOG]",
"value": message.author.username + ` ran \nGiphy Gif Search - Param: ` + word,
"inline": true
}
]
}
});
// Random gif by tag using promise
giphy.random({ tag: word })
.then(function (response) {
if (!response.data.image_original_url) return message.channel.send("Sorry, there was nothing found!");
console.log(response.data.image_original_url);
// http://s3.amazonaws.com/giphymedia/media/2jlDkaipGfgGc/200_d.gif
// message.channel.send(response.data.image_original_url);
const attachment = new MessageAttachment(response.data.image_original_url);
// Send the attachment in the message channel
message.channel.send(attachment);
}, function (error) {
console.log(error);
});
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "gif",
category: "Troll",
description: "Gif Search from giphy",
usage: "gif"
};

View File

@ -0,0 +1,65 @@
/*
The HELP command is used to display every command's name and description
to the user, so that he may see what commands are available. The help
command is also filtered by level, so if a user does not have access to
a command, it is not shown to them. If a command name is given with the
help command, its extended help is shown.
*/
exports.run = (client, message, args) => {
require('dotenv').config()
// If no specific command is called, show all filtered commands.
if (!args[0]) {
// Filter all commands by which are available for the user's level, using the <Collection>.filter() method.
const myCommands = client.commands
// Here we have to get the command names only, and we use that array to get the longest name.
// This make the help commands "aligned" in the output.
const commandNames = myCommands.keyArray();
const longest = commandNames.reduce((long, str) => Math.max(long, str.length), 0);
let currentCategory = "";
let output = `= Command List =\n\n[Use ${process.env.PREFIX}help <commandname> for details]\n\n`;
const sorted = myCommands.array().sort((p, c) => p.help.category > c.help.category ? 1 : p.help.name > c.help.name && p.help.category === c.help.category ? 1 : -1);
sorted.forEach(c => {
const cat = c.help.category;
if (currentCategory !== cat) {
output += `\u200b\n== ${cat} ==\n`;
currentCategory = cat;
}
output += `${process.env.PREFIX}${c.help.name}${" ".repeat(longest - c.help.name.length)} :: ${c.help.description}\n`;
});
message.channel.send(output, {
code: "asciidoc",
split: {
char: "\u200b"
}
});
} else {
// Show individual command's help.
let command = args[0];
if (client.commands.has(command)) {
command = client.commands.get(command);
message.channel.send(`= ${command.help.name} = \n${command.help.description}\nusage:: ${command.help.usage}\naliases:: ${command.conf.aliases.join(", ")}\n= ${command.help.name} =`, {
code: "asciidoc"
});
}
}
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["h", "halp"],
permLevel: "User"
};
exports.help = {
name: "help",
aliases: ["h", "halp"],
category: "System",
description: "Displays all the available commands for you.",
usage: "help [command]"
};

View File

@ -0,0 +1,74 @@
var unirest = require('unirest');
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
let reqNumber;
let imgURL;
const isNotDefined = require("is-not-defined");
const Discord = require("discord.js");
const fs = require("fs");
const dateFormat = require("dateformat");
exports.run = async (bot, message, args, functions) => {
let argscmd = message.content.split(" ").slice(1);
let word = argscmd.slice(0).join(" ");
if (!word) return message.reply("Please give me a search word.");
message.delete();
const date = require('date-and-time');
const now = new Date();
const channel = bot.channels.cache.find(channel => channel.name === process.env.LOGSCHANNELNAME)
channel.send({
"embed": {
"color": 2899536,
"footer": {
"text": date.format(now, 'MM/DD/YYYY hh:mm:ss')
},
"fields": [
{
"name": "[CHKSRV LOG]",
"value": message.author.username + ` ran \nUrban - Param: ` + word,
"inline": true
}
]
}
});
unirest.post("https://pixabay.com/api/?key=" + process.env.PIXABAYAPIKEY + "&q=" + word + "&image_type=photo")
.header("Accept", "application/json")
.end(function(result) {
// For debug Only
// console.log(result.status, result.headers, result.body);
console.log("Running Command for Google Images | Params: " + word);
reqNumber = getRandomInt(Object.keys(result.body.hits).length)
//console.log(result.body.hits[reqNumber])
if (isNotDefined(result.body.hits)) {
return message.reply("Sorry, I could not find anything for that keyword")
}
message.channel.send(result.body.hits[reqNumber].largeImageURL);
});
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "i",
category: "Troll",
description: "Image Search",
usage: "i [search words]"
};

View File

@ -0,0 +1,18 @@
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
const msg = await message.channel.send("Ping?");
msg.edit(`Pong! Latency is ${msg.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "ping",
category: "Plugins",
description: "It like... Pings. Then Pongs. And it's not Ping Pong.",
usage: "ping"
};

54
commands/Utilities/sc.js Normal file
View File

@ -0,0 +1,54 @@
const { getEmoji, getAllEmoji, getThemes } = require('random-text-meme');
const Discord = require("discord.js");
const fs = require("fs");
const dateFormat = require("dateformat");
require('dotenv').config()
var name = Math.floor(Math.random() * 99999999999999);
exports.run = async (bot, message, args, functions) => {
let argscmd = message.content.split(" ").slice(1);
let word = argscmd.slice(0).join(" "); // yes, start at 0, not 1. I hate that too.
//if (!word) return message.reply("Please give me a word to look up.");
//message.delete();
const scdl = require('soundcloud-downloader').default
const fs = require('fs')
const SOUNDCLOUD_URL = word
const CLIENT_ID = process.env.ID
scdl.download(SOUNDCLOUD_URL).then(stream => stream.pipe(fs.createWriteStream('/var/www/html/ytdl/scdl/'+name+'.mp3')))
message.channel.send({
"embed": {
"color": 3066993,
"footer": {
"icon_url": "https://cdn.discordapp.com/avatars/342128351638585344/e5c483abb70234a4e721fb329a8e1fcc.png?size=128",
"text": "made By: SNXRaven#8205"
},
"fields": [
{
"name": "SoundCloud MP3 Downloader",
"value": "[Download](https://sc-dl.codingvm.codes/" + name + ".mp3)",
"inline": true
}
]
}
});
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ['c'],
permLevel: "User"
};
exports.help = {
name: "scdl",
category: "Downloaders",
description: "Download a track from SoundCloud",
usage: "scdl"
};

View File

@ -0,0 +1,56 @@
const Discord = require("discord.js");
const fs = require("fs");
const dateFormat = require("dateformat");
exports.run = async (bot, message, args, functions) => {
let argscmd = message.content.split(" ").slice(1);
let word = argscmd.slice(0).join(" "); // yes, start at 0, not 1. I hate that too.
if (!word) return message.reply("Please give me a word to look up.");
message.delete();
const date = require('date-and-time');
const now = new Date();
const channel = bot.channels.cache.find(channel => channel.name === "bot-logs")
channel.send({
"embed": {
"color": 2899536,
"footer": {
"text": date.format(now, 'MM/DD/YYYY hh:mm:ss')
},
"fields": [
{
"name": "[RavenBot LOG]",
"value": message.author.username + ` ran \nUrban - Param: ` + word,
"inline": true
}
]
}
});
var urban = require('urban'),
dict = urban(word);
dict.first(function (json) {
//co.nsole.log(json.definition);
// For debug Only
// console.log(result.status, result.headers, result.body);
console.log("Running Command for Urban | Params: " + word);
if (!json) return message.reply("That word does not exist");
message.channel.send(json.word + ": " + json.definition + "\n\nExample:\n" + json.example);
});
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "urban",
category: "Troll",
description: "Search urban dictionary",
usage: "urban"
};

View File

@ -0,0 +1,89 @@
var youtubedl = require('youtube-dl-exec');
process.env["NO_PROXY"] = "*";
var getYoutubeTitle = require('get-youtube-title')
const getVideoId = require('get-video-id');
var youtubeThumbnail = require('youtube-thumbnail');
const pify = require('pify');
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
let argscmd = message.content.split(" ").slice(1);
let cmd = argscmd[0]; // yes, start at 0, not 1. I hate that too.
if (!cmd) return message.reply("Please provide me a Youtube URL!");
let vidID = getVideoId(cmd);
var thumbnail = youtubeThumbnail(cmd);
message.reply("Starting download, please wait...")
getYoutubeTitle(vidID.id, function (err, title) {
if (!title) return message.channel.send("We are sorry, but it seems the API is not working for us right now, try again soon.")
// console.log(title) // 'SLCHLD - EMOTIONS (feat. RIPELY) (prod. by GILLA)'
var name = Math.floor(Math.random() * 99999999999999);
// console.log(title) // 'SLCHLD - EMOTIONS (feat. RIPELY) (prod. by GILLA)'
const fileTitle = toSeoUrl(title) + "-" + name;
console.log(fileTitle);
//message.delete(0);
const jsonfile = require('jsonfile')
const cmd = require('cmd-promise')
cmd("cd ./node_modules/youtube-dl/bin/ && ./youtube-dl -x --audio-format mp3 -o /var/www/html/ytdl/audio/" + fileTitle + ".mp3 " + argscmd).then(out => {
// Check the length
var cmdLength = out.stdout.length;
message.channel.send({
"embed": {
"color": 3066993,
"footer": {
"icon_url": "https://cdn.discordapp.com/avatars/342128351638585344/e5c483abb70234a4e721fb329a8e1fcc.png?size=128",
"text": "made By: SNXRaven#8205"
},
"thumbnail": {
"url": thumbnail.default.url
},
"fields": [
{
"name": "Youtube MP3 Downloader",
"value": "[Download](https://yt-audio.codingvm.codes/" + fileTitle + ".mp3)",
"inline": true
}
]
}
});
}).catch(err => {
// console.log('err =', err.toString())
message.channel.send('\`\`\`js\n' + err.toString() + '\`\`\`')
})
});
};
function toSeoUrl(url) {
return url.toString() // Convert to string
.normalize('NFD') // Change diacritics
.replace(/[\u0300-\u036f]/g, '') // Remove illegal characters
.replace(/\s+/g, '-') // Change whitespace to dashes
.toLowerCase() // Change to lowercase
.replace(/&/g, '-and-') // Replace ampersand
.replace(/[^a-z0-9\-]/g, '') // Remove anything that is not a letter, number or dash
.replace(/-+/g, '-') // Remove duplicate dashes
.replace(/^-*/, '') // Remove starting dashes
.replace(/-*$/, ''); // Remove trailing dashes
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "ytdl-mp3",
category: "Downloaders",
description: "Download youtube videos as MP3",
usage: "ytdl-mp3 [...code]"
};

View File

@ -0,0 +1,89 @@
var youtubedl = require('youtube-dl-exec');
var getYoutubeTitle = require('get-youtube-title')
const getVideoId = require('get-video-id');
var youtubeThumbnail = require('youtube-thumbnail');
const pify = require('pify');
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
let argscmd = message.content.split(" ").slice(1);
let cmd = argscmd[0]; // yes, start at 0, not 1. I hate that too.
if (!cmd) return message.reply("Please provide me a Youtube URL!");
let vidID = getVideoId(cmd);
var thumbnail = youtubeThumbnail(cmd);
message.reply("Starting download, please wait...")
getYoutubeTitle(vidID.id, function (err, title) {
// console.log(title) // 'SLCHLD - EMOTIONS (feat. RIPELY) (prod. by GILLA)'
if (!title) return message.channel.send("We are sorry, but it seems the API is not working for us right now, try again soon.")
var name = Math.floor(Math.random() * 99999999999999);
// console.log(title) // 'SLCHLD - EMOTIONS (feat. RIPELY) (prod. by GILLA)'
const fileTitle = toSeoUrl(title) + "-" + name;
console.log(fileTitle);
//message.delete(0);
const jsonfile = require('jsonfile')
const cmd = require('cmd-promise')
cmd("cd ./node_modules/youtube-dl/bin/ && ./youtube-dl -f mp4 -o /var/www/html/ytdl/video/" + fileTitle + ".mp4 " + argscmd).then(out => {
// Check the length
var cmdLength = out.stdout.length;
message.channel.send({
"embed": {
"color": 3066993,
"footer": {
"icon_url": "https://cdn.discordapp.com/avatars/342128351638585344/e5c483abb70234a4e721fb329a8e1fcc.png?size=128",
"text": "made By: SNXRaven#8205"
},
"thumbnail": {
"url": thumbnail.default.url
},
"fields": [
{
"name": "Youtube Downloader",
"value": "[Download](https://yt-video.codingvm.codes/" + fileTitle + ".mp4)",
"inline": true
}
]
}
});
}).catch(err => {
// console.log('err =', err.toString())
message.channel.send('\`\`\`js\n' + err.toString() + '\`\`\`')
})
});
};
function toSeoUrl(url) {
return url.toString() // Convert to string
.normalize('NFD') // Change diacritics
.replace(/[\u0300-\u036f]/g, '') // Remove illegal characters
.replace(/\s+/g, '-') // Change whitespace to dashes
.toLowerCase() // Change to lowercase
.replace(/&/g, '-and-') // Replace ampersand
.replace(/[^a-z0-9\-]/g, '') // Remove anything that is not a letter, number or dash
.replace(/-+/g, '-') // Remove duplicate dashes
.replace(/^-*/, '') // Remove starting dashes
.replace(/-*$/, ''); // Remove trailing dashes
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "ytdl",
category: "Downloaders",
description: "Download youtube videos as MP4",
usage: "ytdl [...code]"
};