Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Calling the package
- var Discord = require('discord.js');
- var bot = new Discord.Client();
- // Listener Event: Message Received ( This will run every time a message is received )
- bot.on('message', message => {
- // Variables
- var sender = message.author; // The person who sent the message.
- var msg = message.content.toLowerCase(); // Takes the message, and makes it all lowercase.
- var prefix = '>' // The prefix of the bot, you can set this to what ever you want.
- // Greetings messages
- if (msg === prefix + 'vep') {
- message.channel.send('Welcome to Relax server') // Sends a message to the channel, with the contents: "sksksk welcome to R E L A X"
- }
- // More Greeting Messages
- if (msg === prefix + 'reto') {
- message.channel.send('We hope you have fun here sksksk')
- }
- // More Greeting messages
- if (msg === prefix + 'tee') {
- message.channel.send('Everyone is welcomed here')
- }
- // Deleting Specific Messages ( Messages that are not an ID for me )
- if (message.channel.id === '613805872396763249') { // Checks if the message is in the specific channel
- if (isNaN(message.content)) { // Checks if the message is not a number, if it's not the following code will run
- message.delete() // This deletes the message
- message.author.send('Only post numbers in <#613805872396763249> channel please. Thank you!') // This private messages the author that what they posted was invalid.
- }
- }
- })
- // Listener Event: Bot Launched
- bot.on('ready', () => {
- console.log('Bot Launched...') // Runs when the bot is Launched
- // You can put any code you want here, it will run when your turn on your bot.
- });
- // Login
- bot.login('NjEzODIxNjg0NDc0MDUyNjY1.XV2gGQ.v2IoiDUlLErob-udjefIOPm4kjI') // Don't let people see this code, people can control yor bot, including the servers your bot has admin in.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement