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 prefix = "c!"
- client.on('ready', () => {
- console.log(`Logged in as ${client.user.tag}!`);
- client.user.setPresence({ game: { name: 'Use c!help - 9 Servers!', type: 0 } });
- client.on('guildMemberAdd', member => {
- // Send the message to a designated channel on a server:
- const channel = member.guild.channels.find('name', 'member-log');
- // Do nothing if the channel wasn't found on this server
- if (!channel) return;
- // Send the message, mentioning the member
- channel.send(`Welcome to the server, ${member}`);
- });
- });
- // Create an event listener for new guild members
- client.on('guildMemberRemove', member => {
- // Send the message to a designated channel on a server:
- const channel = member.guild.channels.find('name', 'member-log');
- // Do nothing if the channel wasn't found on this server
- if (!channel) return;
- // Send the message, mentioning the member
- channel.send(`Bye ${member},we will miss you` );
- });
- client.on('message', msg => {
- if(msg.author.bot){
- return;
- }
- client.on('message', message => {
- if (message.content === 'c!spam') {
- message.channel.sendMessage('c!spam');
- }
- });
- if (msg.content === prefix + 'ping') {
- msg.channel.send({embed: {
- title: "Pong!",
- color: 0xFF0000,
- description: "Getting Ping!"
- }}).then(function(m){
- m.edit({embed: {
- title: "Pong!",
- color: 0xFF0000,
- description: (m.createdTimestamp-msg.createdTimestamp)+"ms"
- }});
- });
- }
- else if (msg.content === prefix + "bebenstest") {
- msg.channel.send("http://i.imgur.com/uCrft70.png")
- msg.channel.send({
- embed: {
- title: "image info",
- color: 0x0061FF,
- description: "A VERY NICE MS PAINT ART LMAO",
- footer: {
- icon_url: client.user.avatarURL,
- text: "© Meow Bot"
- }
- }
- });
- }
- else if (msg.content === prefix + 'help') {
- msg.author.send({
- embed: {
- title: "Help",
- color: 0xFF0000,
- thumbnail: {url: 'https://colesey.xyz/img/Coleslogo.png'},
- description: "Commands:```css\nc!help/c!h : Shows these commands\nc!author : Tells you who made me!\nc!ver : Shows the version of Colesey.\nc!avatar : Wanna see what my avatar looks like?\nc!ping : To see if my bots alive.\nc!id : Get the id of a user.\nc!invite : Get the invite link to my bot.\nc!web : Get the URL of my website\nc!Ban : Need to ban a player? You can do it quick and easy using this command!\nc!Kick : Need to kick a player? You can do it quick and easy using this command!\nc!info : Get statistics about my bot.\nc!delmsg : Need to delete messages a user has sent? Do it quick and easy using this command!\n```"
- }
- }).then(function(){
- msg.channel.send({
- embed: {
- title: "Help Sent!",
- color: 0xFF0000,
- description: "Check your DM for command help"
- }
- });
- });
- }
- else if (msg.content === prefix + 'h') {
- msg.author.send({
- embed: {
- title: "Help",
- color: 0xFF0000,
- thumbnail: {url: 'https://colesey.xyz/img/Coleslogo.png'},
- description: "Commands:```css\nc!help/c!h : Shows these commands\nc!author : Tells you who made me!\nc!ver : Shows the version of Colesey.\nc!avatar : Wanna see what my avatar looks like?\nc!ping : To see if my bots alive.\nc!id : Get the id of a user.\nc!invite : Get the invite link to my bot.\nc!web : Get the URL of my website\nc!Ban : Need to ban a player? You can do it quick and easy using this command!\nc!Kick : Need to kick a player? You can do it quick and easy using this command!\nc!info : Get statistics about my bot.\nc!delmsg : Need to delete messages a user has sent? Do it quick and easy using this command!\n```"
- }
- }).then(function(){
- msg.channel.send({
- embed: {
- title: "Help Sent!",
- color: 0xFF0000,
- description: "Check your DM for command help"
- }
- });
- });
- }
- else if(msg.content.startsWith(prefix + "delmsg")){
- if(msg.member.hasPermission("MANAGE_MESSAGES")){
- var number = parseInt(msg.content.split(' ')[1]);
- msg.delete().then(function(){
- msg.channel.bulkDelete(number).then(function(){
- msg.channel.send({
- embed: {
- title: "Deleted Messages",
- color: 0xFF0000,
- description: "Deleted " + number + " messages successfully."
- }
- }).then(function(m){
- setTimeout(function(){
- m.delete();
- }, 2500);
- });
- });
- });
- }
- else{
- msg.channel.send({
- embed: {
- title: "Permission Error",
- color: 0xFF0000,
- description: "You do not have permission to use this command."
- }
- });
- }
- }
- else if(msg.content === prefix + 'id'){
- msg.channel.send("Your id is: " + msg.author.id + ", " + msg.author);
- }
- else if(msg.content === prefix + 'avatar'){
- msg.channel.send({
- embed: {
- description: msg.author + ", Your avatar is:\n[Direct Link](" + msg.author.displayAvatarURL + ")",
- color: 0xFF0000,
- thumbnail: {url: msg.author.displayAvatarURL}
- }
- });
- }
- else if(msg.content === prefix + 'info'){
- msg.channel.send({
- embed: {
- title: "Colesey The Discord Bot",
- description:"**__Statistics!__\nSatus: Online\nOwner: | Rhys |#7863\nUsers: "+client.users.size+"\nUsername: "+client.user.tag+"\nUptime: "+readableDate(client.uptime)+"\nServers: "+ client.guilds.size + "\nInvite Link: [Click Here](https://discordapp.com/oauth2/authorize?client_id=344738869415247873&scope=bot&permissions=305527895)<---You Can Also Do c!invite.\nPrefix: c! <---Working On Making It Customisable.\nWebsite:[Click Here](https://colesey.xyz/)**",
- color: 0xFF0000,
- thumbnail: {url:'https://colesey.xyz/img/Coleslogo.png'}
- }
- });
- }
- else if(msg.content === prefix + 'ver'){
- msg.channel.send({
- embed: {
- title: "Colesey BETA.1.1",
- description: "**The Colesey Bot**\nStill In Beta Testing Text-Channel Commands!",
- color: 0xFF0000,
- }
- });
- }
- else if(msg.content === prefix + "colesey"){
- msg.channel.send({embed: {
- color: 0xFF0000,
- title: "Colesey",
- description: "Colesey the discord bot is owned by | Rhys |#7863",
- timestamp: new Date(),
- footer: {
- icon_url: client.user.avatarURL,
- text: "© Colesey"
- }
- }
- });
- }
- else if(msg.content === prefix + "time"){
- msg.channel.send({ embed: {
- title: "Colesey's Time",
- description: "Time",
- timestamp: new Date(),
- icon_url: client.user.avatarURL,
- thumbnail: {url: msg.author.displayAvatarURL},
- color: 0xFF0000}})
- .then(message => {
- message.react('😀');
- });
- }
- else if(msg.content === prefix + "test"){
- msg.channel.send({ embed: {
- title: "Colesey BETA.1.1",
- description: "```css\nThe Colesey Bot\n```<:gear:333752116973797398><:mod:333752135198179328>",
- timestamp: new Date(),
- icon_url: client.user.avatarURL,
- thumbnail: {url: msg.author.displayAvatarURL},
- color: 0xFF0000}})
- .then(message => {
- message.react('😀');
- });
- }
- else if(msg.content === prefix + 'invite'){
- msg.channel.send({
- embed: {
- description: msg.author + ", You can invite me to your server by clicking [Here](https://discordapp.com/oauth2/authorize?client_id=344738869415247873&scope=bot&permissions=305527895)",
- color: 0xFF0000,
- }
- });
- }
- else if(msg.content === prefix + 'web'){
- msg.channel.send({
- embed: {
- description: msg.author + ", You can visit my webiste [Here](https://colesey.xyz/)",
- color: 0xFF0000,
- }
- });
- }
- else if(msg.content.startsWith(prefix + "kick <@")){
- var memberId = msg.content.split(" ")[1].split("<@")[1].split(">")[0].replace("!", "");
- var member = msg.guild.members.get(memberId);
- member.kick().then(function(){
- msg.channel.send({
- embed: {
- title: "Kicked",
- color: 0xFF0000,
- description: "User <@"+memberId+"> kicked successfully."
- }
- });
- });
- }
- else if(msg.content.startsWith(prefix + "ban <@")){
- var memberId = msg.content.split(" ")[1].split("<@")[1].split(">")[0].replace("!", "");
- var member = msg.guild.members.get(memberId);
- member.ban().then(function(){
- msg.channel.send({
- embed: {
- title: "Banned",
- color: 0xFF0000,
- description: "User <@"+memberId+"> banned successfully."
- }
- });
- });
- }
- else if(msg.content === prefix + "shutdown"){
- if(msg.author.id === '327727724233752578'){
- msg.channel.send({
- embed: {
- title: "Shutting Down",
- color: 0xFF0000,
- description: 'Shutting down Colesey'
- }}).then(m => {process.abort();});
- }
- else{
- msg.channel.send({
- embed: {
- title: "Shutdown Error",
- color: 0xFF0000,
- description: "This is for the owner only."
- }});
- }
- }
- else if(msg.content === prefix + 'author'){
- msg.channel.send({
- embed: {
- title: "**Colesey The Discord Bot**",
- description: "**Author** @Rhys | Colesey#7863",
- color: 0xFF0000,
- thumbnail: {url:'https://colesey.xyz/img/Coleslogo.png'}
- }
- });
- }
- })
- client.login('MzQ0NzM4ODY5NDE1MjQ3ODcz.DHsYdA.8J7JSY3JTVmxUvdDD5OFq7BJy_o');
- function logCommand(commandName, message){
- var fs = require('fs');
- var logExists = fs.existsSync('log.txt');
- var content = "";
- if(logExists){
- content = fs.readFileSync('log.txt', 'utf-8');
- }
- fs.writeFileSync('log.txt', content)
- function readableDate(ms){
- var time = new Date(ms);
- return time.getUTCHours() + " hours " + time.getUTCMinutes() + " minutes " + time.getUTCSeconds() + " seconds";
- }
- }
- function readableDate(ms){
- var time = new Date(ms);
- return time.getUTCHours() + " hours " + time.getUTCMinutes() + " minutes " + time.getUTCSeconds() + " seconds";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement