Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- const snoowrap = require('snoowrap');
- const r = new snoowrap({
- userAgent: 'Kevin Hernandez',
- clientId: 'XykN0DL0gPE9YA',
- clientSecret: 'meKKvP7f8D8GHzO9N8Y2gvxL5fk',
- username: 'jarmahent',
- password: 'callofduty1997'
- });
- function getPicture(){
- r.getSubreddit("pics").getRandomSubmission().then(function(post){
- return post.url;
- }).catch(function () {
- console.log("Promise Rejected");
- });
- }
- client.on('message', async message => {
- if (message.author.bot) return;
- const array = message.content.split(' ');
- const command = array[0];
- const args = array.slice(1);
- if (!command.startsWith('!')) return;
- switch (command) {
- default:
- message.channel.send('Invalid command.');
- break;
- case '!ping':
- message.channel.send('🕒 Calculating Ping..').then(msg => {
- msg.edit(`🏓 Pong! Your ping is ${Math.round(client.ping)}ms`);
- });
- break;
- case '!kick':
- if (!message.author.hasPermission('KICK_MEMBERS')) {
- return message.channel.send(':warning: Missing permissions. Permission required kick: Kick Members.');
- }
- const person = message.guild.member(message.mentions.users.first());
- if (person == null) return message.reply(':warning: You gotta ping someone!');
- message.guild.member(person).kick(args.slice(1).join(' ')).then(member => {
- message.channel.send(`${member.user.username} has been kicked with reason ${args.slice(1).join(' ')}`);
- }).catch(err => {
- message.channel.send(err);
- });
- case '!pic':
- message.channel.send(getPicture()).then(msg => {
- setTimeout(getPicture(), 100);
- msg.edit(getPicture())
- });
- break;
- }
- });
- client.login("");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement