Compare commits
13 Commits
master
...
music-cmds
Author | SHA1 | Date |
---|---|---|
rhearmas | 738d11854c | |
rhearmas | a7f2e66a5a | |
rhearmas | 15bde0a757 | |
rhearmas | c313706656 | |
rhearmas | f336ef46f9 | |
rhearmas | 18456643ec | |
rhearmas | cde00aead2 | |
rhearmas | 3cc54aa6e1 | |
rhearmas | a07f715a8c | |
rhearmas | 704def74a5 | |
rhearmas | f08b46c8ab | |
unknown | aeb16aad84 | |
carol | 96566b89f7 |
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2017
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"no-console": "off",
|
||||
"indent": [
|
||||
"error",
|
||||
2,
|
||||
{
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"warn",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"warn",
|
||||
"always"
|
||||
],
|
||||
"keyword-spacing": [
|
||||
"error", {
|
||||
"before": true,
|
||||
"after": true
|
||||
}
|
||||
],
|
||||
"space-before-blocks": [
|
||||
"error", {
|
||||
"functions":"always",
|
||||
"keywords": "always",
|
||||
"classes": "always"
|
||||
}
|
||||
],
|
||||
"space-before-function-paren": [
|
||||
"error", {
|
||||
"anonymous": "never",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}
|
||||
],
|
||||
"prefer-const": [
|
||||
"error", {
|
||||
"destructuring": "any",
|
||||
"ignoreReadBeforeAssign": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -59,3 +59,4 @@ typings/
|
|||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
|
|
54
README.md
54
README.md
|
@ -1,23 +1,57 @@
|
|||
# Welcome
|
||||
<h1 align="center">Cardboard Box</h1>
|
||||
|
||||
## Information
|
||||
|
||||
**Cardboard Box** is a [Discord](https://discordapp.com) bot for my [**Discord server**](https://discord.gg/4zJ8xqV) powered by [Discord.js](https://discord.js.org). It comes packaged with many utilities and fun stuff, and even some special moderation functions.
|
||||
|
||||
**This bot is not suitable for usage outside of my Discord server!** This repository is primarily for issue tracking and global management between my own devices. If you really, _really_ want to run it yourself, read the sections below.
|
||||
**This bot is not suitable for usage outside of my Discord server!** This repository is primarily for issue tracking and global management between my own devices. If you really, *really* want to run it yourself, read the sections below.
|
||||
|
||||
### Adding the bot to your guild
|
||||
## Adding the bot to your guild
|
||||
|
||||
Don't want to run the bot yourself? Simply use [this link](https://discordapp.com/oauth2/authorize/?permissions=8&scope=bot&client_id=618576806177538079) to invite it to your own guild.
|
||||
Don't want to run the bot yourself? Simply use [this link](https://discordapp.com/oauth2/authorize/?permissions=8&scope=bot&client_id=618576806177538079) to invite it to your own guild. If you prefer to run it under your own bot name, read the section below.
|
||||
|
||||
## Credits
|
||||
<h1 align="center">Running it yourself</h1>
|
||||
|
||||
* [SharpBot, a selfbot for Discord](https://github.com/RayzrDev/SharpBot) was actually my source for most of these cool commands! Huge kudos to [RayzrDev](https://github.com/RayzrDev) for making a cool selfbot.
|
||||
* This was initially an edit to [GuideBot, the boilerplate example bot in Discord.js](https://github.com/AnIdiotsGuide/guidebot). It has some minor edits to the base code, but most of the basic stuff came from this very example bot.
|
||||
If you're really wanting to use this bot yourself, let's go over what you need and how to install it.
|
||||
|
||||
## Join me
|
||||
## Requirements
|
||||
|
||||
- `git` command line. Install by clicking your operating system's name in this list:
|
||||
- [Windows](https://git-scm.com/download/win)
|
||||
- [Linux](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
- [Macintosh](https://git-scm.com/download/mac)
|
||||
- `node` version [8.0.0 or higher](https://nodejs.org).
|
||||
- Your **Discord bot token.** Read the first section of [this page](https://anidiots.guide/getting-started/the-long-version.html) on how to snag it.
|
||||
- `Python`. Install it from [here](https://www.python.org/downloads).
|
||||
|
||||
## Installation
|
||||
|
||||
1. Head on over to your terminal (preferrably **Command Prompt**) and clone the repository.
|
||||
- If you want to clone to a specific folder, you have two options:
|
||||
- **`cd` into your desired folder.** For example, if you wanted to clone the repository into Documents, open the terminal normally and run `cd C:/Users/<user>/Documents`.
|
||||
- Open the terminal in a specific folder by doing **Shift-Rightclick => Open <Powershell/command terminal> here**.
|
||||
- After doing either of those steps, clone the repository by running `git clone https://github.com/rhearmas/cardboardbot.git` through your terminal.
|
||||
2. When `git` has finished, `cd` into the newly-created folder for the repository.
|
||||
3. Run `npm install`. This installs all the prerequisites for the bot through **Node package manager**, which is bundled with `node`.
|
||||
- If you get any errors about python or msibuild.exe or binding, read the requirements section again and make sure you've installed **everything**.
|
||||
4. Run `node setup.js` to get a configuration file added.
|
||||
|
||||
## Running the bot
|
||||
|
||||
Open your terminal and run `node index.js` inside the folder. Don't forget to `cd` into it if the folder isn't in places like your Desktop.
|
||||
|
||||
## Getting it to your server
|
||||
|
||||
Generate an OAuth link for your bot. Use [this delicious link](https://finitereality.github.io/permissions-calculator/?v=0) to get your link. It even has a calculator for permissions!
|
||||
|
||||
<h1 align="center">Credits</h1>
|
||||
|
||||
- [SharpBot, a selfbot for Discord](https://github.com/RayzrDev/SharpBot) was actually my source for most of these cool commands! Huge kudos to [RayzrDev](https://github.com/RayzrDev) for making a cool selfbot.
|
||||
|
||||
- This was initially an edit to [GuideBot, the boilerplate example bot in Discord.js](https://github.com/AnIdiotsGuide/guidebot). It has some minor edits to the base code, but most of the basic stuff came from this very example bot.
|
||||
|
||||
<h1 align="center">Join me</h1>
|
||||
|
||||
If you need a fun server to join, regardless of whether or not you're new to Discord, join now! If you've never used Discord before, don't fret! It only takes a few minutes to sign up and get started.
|
||||
|
||||
## [https://discord.gg/4zJ8xqV](https://discord.gg/4zJ8xqV)
|
||||
|
||||
# https://discord.gg/4zJ8xqV
|
||||
|
|
|
@ -6,12 +6,12 @@ exports.run = async (client, message, args, level) => {
|
|||
let responsePlace = message.channel;
|
||||
await message.delete();
|
||||
|
||||
const messages = await message.channel.fetchMessages({ limit: Math.min(count, 100), before: message.id });
|
||||
const messages = await message.channel.messages.fetch({ limit: Math.min(count, 100), before: message.id });
|
||||
const deleted = messages.size;
|
||||
|
||||
message.channel.bulkDelete(messages.size);
|
||||
|
||||
(await responsePlace.send(`:white_check_mark: **Cleared \`${messages.size}\` message${deleted === 1 ? '' : 's'}.**`)).delete(2000);
|
||||
(await responsePlace.send(`:white_check_mark: **Cleared \`${messages.size}\` message${deleted === 1 ? '' : 's'}.**`)).delete({timeout: 2000});
|
||||
};
|
||||
|
||||
exports.conf = {
|
||||
|
|
|
@ -0,0 +1,342 @@
|
|||
const ytdl = require("ytdl-core-discord");
|
||||
|
||||
async function play(connection, message) {
|
||||
var server = client.servers[message.guild.id];
|
||||
|
||||
server.dispatcher = connection.play(await ytdl(server.queue[0]), {filter: "audioonly"}, {type: opus});
|
||||
|
||||
server.queue.shift();
|
||||
|
||||
server.dispatcher.on("end", function() {
|
||||
if(server.queue[0]) play(connection, message);
|
||||
else connection.disconnect();
|
||||
});
|
||||
}
|
||||
|
||||
exports.run = async (client, message, args, level) => {
|
||||
if(!args[0]) return message.reply("please provide a valid URL.");
|
||||
if(!message.member.voice.channel) return message.reply("you must be in a voice channel to use this command.");
|
||||
|
||||
if(!client.servers[message.guild.id]) client.servers[message.guild.id] = {
|
||||
queue: []
|
||||
};
|
||||
|
||||
var server = client.servers[message.guild.id];
|
||||
|
||||
server.queue.push(args[0]);
|
||||
|
||||
if(!message.guild.voiceConnection) message.member.voice.channel.join().then(function(connection) {
|
||||
play(connection, message);
|
||||
});
|
||||
|
||||
/*
|
||||
const queue = client.queue;
|
||||
const serverQueue = client.queue.get(message.guild.id);
|
||||
|
||||
const voiceChannel = message.member.voiceChannel;
|
||||
if(!voiceChannel) return message.reply("you need to be in a voice channel to use this command!");
|
||||
|
||||
const permissions = voiceChannel.permissionsFor(client.user);
|
||||
if(!permissions.has("CONNECT") || !permissions.has("SPEAK")) return message.reply("I don't have the valid permissions to connect and speak in the channel you're in!");
|
||||
|
||||
const songInfo = await ytdl.getInfo(args[0]);
|
||||
const song = {
|
||||
title: songInfo.title,
|
||||
url: songInfo.video_url
|
||||
};
|
||||
|
||||
if(!serverQueue) {
|
||||
const queueConstruct = {
|
||||
textChannel: message.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
songs: [],
|
||||
volume: 5,
|
||||
playing: true
|
||||
};
|
||||
|
||||
queue.set(message.guild.id, queueConstruct);
|
||||
queueConstruct.songs.push(song);
|
||||
|
||||
try {
|
||||
var connection = await voiceChannel.join();
|
||||
queueConstruct.connection = connection;
|
||||
this.play(message, queueConstruct.songs[0]);
|
||||
} catch(err) {
|
||||
client.logger.error(err);
|
||||
queue.delete(message.guild.id);
|
||||
return message.channel.send(`Uh oh! Looks like I hit a snag. Here's the error that Node picked up: \`${err}\``);
|
||||
}
|
||||
} else {
|
||||
serverQueue.songs.push(song);
|
||||
return message.channel.send(`**${song.title}** has been added to the queue!`);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
const query = args[0];
|
||||
|
||||
var voiceChannel = message.author.voiceChannel;
|
||||
if (!voiceChannel) return message.reply("you need to be in a voice channel to use this command!");
|
||||
|
||||
if(query.match(/^(?!.*\?.*\bv=)https:\/\/www\.youtube\.com\/.*\?.*\blist=.*%/)) {
|
||||
try {
|
||||
const playlist = await youtube.getPlaylist(query);
|
||||
const videosObj = await playlist.getVideos();
|
||||
|
||||
for (let i = 0; i < videosObj.length; i++) {
|
||||
const video = await videosObj[i].fetch();
|
||||
|
||||
const url = `https://www.youtube.com/watch?v=${video.raw.id}`;
|
||||
const title = video.raw.snippet.title;
|
||||
let duration = this.formatDuration(video.duration);
|
||||
const thumbnail = video.thumbnails.high.url;
|
||||
if (duration == "00:00") duration = "Live Stream";
|
||||
|
||||
const song = {
|
||||
url,
|
||||
title,
|
||||
duration,
|
||||
thumbnail,
|
||||
voiceChannel
|
||||
};
|
||||
|
||||
message.guild.musicData.push(song);
|
||||
}
|
||||
if(message.guild.musicData.isPlaying == false) {
|
||||
message.guild.musicData.isPlaying == true;
|
||||
return this.playSong(message.guild.musicData.queue, message);
|
||||
} else if (message.guild.musicData.isPlaying == true) {
|
||||
return message.channel.send(`Playlist - :musical_note: ${playlist.title} :musical_note: has been added to the queue.`);
|
||||
}
|
||||
} catch (err) {
|
||||
client.logger.error(err);
|
||||
return message.reply("that playlist is either private or doesn't exist!");
|
||||
}
|
||||
}
|
||||
if(query.match(/^(http(s)?:\/\/)?((w){3}.)?youtu(be|.be)?(\.com)?\/.+/)) {
|
||||
const url = query;
|
||||
try {
|
||||
query = query.replace(/(>|<)/gi, "").split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
|
||||
|
||||
const id = query[2].split(/[^0-9a-z_\-]/i)[0];
|
||||
const video = await youtube.getVideoByID(id);
|
||||
const title = video.title;
|
||||
let duration = this.formatDuration(video.duration);
|
||||
const thumbnail = video.thumbnails.high.url;
|
||||
if(duration == "00:00") duration = "Live Stream";
|
||||
const song = {
|
||||
url,
|
||||
title,
|
||||
duration,
|
||||
thumbnail,
|
||||
voiceChannel
|
||||
};
|
||||
message.guild.musicData.queue.push(song);
|
||||
if(message.guild.musicData.isPlaying == false || typeof message.guild.musicData.isPlaying == "undefined") {
|
||||
message.guild.musicData.isPlaying = true;
|
||||
return this.playSong(message.guild.musicData.queue, message);
|
||||
} else if(message.guild.musicData.isPlaying == true) {
|
||||
return message.channel.send(`${song.title} has been added to the queue.`);
|
||||
}
|
||||
} catch (err) {
|
||||
client.logger.error(err);
|
||||
return message.channel.send("Uh oh! Looks like I hit a snag. Ask a bot administrator to check the console.");
|
||||
}
|
||||
}
|
||||
try {
|
||||
const videos = await youtube.searchVideos(query, 5);
|
||||
if(videos.length < 5) {
|
||||
return message.reply("it seems I had some trouble finding what you requested. Please try again or be more specific.");
|
||||
}
|
||||
const vidNameArr = [];
|
||||
for(let i = 0; i < videos.length; i++) {
|
||||
vidNameArr.push(`${i + 1}: ${videos[i].title}`);
|
||||
}
|
||||
vidNameArr.push("exit");
|
||||
|
||||
const embed = new client.embed("Top 5 songs found", "Please select a song from the list below.", [
|
||||
{
|
||||
name: "**__Song 1__**",
|
||||
value: vidNameArr[0]
|
||||
}
|
||||
{
|
||||
name: "**__Song 2__**",
|
||||
value: vidNameArr[1]
|
||||
}
|
||||
{
|
||||
name: "**__Song 3__**",
|
||||
value: vidNameArr[2]
|
||||
}
|
||||
{
|
||||
name: "**__Song 4__**",
|
||||
value: vidNameArr[3]
|
||||
}
|
||||
{
|
||||
name: "**__Song 5__**",
|
||||
value: vidNameArr[4]
|
||||
}
|
||||
],
|
||||
{
|
||||
author: message.author.tag,
|
||||
authorIcon: message.author.avatarURL
|
||||
});
|
||||
var songEmbed = await message.channel.send({ embed });
|
||||
|
||||
try {
|
||||
var response = await message.channel.awaitMessages(
|
||||
msg => (msg.content > 0 && msg.content < 6) || msg.content === "exit",
|
||||
{
|
||||
max: 1,
|
||||
maxProcessed: 1,
|
||||
time: 20000,
|
||||
errors: ["time"]
|
||||
}
|
||||
);
|
||||
|
||||
var videoIndex = parseInt(response.first().content)
|
||||
} catch (err) {
|
||||
client.logger.error(err);
|
||||
songEmbed.delete();
|
||||
return message.reply("Please try again, and enter a valid number from 1 to 5.\n*(Hint: you can exit this menu by responding with \`exit\`)*");
|
||||
}
|
||||
const url = `https://www.youtube.com/watch?v=${video.raw.id}`;
|
||||
const title = video.title;
|
||||
let duration = this.formatDuration(video.duration);
|
||||
const thumbnail = video.thumbnails.high.url;
|
||||
if(duration == "00:00") duration = "Live Stream";
|
||||
const song = {
|
||||
url,
|
||||
title,
|
||||
duration,
|
||||
thumbnail,
|
||||
voiceChannel
|
||||
};
|
||||
|
||||
message.guild.musicData.queue.push(song);
|
||||
|
||||
if(message.guild.musicData.isPlaying == false) {
|
||||
message.guild.musicData.isPlaying = true;
|
||||
songEmbed.delete();
|
||||
this.playSong(message.guild.musicData.queue, message);
|
||||
} else if(message.guild.musicData.isPlaying == true) {
|
||||
songEmbed.delete();
|
||||
return message.channel.send(`${song.title} has been added to queue.`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (songEmbed) {
|
||||
songEmbed.delete();
|
||||
}
|
||||
return message.channel.send("Something went wrong playing one of the songs, is its source private?");
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
exports.conf = {
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["yt"],
|
||||
permLevel: "Moderator"
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: "play",
|
||||
category: "Music",
|
||||
description: "Play a song/playlist, or queue it if something's already playing.",
|
||||
usage: "play [url]"
|
||||
};
|
||||
|
||||
/*
|
||||
function play(message, song) {
|
||||
const queue = client.queue;
|
||||
const guild = message.guild;
|
||||
const serverQueue = queue.get(message.guild.id);
|
||||
|
||||
if (!song) {
|
||||
serverQueue.voiceChannel.leave();
|
||||
queue.delete(guild.id);
|
||||
return;
|
||||
}
|
||||
|
||||
const dispatcher = serverQueue.connection
|
||||
.playStream(ytdl(song.url, { fliter: "audioonly" }))
|
||||
.on("end", () => {
|
||||
console.log("Music ended!");
|
||||
serverQueue.songs.shift();
|
||||
this.play(message, serverQueue.songs[0]);
|
||||
})
|
||||
.on("error", error => {
|
||||
console.error(error);
|
||||
});
|
||||
dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
function playSong(queue, message) {
|
||||
let voiceChannel;
|
||||
queue[0].voiceChannel
|
||||
.join()
|
||||
.then(connection => {
|
||||
const dispatcher = connection
|
||||
.play(
|
||||
ytdl(queue[0].url, {
|
||||
quality: "highestaudio",
|
||||
highWaterMark: 1024 * 1024 * 10
|
||||
})
|
||||
)
|
||||
.on("start", () => {
|
||||
message.guild.musicData.songDispatcher = dispatcher;
|
||||
voiceChannel = queue[0].voiceChannel;
|
||||
|
||||
const videoEmbed = client.embed("", "", [
|
||||
{
|
||||
name: "**__Now Playing__**",
|
||||
value: queue[0].title
|
||||
},
|
||||
{
|
||||
name: "**__Duration__**",
|
||||
value: queue[0].duration
|
||||
}
|
||||
],
|
||||
{
|
||||
thumbnail: queue[0].thumbnail
|
||||
});
|
||||
if (queue[1]) videoEmbed.addField("Next Up:", queue[1].title);
|
||||
message.channel.send(videoEmbed);
|
||||
return queue.shift();
|
||||
})
|
||||
.on("finish", () => {
|
||||
if (queue.length >= 1) {
|
||||
return this.playSong(queue, message);
|
||||
} else {
|
||||
message.guild.musicData.isPlaying = false;
|
||||
return voiceChannel.leave();
|
||||
}
|
||||
})
|
||||
.on("error", e => {
|
||||
message.channel.send("I couldn't play that song!");
|
||||
console.error(e);
|
||||
return voiceChannel.leave();
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e);
|
||||
return voiceChannel.leave();
|
||||
});
|
||||
}
|
||||
|
||||
function formatDuration(durationObj) {
|
||||
const duration = `${durationObj.hours ? durationObj.hours + ":" : ""}${
|
||||
durationObj.minutes ? durationObj.minutes : "00"
|
||||
}:${
|
||||
durationObj.seconds < 10
|
||||
? "0" + durationObj.seconds
|
||||
: durationObj.seconds
|
||||
? durationObj.seconds
|
||||
: "00"
|
||||
}`;
|
||||
return duration;
|
||||
}
|
||||
*/
|
|
@ -0,0 +1,20 @@
|
|||
exports.run = async (client, message, args, level) => {
|
||||
var server = client.servers[message.guild.id];
|
||||
|
||||
if(server.dispatcher) server.dispatcher.end();
|
||||
message.channel.send(`${message.author.mention} has skipped the current song.`);
|
||||
};
|
||||
|
||||
exports.conf = {
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: [],
|
||||
permLevel: "Moderator"
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: "skip",
|
||||
category: "Music",
|
||||
description: "Skip an unwanted track.",
|
||||
usage: "skip"
|
||||
};
|
|
@ -0,0 +1,45 @@
|
|||
exports.run = async (client, message, args, level) => {
|
||||
/*
|
||||
var server = client.servers[message.guild.id];
|
||||
if(message.guild.voiceConnection) {
|
||||
for(var i = server.queue.length -1; i >= 0; i--) {
|
||||
server.queue.splice(i, 1);
|
||||
}
|
||||
|
||||
if(server.dispatcher) server.dispatcher.end();
|
||||
message.channel.send(`${message.author} has stopped the music.`);
|
||||
}
|
||||
|
||||
if(message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
|
||||
*/
|
||||
|
||||
/*
|
||||
const serverQueue = client.queue.get(message.guild.id);
|
||||
if (!message.member.voiceChannel) return message.channel.send('You have to be in a voice channel to stop the music!');
|
||||
|
||||
serverQueue.songs = [];
|
||||
if(serverQueue.connection.dispatcher) serverQueue.connection.dispatcher.end();
|
||||
message.channel.send(`${message.author} has stopped the music.`);
|
||||
|
||||
if(message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
|
||||
*/
|
||||
|
||||
var server = client.servers[message.guild.id];
|
||||
|
||||
if(message.guild.voice.connection) message.guild.voice.connection.disconnect();
|
||||
message.channel.send(`${message.author} has stopped the music.`);
|
||||
};
|
||||
|
||||
exports.conf = {
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: [],
|
||||
permLevel: "Moderator"
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: "stop",
|
||||
category: "Music",
|
||||
description: "Stops playing music, clears the queue, and disconnects from the voice channel.",
|
||||
usage: "stop"
|
||||
};
|
|
@ -15,7 +15,7 @@ exports.run = async (client, message, [action, key, ...value], level) => {
|
|||
|
||||
client.settings.set(message.guild.id, joinedValue, key);
|
||||
|
||||
message.reply(`Key \`${key}\` has successfully been changed to \`${joinedValue}\`.`);
|
||||
message.reply(`${key} successfully edited to ${joinedValue}`);
|
||||
} else
|
||||
|
||||
if (action === "del" || action === "reset") {
|
||||
|
|
|
@ -3,20 +3,20 @@ const got = require("got");
|
|||
exports.run = async (client, message, args, level) => {
|
||||
const pgAmount = args[0] || 2;
|
||||
const out = await got(`https://loripsum.net/api/${pgAmount}/decorate/code`);
|
||||
|
||||
|
||||
let final = out.body;
|
||||
final = final.then(
|
||||
.replace("<b>", "**")).then(
|
||||
.replace("</b>", "**")).then(
|
||||
.replace("<p>", "")).then(
|
||||
.replace(" </p>", "")).then(
|
||||
.replace("<i>", "_")).then(
|
||||
.replace("</i>", "_")).then(
|
||||
.replace("<mark>", "||").then(
|
||||
.replace("</mark>", "||").then(
|
||||
.replace("<pre>","```").then(
|
||||
final = final
|
||||
.replace("<b>", "**")
|
||||
.replace("</b>", "**")
|
||||
.replace("<p>", "")
|
||||
.replace(" </p>", "")
|
||||
.replace("<i>", "_")
|
||||
.replace("</i>", "_")
|
||||
.replace("<mark>", "||")
|
||||
.replace("</mark>", "||")
|
||||
.replace("<pre>","```")
|
||||
.replace("</pre>","```");
|
||||
|
||||
|
||||
message.channel.send(final);
|
||||
};
|
||||
|
||||
|
@ -32,4 +32,4 @@ exports.help = {
|
|||
category: "",
|
||||
description: "Sends randomly-generated Lorem Ipsum demo text.",
|
||||
usage: "test [paragraphCount:2]"
|
||||
};
|
||||
};
|
||||
|
|
|
@ -52,6 +52,6 @@ module.exports = async (client, message) => {
|
|||
message.flags.push(args.shift().slice(1));
|
||||
}
|
||||
|
||||
client.logger.cmd(`${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran ${cmd.help.name}`);
|
||||
client.logger.cmd(`[CMD] ${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran command ${cmd.help.name}`);
|
||||
cmd.run(client, message, args, level);
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = async client => {
|
||||
client.logger.log(`${client.user.tag}, ready to serve ${client.users.filter(user => !user.bot).size} users in ${client.guilds.size} ${client.guilds.size > 1 ? "servers" : "server"}.`, "ready");
|
||||
client.logger.log(`Looks like I'm ready! My tag is ${client.user.tag}, and I'm ready to serve ${client.users.cache.some(user => !user.bot).size} users in ${client.guilds.cache.size} ${client.guilds.cache.size > 1 ? "servers" : "server"}.`, "ready");
|
||||
|
||||
client.user.setActivity(`${client.users.filter(user => !user.bot).size} humans | ${client.settings.get("default").prefix}help`, {type: "WATCHING"});
|
||||
client.user.setActivity(`${client.users.cache.filter(user => !user.bot).size} humans | ${client.settings.get("default").prefix}help`, {type: "WATCHING"});
|
||||
client.user.setStatus("online");
|
||||
};
|
||||
|
|
23
index.js
23
index.js
|
@ -1,6 +1,7 @@
|
|||
if (Number(process.version.slice(1).split(".")[0]) < 8) throw new Error("Node 8.0.0 or higher is required. Update Node on your system.");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const { Structures } = require("discord.js");
|
||||
|
||||
const { promisify } = require("util");
|
||||
const readdir = promisify(require("fs").readdir);
|
||||
|
@ -16,9 +17,25 @@ client.commands = new Enmap();
|
|||
client.aliases = new Enmap();
|
||||
client.settings = new Enmap({name: "settings"});
|
||||
|
||||
/*
|
||||
Structures.extend("Guild", Guild => {
|
||||
class MusicGuild extends Guild {
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
this.musicData = {
|
||||
queue: [],
|
||||
isPlaying: false,
|
||||
songDispatcher: null
|
||||
};
|
||||
}
|
||||
}
|
||||
return MusicGuild;
|
||||
});
|
||||
*/
|
||||
|
||||
async function crawl(directory, filesArray) {
|
||||
const dirs = await readdir(directory, {
|
||||
withFileTypes: true
|
||||
withFileTypes: true
|
||||
});
|
||||
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
|
@ -51,13 +68,13 @@ const init = async () => {
|
|||
const event = require(`./events/${file}`);
|
||||
client.on(eventName, event.bind(null, client));
|
||||
});
|
||||
|
||||
|
||||
client.levelCache = {};
|
||||
for (let i = 0; i < client.config.permLevels.length; i++) {
|
||||
const thisLevel = client.config.permLevels[i];
|
||||
client.levelCache[thisLevel.name] = thisLevel.level;
|
||||
}
|
||||
|
||||
|
||||
client.login(client.config.token);
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = (client) => {
|
|||
}
|
||||
return permlvl;
|
||||
};
|
||||
|
||||
|
||||
const defaultSettings = {
|
||||
"prefix": "b&",
|
||||
"modLogChannel": "mod-log",
|
||||
|
@ -29,14 +29,14 @@ module.exports = (client) => {
|
|||
"welcomeMessage": "Say hello to {{user}}, everyone! We all need a warm welcome sometimes :D",
|
||||
"welcomeEnabled": "false"
|
||||
};
|
||||
|
||||
|
||||
client.getSettings = (guild) => {
|
||||
client.settings.ensure("default", defaultSettings);
|
||||
if(!guild) return client.settings.get("default");
|
||||
const guildConf = client.settings.get(guild.id) || {};
|
||||
return ({...client.settings.get("default"), ...guildConf});
|
||||
};
|
||||
|
||||
|
||||
client.awaitReply = async (msg, question, limit = 60000) => {
|
||||
const filter = m => m.author.id === msg.author.id;
|
||||
await msg.channel.send(question);
|
||||
|
@ -47,22 +47,22 @@ module.exports = (client) => {
|
|||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
client.caseNumber = async (client, modlog) => {
|
||||
const messages = await modlog.fetchMessages({limit:5});
|
||||
|
||||
|
||||
const log = messages.filter(m => m.author.id === client.user.id &&
|
||||
m.embeds[0] &&
|
||||
m.embeds[0].type === 'rich' &&
|
||||
m.embeds[0].footer &&
|
||||
m.embeds[0].footer.text.startsWith('Case')
|
||||
).first();
|
||||
|
||||
|
||||
if (!log) return 1;
|
||||
const thisCase = /Case\s(\d+)/.exec(log.embeds[0].footer.text);
|
||||
return thisCase ? parseInt(thisCase[1]) + 1 : 1;
|
||||
};
|
||||
|
||||
|
||||
client.clean = async (client, text) => {
|
||||
if (text && text.constructor.name == "Promise")
|
||||
text = await text;
|
||||
|
@ -94,41 +94,41 @@ module.exports = (client) => {
|
|||
}
|
||||
};
|
||||
|
||||
client.unloadCommand = async (commandName) => {
|
||||
let command;
|
||||
if (client.commands.has(commandName)) {
|
||||
command = client.commands.get(commandName);
|
||||
} else if (client.aliases.has(commandName)) {
|
||||
command = client.commands.get(client.aliases.get(commandName));
|
||||
}
|
||||
if (!command) return `The command \`${commandName}\` doesn\'t seem to exist, nor is it an alias. Try again!`;
|
||||
client.unloadCommand = async (commandName) => {
|
||||
let command;
|
||||
if (client.commands.has(commandName)) {
|
||||
command = client.commands.get(commandName);
|
||||
} else if (client.aliases.has(commandName)) {
|
||||
command = client.commands.get(client.aliases.get(commandName));
|
||||
}
|
||||
if (!command) return `The command \`${commandName}\` doesn\'t seem to exist, nor is it an alias. Try again!`;
|
||||
|
||||
if (command.shutdown) {
|
||||
await command.shutdown(client);
|
||||
}
|
||||
const mod = require.cache[require.resolve(`../commands/${command.help.category}/${command.help.name}`)];
|
||||
delete require.cache[require.resolve(`../commands/${command.help.category}/${command.help.name}.js`)];
|
||||
for (let i = 0; i < mod.parent.children.length; i++) {
|
||||
if (mod.parent.children[i] === mod) {
|
||||
mod.parent.children.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (command.shutdown) {
|
||||
await command.shutdown(client);
|
||||
}
|
||||
const mod = require.cache[require.resolve(`../commands/${command.help.category}/${command.help.name}`)];
|
||||
delete require.cache[require.resolve(`../commands/${command.help.category}/${command.help.name}.js`)];
|
||||
for (let i = 0; i < mod.parent.children.length; i++) {
|
||||
if (mod.parent.children[i] === mod) {
|
||||
mod.parent.children.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Object.defineProperty(String.prototype, "toProperCase", {
|
||||
value: function() {
|
||||
return this.replace(/([^\W_]+[^\s-]*) */g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Object.defineProperty(Array.prototype, "random", {
|
||||
value: function() {
|
||||
return this[Math.floor(Math.random() * this.length)];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
client.wait = require("util").promisify(setTimeout);
|
||||
|
||||
client.randomSelection = choices => choices[Math.floor(Math.random() * choices.length)];
|
||||
|
@ -346,9 +346,11 @@ module.exports = (client) => {
|
|||
client.quoteRegex = input => `${input}`.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&');
|
||||
|
||||
client.fetchURL = (url, options = {}) => {
|
||||
options.headers = options.headers ? { ...options.headers, "User-Agent": client.user } : { "User-Agent": client.user };
|
||||
return fetch(url, options, options.type || "json").catch(error => {
|
||||
client.Logger.error(error);
|
||||
});
|
||||
}
|
||||
};
|
||||
options.headers = options.headers ? { ...options.headers, "User-Agent": client.user } : { "User-Agent": client.user };
|
||||
return fetch(url, options, options.type || "json").catch(error => {
|
||||
client.Logger.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
client.servers = {};
|
||||
}
|
||||
|
|
|
@ -9,6 +9,24 @@
|
|||
"resolved": "https://registry.npmjs.org/@cush/relative/-/relative-0.1.0.tgz",
|
||||
"integrity": "sha512-pnF2c2hhHyC520CmYYKq3hGOS0kipkGBgRnp3z7wx7lDzykaUwQW3wPQmiX9YtbHUcgUu1qQtzstixmeYMwQoA=="
|
||||
},
|
||||
"@discordjs/collection": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.4.tgz",
|
||||
"integrity": "sha512-AwCjNahVqASGv5mxnZCC0DfcV/hkAV/U7edUB0K+20xx7v0ZfQ3/o02bNROzpNjvfak5pM8KO5SCmJVK90e3lQ=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "13.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.4.tgz",
|
||||
"integrity": "sha512-oVeL12C6gQS/GAExndigSaLxTrKpQPxewx9bOcwfvJiJge4rr7wNaph4J+ns5hrmIV2as5qxqN8YKthn9qh0jw=="
|
||||
},
|
||||
"abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"requires": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"ansi-escapes": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
|
||||
|
@ -27,10 +45,10 @@
|
|||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"async-limiter": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
|
||||
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"better-sqlite3": {
|
||||
"version": "5.4.0",
|
||||
|
@ -90,9 +108,9 @@
|
|||
}
|
||||
},
|
||||
"chownr": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz",
|
||||
"integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g=="
|
||||
},
|
||||
"cli-cursor": {
|
||||
"version": "2.1.0",
|
||||
|
@ -125,6 +143,14 @@
|
|||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
||||
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"common-tags": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz",
|
||||
|
@ -143,13 +169,6 @@
|
|||
"prettyjson": "0.7.x",
|
||||
"simplecrawler": "0.0.x",
|
||||
"underscore": "1.4.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"mime": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz",
|
||||
"integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA="
|
||||
}
|
||||
}
|
||||
},
|
||||
"create-error-class": {
|
||||
|
@ -181,21 +200,28 @@
|
|||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
|
||||
"integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q=="
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"discord-emoji": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/discord-emoji/-/discord-emoji-1.1.1.tgz",
|
||||
"integrity": "sha1-GoJyxqohshyOdRddp1g1rvCT9xY="
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "11.5.1",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.5.1.tgz",
|
||||
"integrity": "sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw==",
|
||||
"version": "github:discordjs/discord.js#f85230812ff6de4f1ba1c021c93fe308fb0685e6",
|
||||
"from": "github:discordjs/discord.js",
|
||||
"requires": {
|
||||
"long": "^4.0.0",
|
||||
"prism-media": "^0.0.3",
|
||||
"snekfetch": "^3.6.4",
|
||||
"tweetnacl": "^1.0.0",
|
||||
"ws": "^6.0.0"
|
||||
"@discordjs/collection": "^0.1.1",
|
||||
"abort-controller": "^3.0.0",
|
||||
"form-data": "^2.3.3",
|
||||
"node-fetch": "^2.3.0",
|
||||
"prism-media": "^1.0.0",
|
||||
"setimmediate": "^1.0.5",
|
||||
"tweetnacl": "^1.0.1",
|
||||
"ws": "^7.2.0"
|
||||
}
|
||||
},
|
||||
"dom-serializer": {
|
||||
|
@ -252,6 +278,11 @@
|
|||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||
},
|
||||
"external-editor": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz",
|
||||
|
@ -275,12 +306,22 @@
|
|||
"resolved": "https://registry.npmjs.org/first/-/first-0.0.3.tgz",
|
||||
"integrity": "sha1-EpqTHr+B01BdhffAXHti0MTOag4="
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz",
|
||||
"integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==",
|
||||
"form-data": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||
"requires": {
|
||||
"minipass": "^2.6.0"
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz",
|
||||
"integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==",
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"get-stream": {
|
||||
|
@ -316,6 +357,11 @@
|
|||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
|
||||
},
|
||||
"html-entities": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz",
|
||||
"integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8="
|
||||
},
|
||||
"htmlparser2": {
|
||||
"version": "3.10.1",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
|
||||
|
@ -393,9 +439,9 @@
|
|||
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.19",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
||||
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
|
||||
"version": "4.17.14",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz",
|
||||
"integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw=="
|
||||
},
|
||||
"lodash.assignin": {
|
||||
"version": "4.2.0",
|
||||
|
@ -457,54 +503,81 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz",
|
||||
"integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0="
|
||||
},
|
||||
"long": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
|
||||
},
|
||||
"lowercase-keys": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
|
||||
"integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA=="
|
||||
},
|
||||
"m3u8stream": {
|
||||
"version": "0.6.5",
|
||||
"resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.6.5.tgz",
|
||||
"integrity": "sha512-QZCzhcfUliZfsOboi68QkNcMejPKTEhxE+s1TApvHubDeR8ythm4ViWuYFqgUwZeoHe8q0nsPxOvA3lQvdSzyg==",
|
||||
"requires": {
|
||||
"miniget": "^1.6.1",
|
||||
"sax": "^1.2.4"
|
||||
}
|
||||
},
|
||||
"math-expression-evaluator": {
|
||||
"version": "1.2.17",
|
||||
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
|
||||
"integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz",
|
||||
"integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.43.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
|
||||
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.26",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
|
||||
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
|
||||
"requires": {
|
||||
"mime-db": "1.43.0"
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
|
||||
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
|
||||
},
|
||||
"miniget": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/miniget/-/miniget-1.6.1.tgz",
|
||||
"integrity": "sha512-I5oBwZmcaOuJrjQn7lpS29HM+aAZDbzKbX5ouxVyhFYdg6fA6YKOTwOCgzZQwlHuMek3FlCxz6eNrd4pOXbwOA=="
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
|
||||
"integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==",
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
|
||||
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz",
|
||||
"integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
|
||||
"integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
|
||||
"requires": {
|
||||
"minipass": "^2.9.0"
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
||||
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
|
@ -556,6 +629,11 @@
|
|||
"wordwrap": "~0.0.2"
|
||||
}
|
||||
},
|
||||
"opusscript": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.7.tgz",
|
||||
"integrity": "sha512-DcBadTdYTUuH9zQtepsLjQn4Ll6rs3dmeFvN+SD0ThPnxRBRm/WC1zXWPg+wgAJimB784gdZvUMA57gDP7FdVg=="
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
|
@ -582,9 +660,9 @@
|
|||
}
|
||||
},
|
||||
"prism-media": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz",
|
||||
"integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ=="
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.0.tgz",
|
||||
"integrity": "sha512-zjcO/BLVlfxWqFpEUlDyL1R9XXMquasNP4xpeYDPPZi/Zcz0i6OXoqcvxOLgbRVPsJXVd29vlYmRx2bts+hzEw=="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "3.4.0",
|
||||
|
@ -646,6 +724,16 @@
|
|||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
|
@ -656,11 +744,6 @@
|
|||
"resolved": "https://registry.npmjs.org/simplecrawler/-/simplecrawler-0.0.10.tgz",
|
||||
"integrity": "sha1-1EzZFb3cyO4fCSDXpbxHuClwvuk="
|
||||
},
|
||||
"snekfetch": {
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
|
||||
"integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
||||
|
@ -719,13 +802,13 @@
|
|||
}
|
||||
},
|
||||
"tar": {
|
||||
"version": "4.4.13",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz",
|
||||
"integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==",
|
||||
"version": "4.4.10",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz",
|
||||
"integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==",
|
||||
"requires": {
|
||||
"chownr": "^1.1.1",
|
||||
"fs-minipass": "^1.2.5",
|
||||
"minipass": "^2.8.6",
|
||||
"minipass": "^2.3.5",
|
||||
"minizlib": "^1.2.1",
|
||||
"mkdirp": "^0.5.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
|
@ -756,9 +839,9 @@
|
|||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",
|
||||
"integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.4.4",
|
||||
|
@ -798,17 +881,35 @@
|
|||
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
|
||||
},
|
||||
"ws": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz",
|
||||
"integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A=="
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
|
||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A=="
|
||||
},
|
||||
"ytdl-core": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-1.0.8.tgz",
|
||||
"integrity": "sha512-GX6DHLonG6RIFVCDUxJF0754EkXTjsh0fqp5vGTmp6Ang7nGCaooEWDYrfXm5U32dTJ83TVp1c92QKehQGPlxQ==",
|
||||
"requires": {
|
||||
"html-entities": "^1.1.3",
|
||||
"m3u8stream": "^0.6.3",
|
||||
"miniget": "^1.6.0",
|
||||
"sax": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"ytdl-core-discord": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ytdl-core-discord/-/ytdl-core-discord-1.1.0.tgz",
|
||||
"integrity": "sha512-uiaZWa9UG+he1F9p7Si9H6Tieyxd9dEhLi4958mHuebudQSEEPaaJHUEbFikcpB++5ogzynVOcvdeC+LFJGgEw==",
|
||||
"requires": {
|
||||
"@types/node": "^13.5.3",
|
||||
"prism-media": "^1.0.1",
|
||||
"ytdl-core": "^1.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
20
package.json
20
package.json
|
@ -3,18 +3,22 @@
|
|||
"version": "1.0.0",
|
||||
"description": "Discord bot that manages everything at my discord server.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"postinstall": "node setup.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitdab.com/rhearmas/cardboardbox.git"
|
||||
"url": "git+https://github.com/rhearmas/cardboardbot.git"
|
||||
},
|
||||
"author": "rhearmas <rhearmas@gmail.com> (http://rhearmas.carrd.co)",
|
||||
"bugs": {
|
||||
"url": "https://gitdab.com/rhearmas/cardboardbox/issues"
|
||||
"url": "https://github.com/rhearmas/cardboardbot/issues"
|
||||
},
|
||||
"homepage": "https://gitdab.com/rhearmas/cardboardbox#readme",
|
||||
"homepage": "https://github.com/rhearmas/cardboardbot#readme",
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^5.4.0",
|
||||
"chalk": "^2.4.2",
|
||||
|
@ -22,15 +26,21 @@
|
|||
"crawl": "^0.3.1",
|
||||
"dateformat": "^3.0.3",
|
||||
"discord-emoji": "^1.1.1",
|
||||
"discord.js": "^11.5.1",
|
||||
"discord.js": "github:discordjs/discord.js",
|
||||
"enmap": "^5.0.0",
|
||||
"inquirer": "^6.3.1",
|
||||
"math-expression-evaluator": "^1.2.17",
|
||||
"moment": "^2.24.0",
|
||||
"moment-duration-format": "^2.3.2",
|
||||
"node-fetch": "^2.6.0",
|
||||
"opusscript": "0.0.7",
|
||||
"recrawl": "^2.0.0",
|
||||
"roll": "^1.2.0",
|
||||
"webdict": "^0.3.0"
|
||||
"webdict": "^0.3.0",
|
||||
"ytdl-core": "^1.0.8",
|
||||
"ytdl-core-discord": "^1.1.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://npm.pkg.github.com/"
|
||||
}
|
||||
}
|
||||
|
|
5
setup.js
5
setup.js
|
@ -42,7 +42,7 @@ let prompts = [
|
|||
];
|
||||
|
||||
(async function () {
|
||||
console.log("Setting Up Cardboard Box Configuration...");
|
||||
console.log("Setting Up Cardboard Bot Configuration...");
|
||||
await settings.defer;
|
||||
if (!settings.has("default")) {
|
||||
prompts = prompts.slice(1);
|
||||
|
@ -62,6 +62,7 @@ let prompts = [
|
|||
.replace("{{token}}", `"${answers.token}"`);
|
||||
|
||||
fs.writeFileSync("./config.js", baseConfig);
|
||||
console.log("Configuration has been written, have fun!");
|
||||
console.log("REMEMBER TO NEVER SHARE YOUR TOKEN WITH ANYONE!");
|
||||
console.log("Configuration has been written, enjoy!");
|
||||
await settings.close();
|
||||
}());
|
Loading…
Reference in New Issue