Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Details:
- ###############################
- # #
- # Name: NukeBot #
- # Version: 1.0.3 #
- # Author: Oliver Chapman #
- # #
- ###############################
- */
- // Checks to see if the modules are installed
- const Discord = require('discord.js');
- var timestamp = require('console-timestamp');
- // Other const stuff
- const client = new Discord.Client();
- const token = '**************************************'; // Sets the client token for the bot
- const prefix = '.';
- // Other Variables
- var now = new Date();
- var number = 478921;
- var _quote = [
- 'The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart.',
- 'If I won the award for laziness, I would send somebody to pick it up for me.',
- 'The greatest thing you will ever learn is just to love, and be loved in return.',
- 'Do not cry because it is over, smile because it happened.'
- ];
- var _joke = [
- "Why do Java developers wear glasses? Because they don't C#!",
- "What do you call a bad Italian neighbourhood? A Spaghetto!",
- "What time did the man go to the dentist? Tooth hurt-y!",
- "5/4 of people admit that they are bad with fractions.",
- 'The protester sat down in his chair and said, "I will not stand for this!',
- "What do you call a cow that deals with money? An accowtant",
- "What do you call a snake that is 3.14 meters long? A pi-thon!",
- ];
- // When the bot is ready, display a msg on Command Prompt
- client.on('ready', () => {
- console.log('Ready!');
- console.log('\n#--------- Log ---------#');
- client.user.setGame('Type .help or .h for help!')
- });
- client.on('guildMemberAdd', member => {
- member.send('Welcome to the server!');
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | ' + `${member.user.username} has joined!`);
- });
- // Command setup
- client.on('message', message => {
- // If a msg is .ping.
- if (message.content == '.ping') {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- message.channel.send('```Pong!```'); // Sends the message 'Pong!' to the current channel.
- }
- // If a msg is .pong.
- if (message.content.startsWith(prefix + 'pong')) {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- message.channel.send('```Ping!```'); // Sends the message 'Ping!' to the current channel.
- }
- // If a msg is .nuke.
- if (message.content.startsWith(prefix + 'nuke')) { // If a msg is !nuke.
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- if (message.member.hasPermission("MANAGE_CHANNELS", true)) {
- message.channel.permissionsFor(message.member).serialize()
- message.channel.delete('50000'); // Deletes upto 50,000 messages from the current channel.
- }
- else {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- message.reply('```You do not have permission to do that!```');
- }
- }
- // If a msg is .help.
- if (message.content == '.help') {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- message.channel.send('```.ping / .pong - Plays a game of Ping Pong.\n.nuke - Deletes 5000 messages from the current text channel.\n.help/.h - Displays the commands and what they do.\n.cat - Shows an image of a smiling cat\n.quote - Posts a random quote.\n.joke - Posts a random joke.```');
- }
- if (message.content == '.h') {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- message.channel.send('```.ping / .pong - Plays a game of Ping Pong.\n.nuke - Deletes 5000 messages from the current text channel.\n.help/.h - Displays the commands and what they do.\n.cat - Shows an image of a smiling cat\n.quote - Posts a random quote.\n.joke - Posts a random joke.```');
- }
- // If a msg is .cat.
- if (message.content.startsWith(prefix + 'cat')) {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- message.channel.send({
- "embed": { // Prepares and embedded msg
- title: 'Happy Cat!', // Sets the image title
- url: 'https://www.google.com/', // URL for search engine
- "image": { // Properties for the image.
- "url": "https://cms.hostelbookers.com/hbblog/wp-content/uploads/sites/3/2012/02/cat-happy-cat-e1329931204797.jpg", // URL for the image
- }
- }
- });
- }
- if (message.content.startsWith(prefix + 'quote')) {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- var rquote = Math.floor(Math.random() * _quote.length);
- message.reply(`${_quote[rquote]}`)
- }
- if (message.content.startsWith(prefix + 'joke')) {
- console.log(('DD-MM-YY hh:mm'.timestamp) + ' | Received #' + message.id + ': ' + message.content);
- var rjoke = Math.floor(Math.random() * _joke.length);
- message.reply(`${_joke[rjoke]}`);
- }
- });
- client.login(token); // Login to a Discord Client with the bot token.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement