mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-14 21:26:54 +00:00
Chenged the command get format (removed the switch statement) and added the react command
This commit is contained in:
+1
-1
@@ -3,4 +3,4 @@ config.json
|
||||
.env
|
||||
.sqlite
|
||||
database.sqlite
|
||||
reactions.js
|
||||
temp.js
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
name: 'EC',
|
||||
name: 'extracredit',
|
||||
description: "Selmer Bot Dm's you for some *AHEM* extra credit",
|
||||
execute(message) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
let dm;
|
||||
let num = Math.floor(Math.random() * 10);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
const scraper = require('mal-scraper');
|
||||
module.exports = {
|
||||
name: 'search',
|
||||
description: 'Selmer bot gives you either an explanation or a list of stats',
|
||||
async execute() {
|
||||
scraper.getInfoFromName('Fullmetal Alchemist').then((data) => {
|
||||
//If the user didn't specify, give a stat list
|
||||
if (args.length < 1) {
|
||||
let s = `Title: ${s.title}\n`;
|
||||
s += ``
|
||||
} else if (args[0] != 'full') {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'top_anime',
|
||||
description: 'Get the top anime of all time (according to MyAnimeList)',
|
||||
execute(message, args) {
|
||||
const axios = require('axios');
|
||||
const cheerio = require('cheerio')
|
||||
//Genre list area (not set up yet)
|
||||
if (args.length != 0) {
|
||||
return;
|
||||
}
|
||||
const url = "https://myanimelist.net/topanime.php?type=bypopularity";
|
||||
axios(url)
|
||||
.then(response => {
|
||||
const html = response.data;
|
||||
const $ = cheerio.load(html);
|
||||
data = $('.top-ranking-table').text();
|
||||
breakbar = "---------------------------------------------";
|
||||
|
||||
// message.channel.send(breakbar + "\n" + lyrics + "\n" + breakbar);
|
||||
console.log(data);
|
||||
})
|
||||
.catch(console.error);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
const { top } = require('./all_time_top_anime');
|
||||
|
||||
module.exports = {
|
||||
name: 'anime',
|
||||
description: 'a-anime....',
|
||||
execute(command, message, args, bot) {
|
||||
switch(command) {
|
||||
case 'topanime': top.execute(message, args);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
name: 'arrow',
|
||||
description: 'Engage in a trademarked activity and throw an arrow at a trash can',
|
||||
async execute(message, args) {
|
||||
async execute(message, args, Discord, Client, bot) {
|
||||
let counter = 0;
|
||||
arrow = '>';
|
||||
while (true) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports ={
|
||||
name: "help",
|
||||
description: "Gets help for all of Selmer Bot's commands",
|
||||
execute(message, Client) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
const newEmbed = new Discord.MessageEmbed()
|
||||
.setColor('#002eff')
|
||||
.setTitle('My professional resume')
|
||||
|
||||
@@ -262,6 +262,4 @@ module.exports = {
|
||||
//Close the database
|
||||
client.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
name: "Hello World",
|
||||
name: "test",
|
||||
description: "HI SELMER",
|
||||
execute(message, args) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
message.channel.send("HI SELMER!!!");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
module.exports ={
|
||||
name: 'kareoke',
|
||||
description: 'Sing your least-favorite song with your favorite person, me!',
|
||||
execute(message, args) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
const axios = require('axios');
|
||||
const cheerio = require('cheerio')
|
||||
const url = args[0];
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
name: "links",
|
||||
description: "A helpful list of links to all of Selmer's wonderful websites",
|
||||
execute(message, args, Discord) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
const newEmbed = new Discord.MessageEmbed()
|
||||
.setColor('#002eff')
|
||||
.setTitle("Selmer's Links")
|
||||
|
||||
@@ -12,8 +12,8 @@ const player = createAudioPlayer();
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: "playaudio",
|
||||
async execute(message, args, bot) {
|
||||
name: "audio",
|
||||
async execute(message, args, Discord, Client, bot) {
|
||||
// message.channel.send("This command has not been set up yet\nSorry!");
|
||||
// return;
|
||||
if (args[0] == "play") {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
name: "profile",
|
||||
description: "Posts a description of Monsieur Sleemer himself",
|
||||
execute(message, args, Discord) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
const newEmbed = new Discord.MessageEmbed()
|
||||
.setColor('#002eff')
|
||||
.setTitle('My professional resume')
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
name: 'quotes',
|
||||
description: "A public version of Extra Credit",
|
||||
execute(message) {
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
let dm;
|
||||
let num = Math.floor(Math.random() * 10);
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
name: 'r',
|
||||
description: "Reacts with a phrase or single emoji",
|
||||
async execute(message, args, Discord, Client, bot) {
|
||||
|
||||
// if (!message.reference) { return; }
|
||||
let msg;
|
||||
if (message.reference) {
|
||||
msg = await message.channel.messages.fetch(message.reference.messageId);
|
||||
} else { msg = message; }
|
||||
|
||||
for (let i = 0; i < args.length; i ++) {
|
||||
try {
|
||||
await msg.react(args[i]);
|
||||
} catch(err) {
|
||||
//The emoji wasn't a valid one
|
||||
message.reply("Please enter a valid emoji");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
const hastebin = require("hastebin-gen");
|
||||
|
||||
module.exports ={
|
||||
name: "scraper",
|
||||
name: "scrape",
|
||||
description: ".....",
|
||||
async execute(message, args) {
|
||||
async execute(message, args, Discord, Client, bot) {
|
||||
const axios = require('axios');
|
||||
const cheerio = require('cheerio')
|
||||
const url = args[0];
|
||||
|
||||
@@ -48,6 +48,8 @@ bot.commNames = new Discord.Collection();
|
||||
|
||||
bot.econ = new Discord.Collection();
|
||||
|
||||
bot.anime = new Discord.Collection();
|
||||
|
||||
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
|
||||
|
||||
|
||||
@@ -61,9 +63,14 @@ for (const file of commandFiles) {
|
||||
i ++;
|
||||
}
|
||||
|
||||
//Anime/manga section
|
||||
const afiles = fs.readdirSync('./commands/anime').filter(file => file.endsWith('.js'));
|
||||
for (const file of afiles) {
|
||||
const command = require(`./commands/anime/${file}`);
|
||||
bot.anime.set(command.name, command);
|
||||
}
|
||||
|
||||
// const econFiles = fs.readdirSync('./commands/inventory').filter(file => file.endsWith('.js'));;
|
||||
bot.commands.set('ANIME', require(`./commands/anime_and_manga/anime_main`));
|
||||
bot.commands.set('MANGA', require(`./commands/anime_and_manga/manga_main`));
|
||||
// const currency = new Discord.Collection();
|
||||
// const { Users } = require('./commands/currency/dbObjects.js');
|
||||
// i++;
|
||||
@@ -118,49 +125,17 @@ bot.on('messageCreate', (message) => {
|
||||
//Anime uses if/else, all else uses switch (can't make a multi-case case)
|
||||
if (command.indexOf('anime') != -1) {
|
||||
console.log("Anime");
|
||||
bot.commands.get('ANIME').execute(command, message, args, bot);
|
||||
bot.anime.get(command).execute(message, args);
|
||||
switch(command) {
|
||||
case 'top_anime': bot.anime.get('top_anime').execute(message, args);
|
||||
}
|
||||
} else if (command.indexOf('MANGA') != -1) {
|
||||
console.log("Manga");
|
||||
//Do nothing for now
|
||||
} else {
|
||||
switch(command) {
|
||||
case 'test': bot.commands.get('Hello World').execute(message, args);
|
||||
break;
|
||||
if(bot.commands.has(command)) { bot.commands.get(command).execute(message, args, Discord, Client, bot); }
|
||||
|
||||
case 'profile': bot.commands.get('profile').execute(message, args, Discord);
|
||||
break;
|
||||
|
||||
case 'links': bot.commands.get('links').execute(message, args, Discord);
|
||||
break;
|
||||
|
||||
case 'arrow': bot.commands.get('arrow').execute(message, args, Discord);
|
||||
break;
|
||||
|
||||
case 'audio': bot.commands.get('playaudio').execute(message, args, bot, Discord);
|
||||
break;
|
||||
|
||||
case 'quotes': bot.commands.get('quotes').execute(message, args, Discord, Client);
|
||||
break;
|
||||
|
||||
case 'extracredit': bot.commands.get('EC').execute(message);
|
||||
break;
|
||||
|
||||
case 'scrape': bot.commands.get('scraper').execute(message, args);
|
||||
break;
|
||||
|
||||
case 'kareoke': bot.commands.get('kareoke').execute(message, args);
|
||||
break;
|
||||
|
||||
case 'react': bot.commands.get('reaction').execute(message, args, bot);
|
||||
break;
|
||||
|
||||
case 'stocks': bot.commands.get('stocks').execute(message, args);
|
||||
break;
|
||||
|
||||
default: bot.commands.get('ECON').execute(bot, message, args, command, Discord, mongouri, items, xp_collection);
|
||||
//Removed because Heroku doesn't work with sqlite
|
||||
//default: bot.commands.get('ECON').execute(bot, prefix, message, args, command, Users, currency);
|
||||
}
|
||||
else { bot.commands.get('ECON').execute(bot, message, args, command, Discord, mongouri, items, xp_collection); }
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
start:
|
||||
node commands/currency/dbInit.js
|
||||
run:
|
||||
node .
|
||||
node .
|
||||
|
||||
temp:
|
||||
node temp.js
|
||||
Generated
+812
-4
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@
|
||||
"ffmpeg-static": "^5.0.0",
|
||||
"hastebin-gen": "^2.0.5",
|
||||
"libsodium-wrappers": "^0.7.10",
|
||||
"mal-scraper": "^2.11.4",
|
||||
"mongoose": "^6.3.2",
|
||||
"mysql": "^2.18.1",
|
||||
"node.js": "^0.0.1-security",
|
||||
|
||||
Reference in New Issue
Block a user