first commit
This commit is contained in:
commit
452a8e4be4
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Raven Scott
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
44
kanyebot.js
Normal file
44
kanyebot.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* Kanye Discord Bot. Raven Scott 12.19.2020 */
|
||||||
|
|
||||||
|
/* How to install:
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
- (https://discord.com/developers/applications)
|
||||||
|
- Generate a bot token
|
||||||
|
- How to add a bot to a discord server (https://discordapi.com/permissions.html#2146958847)
|
||||||
|
- General Bot Structure, Ping/Pong Explanation (https://discord.js.org/)
|
||||||
|
- Teaching how to use NPM and include libraries for use (http://npmjs.com/)
|
||||||
|
- How to understand how to use example code from an NPM page (https://www.npmjs.com/package/unirest)
|
||||||
|
- Use an NPM (unirest) to request data from kanye.rest and parse its response
|
||||||
|
- Send the response back to discord. I.E the kanye quote will be displayed via chat.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var unirest = require('unirest');
|
||||||
|
const Discord = require('discord.js');
|
||||||
|
|
||||||
|
const client = new Discord.Client();
|
||||||
|
|
||||||
|
let prefix = "!";
|
||||||
|
|
||||||
|
client.on('ready', () => {
|
||||||
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('message', msg => {
|
||||||
|
|
||||||
|
|
||||||
|
if (msg.content === 'kanye') {
|
||||||
|
// Command Code Start
|
||||||
|
unirest
|
||||||
|
.get('https://api.kanye.rest')
|
||||||
|
.then((response) => {
|
||||||
|
console.log("The quote I sent was: " + "\"" + response.body.quote + "\"")
|
||||||
|
msg.reply("\"" + response.body.quote + "\"" );
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login('TOKENHERE');
|
19
package.json
Normal file
19
package.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "kanyebot",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "kanyebot.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git@gitlab.codingworldvm.club:snxraven/kanyediscordbot.git"
|
||||||
|
},
|
||||||
|
"author": "Raven Scott",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"discord.js": "^12.5.1",
|
||||||
|
"unirest": "^0.6.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user