diff --git a/.gitignore b/.gitignore index 0520afc..75fee30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +node_modules config.json -.env -node_modules \ No newline at end of file +.env \ No newline at end of file diff --git a/README.md b/README.md index 9d0374c..8ea4835 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # selmerBot -Created by ION606 +Authors: ION606, MajorDrools Description: This is a bot modeled after Selmer Bringjord of RPI and all the wonderful things he says diff --git a/commands/commandhelp.js b/commands/commandhelp.js new file mode 100644 index 0000000..a67a4c5 --- /dev/null +++ b/commands/commandhelp.js @@ -0,0 +1,14 @@ +module.exports ={ + name: "help", + description: "Gets help for all of Selmer Bot's commands", + execute(message, Client) { + const newEmbed = new Discord.MessageEmbed() + .setColor('#002eff') + .setTitle('My professional resume') + //.setURL('https://discordjs.guide/popular-topics/embeds.html#embed-preview') + //.setDescription('My professional resume') + .setImage('https://github.com/ION606/selmerBot/blob/main/Sleemer_Bringsjorgend.png?raw=true') + + message.channel.send({ embeds: [newEmbed] }); + } +} \ No newline at end of file diff --git a/selmerBot/.gitignore b/selmerBot/.gitignore new file mode 100644 index 0000000..0520afc --- /dev/null +++ b/selmerBot/.gitignore @@ -0,0 +1,3 @@ +config.json +.env +node_modules \ No newline at end of file diff --git a/selmerBot/README.md b/selmerBot/README.md new file mode 100644 index 0000000..9d0374c --- /dev/null +++ b/selmerBot/README.md @@ -0,0 +1,6 @@ +# selmerBot + +Created by ION606 + +Description: +This is a bot modeled after Selmer Bringjord of RPI and all the wonderful things he says diff --git a/selmerBot/Sleemer_Bringsjorgend.png b/selmerBot/Sleemer_Bringsjorgend.png new file mode 100644 index 0000000..f9ade1a Binary files /dev/null and b/selmerBot/Sleemer_Bringsjorgend.png differ diff --git a/selmerBot/commands/EC.js b/selmerBot/commands/EC.js new file mode 100644 index 0000000..709d071 --- /dev/null +++ b/selmerBot/commands/EC.js @@ -0,0 +1,47 @@ +module.exports = { + name: 'EC', + description: "Selmer Bot Dm's you for some *AHEM* extra credit", + execute(message) { + let dm; + let num = Math.floor(Math.random() * 10); + + + switch(num) { + case 0: dm = 'Hello there, let me show you some...logic'; + break; + + case 1: dm = 'I think the sexiest part of a person is their brain'; + break; + + case 2: dm = 'Hey babe, wanna make some negative money?'; + break; + + case 3: dm = 'The AI is coming for you! Buy my book to find out how to stop them!'; + break; + + case 4: dm = 'Did you know I proved P=NP. The proof is on my password-encrypted tablet.\nPretty safe there I reckon'; + break; + + case 5: dm = 'I hate informal logic, but there\'s nothing informal about you!'; + break; + + case 6: dm = 'My book "A Modern Approach; Beginning Deductive Logic via HyperSlate®, Advanced" is now available online!'; + break; + + case 7: dm = 'HyperSlate is a flawless creation. I should know, I made it myself!'; + break; + + case 8: dm = 'Could a Robot Be a Bona Fide Hero? I think not! He\'s not me, after all!'; + break; + + case 9: dm = "Warning: Increasingly, the term ‘reasoning’ is used by some who don’t really do anything related to reasoning, as traditionally understood, to nonetheless label what they do. Fortunately, it’s easy to verify that some reasoning is that which is covered by formal logic: If the reasoning is explicit; links declarative statements or formulae together via explicit, abstract reasoning schemata or rules of inference (giving rise to at least explicit arguments, and often proofs); is surveyable and inspectable, and ultimately machine-checkable; then the reasoning in question is what formal logic is the science and engineering of. (An immediate consequence of the characteristics just listed is that AIs based on artificial neural networks don’t reason, ever.) In order to characterize /in/formal logic, one can remove from the previous sentence the requirements that the links must conform to explicit reasoning schemas or rules of inference, and machine-checkability. It follows that so-called informal logic would revolve around arguments, but not proofs. An excellent overview of informal logic, which will be completely ignored in this class, is provided in “Informal Logic” in the Stanford Encyclopedia of Philosophy. In this article, it’s made clear that, yes, informal logic concentrates on the nature and uses of argument. "; + break; + + default: 'Logic kan redde menneskehten!'; + break; + } + + let ID = message.member.id; + message.client.users.fetch(ID).then(user => user.send(dm)); + } +} \ No newline at end of file diff --git a/selmerBot/commands/arrow.js b/selmerBot/commands/arrow.js new file mode 100644 index 0000000..c18316c --- /dev/null +++ b/selmerBot/commands/arrow.js @@ -0,0 +1,24 @@ +module.exports = { + name: 'arrow', + description: 'Engage in a trademarked activity and throw an arrow at a trash can', + async execute(message, args) { + let counter = 0; + arrow = '>'; + while (true) { + arrow = '-' + arrow; + message.channel.send(arrow); + await message.channel.messages.fetch({limit: 1}).then(messages => { + message.channel.bulkDelete(messages); + }); + counter ++; + if (counter >= 5) { + message.channel.messages.fetch({limit: 1}).then(messages => { + message.channel.bulkDelete(messages); + }); + arrow = arrow + '🗑️'; + message.channel.send(arrow); + break; + } + } + } +} \ No newline at end of file diff --git a/selmerBot/commands/hello_world.js b/selmerBot/commands/hello_world.js new file mode 100644 index 0000000..8fefabc --- /dev/null +++ b/selmerBot/commands/hello_world.js @@ -0,0 +1,7 @@ +module.exports = { + name: "Hello World", + description: "HI SELMER", + execute(message, args) { + message.channel.send("HI SELMER!!!"); + } +} \ No newline at end of file diff --git a/selmerBot/commands/kareoke.js b/selmerBot/commands/kareoke.js new file mode 100644 index 0000000..6d09327 --- /dev/null +++ b/selmerBot/commands/kareoke.js @@ -0,0 +1,26 @@ +module.exports ={ + name: 'kareoke', + description: 'Sing your least-favorite song with you favorite person, me!', + execute(message, args) { + const axios = require('axios'); + const cheerio = require('cheerio') + const url = args[0]; + if (args[0] == undefined) { + message.channel.send("Please pick out a song at https://www.karaoke-lyrics.net/\nThe command should look like\n/kareoke [link_here]"); + } else { + axios(url) + .then(response => { + const html = response.data; + const $ = cheerio.load(html); + lyrics = $('.para_row').text(); + breakbar = "---------------------------------------------"; + + message.channel.send(breakbar + "\n" + lyrics + "\n" + breakbar); + //console.log(lyrics); + }) + .catch(console.error); + } + } +} + +//TEST: https://www.karaoketexty.cz/texty-pisni/zoegirl/plain-170199 \ No newline at end of file diff --git a/selmerBot/commands/links.js b/selmerBot/commands/links.js new file mode 100644 index 0000000..a872621 --- /dev/null +++ b/selmerBot/commands/links.js @@ -0,0 +1,15 @@ +module.exports = { + name: "links", + description: "A helpful list of links to all of Selmer's wonderful websites", + execute(message, args, Discord) { + const newEmbed = new Discord.MessageEmbed() + .setColor('#002eff') + .setTitle("Selmer's Links") + .addFields( + {name: 'HyperGrader', value: "https://rpi.logicamodernapproach.com/"}, + {name: 'Personal Website', value: "http://www.logicamodernapproach.com/rpi/intlogs22.bringsjord/#sec-3"} + ); + + message.channel.send({ embeds: [newEmbed] }); + } +} \ No newline at end of file diff --git a/selmerBot/commands/playAudio.js b/selmerBot/commands/playAudio.js new file mode 100644 index 0000000..eeb64a6 --- /dev/null +++ b/selmerBot/commands/playAudio.js @@ -0,0 +1,20 @@ +const pathToFfmpeg = require('ffmpeg-static'); +const { joinVoiceChannel } = require('@discordjs/voice'); +const { generateDependencyReport } = require('@discordjs/voice'); +const { VoiceConnectionStatus, AudioPlayerStatus } = require('@discordjs/voice'); + +module.exports = { + name: "playaudio", + execute(message, args, client) { + const channel = "930148609406685227"; + //console.log(generateDependencyReport()); + connection.on(VoiceConnectionStatus.Ready, (oldState, newState) => { + console.log('Connection is in the Ready state!'); + }); + const connection = joinVoiceChannel({ + channelId: channel, + guildId: channel.guild, + adapterCreator: channel.guild.voiceAdapterCreator, + }); + } +} \ No newline at end of file diff --git a/selmerBot/commands/postProfile.js b/selmerBot/commands/postProfile.js new file mode 100644 index 0000000..947fc43 --- /dev/null +++ b/selmerBot/commands/postProfile.js @@ -0,0 +1,19 @@ +module.exports = { + name: "profile", + description: "Posts a description of Monsieur Sleemer himself", + execute(message, args, Discord) { + const newEmbed = new Discord.MessageEmbed() + .setColor('#002eff') + .setTitle('My professional resume') + //.setURL('https://discordjs.guide/popular-topics/embeds.html#embed-preview') + //.setDescription('My professional resume') + .setImage('https://github.com/ION606/selmerBot/blob/main/Sleemer_Bringsjorgend.png?raw=true') + .addFields( + {name: 'My Epithets:', value: "Pearls of Wisdom"}, + {name: '\t1. ', value: "Negative money is the best money"}, + {name: '\t2. ', value: "There is no god, only logic"} + ); + + message.channel.send({ embeds: [newEmbed] }); + } +} \ No newline at end of file diff --git a/selmerBot/commands/quotes.js b/selmerBot/commands/quotes.js new file mode 100644 index 0000000..8a775b2 --- /dev/null +++ b/selmerBot/commands/quotes.js @@ -0,0 +1,46 @@ +module.exports = { + name: 'quotes', + description: "A public version of Extra Credit", + execute(message) { + let dm; + let num = Math.floor(Math.random() * 10); + + + switch(num) { + case 0: dm = 'Hello there, let me show you some...logic'; + break; + + case 1: dm = 'I think the sexiest part of a person is their brain'; + break; + + case 2: dm = 'Hey babe, wanna make some negative money?'; + break; + + case 3: dm = 'The AI is coming for you! Buy my book to find out how to stop them!'; + break; + + case 4: dm = 'Did you know I proved P=NP. The proof is on my password-encrypted tablet.\nPretty safe there I reckon'; + break; + + case 5: dm = 'I hate informal logic, but there\'s nothing informal about you!'; + break; + + case 6: dm = 'My book "A Modern Approach; Beginning Deductive Logic via HyperSlate®, Advanced" is now available online!'; + break; + + case 7: dm = 'HyperSlate is a flawless creation. I should know, I made it myself!'; + break; + + case 8: dm = 'Could a Robot Be a Bona Fide Hero? I think not! He\'s not me, after all!'; + break; + + case 9: dm = "Warning: Increasingly, the term ‘reasoning’ is used by some who don’t really do anything related to reasoning, as traditionally understood, to nonetheless label what they do. Fortunately, it’s easy to verify that some reasoning is that which is covered by formal logic: If the reasoning is explicit; links declarative statements or formulae together via explicit, abstract reasoning schemata or rules of inference (giving rise to at least explicit arguments, and often proofs); is surveyable and inspectable, and ultimately machine-checkable; then the reasoning in question is what formal logic is the science and engineering of. (An immediate consequence of the characteristics just listed is that AIs based on artificial neural networks don’t reason, ever.) In order to characterize /in/formal logic, one can remove from the previous sentence the requirements that the links must conform to explicit reasoning schemas or rules of inference, and machine-checkability. It follows that so-called informal logic would revolve around arguments, but not proofs. An excellent overview of informal logic, which will be completely ignored in this class, is provided in “Informal Logic” in the Stanford Encyclopedia of Philosophy. In this article, it’s made clear that, yes, informal logic concentrates on the nature and uses of argument. "; + break; + + default: 'Logic kan redde menneskehten!'; + break; + } + + message.channel.send(dm); + } +} \ No newline at end of file diff --git a/selmerBot/commands/scraper.js b/selmerBot/commands/scraper.js new file mode 100644 index 0000000..d552fb9 --- /dev/null +++ b/selmerBot/commands/scraper.js @@ -0,0 +1,21 @@ +module.exports ={ + name: "scraper", + description: ".....", + execute(message, args) { + const axios = require('axios'); + const cheerio = require('cheerio') + const url = args[0]; + axios(url) + .then(response => { + const html = response.data; + const $ = cheerio.load(html); + lyrics = $('.para_row').text(); + + //message.channel.send(lyrics); + console.log(lyrics); + }) + .catch(console.error); + } +} + +//TEST: https://www.karaoketexty.cz/texty-pisni/zoegirl/plain-170199 \ No newline at end of file diff --git a/selmerBot/main.js b/selmerBot/main.js new file mode 100644 index 0000000..8cf85ed --- /dev/null +++ b/selmerBot/main.js @@ -0,0 +1,100 @@ +const { Client, Intents } = require('discord.js'); +const Discord = require('discord.js'); +const { token } = require('./config.json'); + +const client = new Client({ + intents: [ + Intents.FLAGS.GUILDS, + Intents.FLAGS.GUILD_MESSAGES, + Intents.FLAGS.GUILD_MESSAGE_REACTIONS + ], +}); + +const prefix = '/'; + + +const fs = require('fs'); +const { exit } = require('process'); +client.commands = new Discord.Collection(); + +client.commNames = new Discord.Collection(); + +const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); + +let i = 0; +for (const file of commandFiles) { + const command = require(`./commands/${file}`); + + client.commands.set(command.name, command); + client.commNames.set(i, [command.name, command.description]); + i ++; +} + + +client.commNames.set('length', i); + + +client.on('ready', () => { + console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!'); +}); + + +client.on('messageCreate', (message) => { + + /*//PREVIEW COMMANDS START + const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN}); + + lib.discord.commands['@0.0.0'].create({ + "name": "test", + "description": "it's a test command!", + "options": [] + }); + + //PREVIEW COMMANDS END*/ + + //COMMAND AREA + //Check if the prefix exists + if (!message.content.startsWith(prefix) || message.author.bot) return; + + const args = message.content.slice(prefix.length).split(' '); + const command = args.shift().toLowerCase(); + + + //Check if the user has sufficient permission + //Performes the command + switch(command) { + case 'test': client.commands.get('Hello World').execute(message, args); + break; + + case 'profile': client.commands.get('profile').execute(message, args, Discord); + break; + + case 'links': client.commands.get('links').execute(message, args, Discord); + break; + + case 'arrow': client.commands.get('arrow').execute(message, args, Discord); + break; + + //case 'playaudio': client.commands.get('playaudio').execute(message, args, client, Discord); + //break; + + case 'quotes': client.commands.get('quotes').execute(message, args, Discord, Client); + break; + + case 'extracredit': client.commands.get('EC').execute(message); + break; + + case 'scrape': client.commands.get('scraper').execute(message, args); + break; + + case 'kareoke': client.commands.get('kareoke').execute(message, args); + break; + + default: message.channel.send("'" + message.content + "' is not a command!"); + } +}) + + + +//Last Line +client.login(token); \ No newline at end of file diff --git a/selmerBot/notes.txt b/selmerBot/notes.txt new file mode 100644 index 0000000..fc5f5af --- /dev/null +++ b/selmerBot/notes.txt @@ -0,0 +1 @@ +VS stuff: https://dbotmaker.io/forums/threads/make-bot-join-vc.95/ diff --git a/package-lock.json b/selmerBot/package-lock.json similarity index 100% rename from package-lock.json rename to selmerBot/package-lock.json diff --git a/package.json b/selmerBot/package.json similarity index 100% rename from package.json rename to selmerBot/package.json