Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.55 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const client = new Discord.Client();
  3. const prefix = "c!"
  4.  
  5.  
  6. client.on('ready', () => {
  7. console.log(`Logged in as ${client.user.tag}!`);
  8. client.user.setPresence({ game: { name: 'Use c!help - 9 Servers!', type: 0 } });
  9. client.on('guildMemberAdd', member => {
  10. // Send the message to a designated channel on a server:
  11. const channel = member.guild.channels.find('name', 'member-log');
  12. // Do nothing if the channel wasn't found on this server
  13. if (!channel) return;
  14. // Send the message, mentioning the member
  15. channel.send(`Welcome to the server, ${member}`);
  16. });
  17. });
  18. // Create an event listener for new guild members
  19. client.on('guildMemberRemove', member => {
  20. // Send the message to a designated channel on a server:
  21. const channel = member.guild.channels.find('name', 'member-log');
  22. // Do nothing if the channel wasn't found on this server
  23. if (!channel) return;
  24. // Send the message, mentioning the member
  25. channel.send(`Bye ${member},we will miss you` );
  26. });
  27. client.on('message', msg => {
  28. if(msg.author.bot){
  29. return;
  30. }
  31. client.on('message', message => {
  32. if (message.content === 'c!spam') {
  33. message.channel.sendMessage('c!spam');
  34. }
  35. });
  36. if (msg.content === prefix + 'ping') {
  37. msg.channel.send({embed: {
  38. title: "Pong!",
  39. color: 0xFF0000,
  40. description: "Getting Ping!"
  41. }}).then(function(m){
  42. m.edit({embed: {
  43. title: "Pong!",
  44. color: 0xFF0000,
  45. description: (m.createdTimestamp-msg.createdTimestamp)+"ms"
  46. }});
  47. });
  48. }
  49. else if (msg.content === prefix + "bebenstest") {
  50. msg.channel.send("http://i.imgur.com/uCrft70.png")
  51. msg.channel.send({
  52. embed: {
  53. title: "image info",
  54. color: 0x0061FF,
  55. description: "A VERY NICE MS PAINT ART LMAO",
  56. footer: {
  57. icon_url: client.user.avatarURL,
  58. text: "© Meow Bot"
  59. }
  60. }
  61. });
  62. }
  63. else if (msg.content === prefix + 'help') {
  64. msg.author.send({
  65. embed: {
  66. title: "Help",
  67. color: 0xFF0000,
  68. thumbnail: {url: 'https://colesey.xyz/img/Coleslogo.png'},
  69. 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```"
  70. }
  71. }).then(function(){
  72. msg.channel.send({
  73. embed: {
  74. title: "Help Sent!",
  75. color: 0xFF0000,
  76. description: "Check your DM for command help"
  77. }
  78. });
  79. });
  80. }
  81. else if (msg.content === prefix + 'h') {
  82. msg.author.send({
  83. embed: {
  84. title: "Help",
  85. color: 0xFF0000,
  86. thumbnail: {url: 'https://colesey.xyz/img/Coleslogo.png'},
  87. 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```"
  88. }
  89. }).then(function(){
  90. msg.channel.send({
  91. embed: {
  92. title: "Help Sent!",
  93. color: 0xFF0000,
  94. description: "Check your DM for command help"
  95. }
  96. });
  97. });
  98. }
  99. else if(msg.content.startsWith(prefix + "delmsg")){
  100. if(msg.member.hasPermission("MANAGE_MESSAGES")){
  101. var number = parseInt(msg.content.split(' ')[1]);
  102.  
  103. msg.delete().then(function(){
  104. msg.channel.bulkDelete(number).then(function(){
  105. msg.channel.send({
  106. embed: {
  107. title: "Deleted Messages",
  108. color: 0xFF0000,
  109. description: "Deleted " + number + " messages successfully."
  110. }
  111. }).then(function(m){
  112. setTimeout(function(){
  113. m.delete();
  114. }, 2500);
  115. });
  116. });
  117. });
  118. }
  119. else{
  120. msg.channel.send({
  121. embed: {
  122. title: "Permission Error",
  123. color: 0xFF0000,
  124. description: "You do not have permission to use this command."
  125. }
  126. });
  127. }
  128. }
  129.  
  130. else if(msg.content === prefix + 'id'){
  131. msg.channel.send("Your id is: " + msg.author.id + ", " + msg.author);
  132. }
  133. else if(msg.content === prefix + 'avatar'){
  134. msg.channel.send({
  135. embed: {
  136. description: msg.author + ", Your avatar is:\n[Direct Link](" + msg.author.displayAvatarURL + ")",
  137. color: 0xFF0000,
  138. thumbnail: {url: msg.author.displayAvatarURL}
  139.  
  140. }
  141. });
  142. }
  143. else if(msg.content === prefix + 'info'){
  144. msg.channel.send({
  145. embed: {
  146. title: "Colesey The Discord Bot",
  147. 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/)**",
  148. color: 0xFF0000,
  149. thumbnail: {url:'https://colesey.xyz/img/Coleslogo.png'}
  150. }
  151. });
  152. }
  153.  
  154. else if(msg.content === prefix + 'ver'){
  155. msg.channel.send({
  156. embed: {
  157. title: "Colesey BETA.1.1",
  158. description: "**The Colesey Bot**\nStill In Beta Testing Text-Channel Commands!",
  159. color: 0xFF0000,
  160. }
  161. });
  162. }
  163. else if(msg.content === prefix + "colesey"){
  164. msg.channel.send({embed: {
  165. color: 0xFF0000,
  166. title: "Colesey",
  167. description: "Colesey the discord bot is owned by | Rhys |#7863",
  168. timestamp: new Date(),
  169. footer: {
  170. icon_url: client.user.avatarURL,
  171. text: "© Colesey"
  172.  
  173. }
  174. }
  175. });
  176. }
  177. else if(msg.content === prefix + "time"){
  178. msg.channel.send({ embed: {
  179. title: "Colesey's Time",
  180. description: "Time",
  181. timestamp: new Date(),
  182. icon_url: client.user.avatarURL,
  183. thumbnail: {url: msg.author.displayAvatarURL},
  184. color: 0xFF0000}})
  185. .then(message => {
  186. message.react('😀');
  187. });
  188. }
  189. else if(msg.content === prefix + "test"){
  190. msg.channel.send({ embed: {
  191. title: "Colesey BETA.1.1",
  192. description: "```css\nThe Colesey Bot\n```<:gear:333752116973797398><:mod:333752135198179328>",
  193. timestamp: new Date(),
  194. icon_url: client.user.avatarURL,
  195. thumbnail: {url: msg.author.displayAvatarURL},
  196. color: 0xFF0000}})
  197. .then(message => {
  198. message.react('😀');
  199. });
  200. }
  201.  
  202. else if(msg.content === prefix + 'invite'){
  203. msg.channel.send({
  204. embed: {
  205. 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)",
  206. color: 0xFF0000,
  207. }
  208. });
  209. }
  210. else if(msg.content === prefix + 'web'){
  211. msg.channel.send({
  212. embed: {
  213. description: msg.author + ", You can visit my webiste [Here](https://colesey.xyz/)",
  214. color: 0xFF0000,
  215. }
  216. });
  217. }
  218. else if(msg.content.startsWith(prefix + "kick <@")){
  219. var memberId = msg.content.split(" ")[1].split("<@")[1].split(">")[0].replace("!", "");
  220. var member = msg.guild.members.get(memberId);
  221. member.kick().then(function(){
  222. msg.channel.send({
  223. embed: {
  224. title: "Kicked",
  225. color: 0xFF0000,
  226. description: "User <@"+memberId+"> kicked successfully."
  227. }
  228. });
  229. });
  230. }
  231. else if(msg.content.startsWith(prefix + "ban <@")){
  232. var memberId = msg.content.split(" ")[1].split("<@")[1].split(">")[0].replace("!", "");
  233. var member = msg.guild.members.get(memberId);
  234. member.ban().then(function(){
  235. msg.channel.send({
  236. embed: {
  237. title: "Banned",
  238. color: 0xFF0000,
  239. description: "User <@"+memberId+"> banned successfully."
  240. }
  241. });
  242. });
  243. }
  244. else if(msg.content === prefix + "shutdown"){
  245. if(msg.author.id === '327727724233752578'){
  246. msg.channel.send({
  247. embed: {
  248. title: "Shutting Down",
  249. color: 0xFF0000,
  250. description: 'Shutting down Colesey'
  251. }}).then(m => {process.abort();});
  252. }
  253. else{
  254. msg.channel.send({
  255. embed: {
  256. title: "Shutdown Error",
  257. color: 0xFF0000,
  258. description: "This is for the owner only."
  259. }});
  260. }
  261. }
  262. else if(msg.content === prefix + 'author'){
  263. msg.channel.send({
  264. embed: {
  265. title: "**Colesey The Discord Bot**",
  266. description: "**Author** @Rhys | Colesey#7863",
  267. color: 0xFF0000,
  268. thumbnail: {url:'https://colesey.xyz/img/Coleslogo.png'}
  269.  
  270. }
  271. });
  272. }
  273. })
  274. client.login('MzQ0NzM4ODY5NDE1MjQ3ODcz.DHsYdA.8J7JSY3JTVmxUvdDD5OFq7BJy_o');
  275. function logCommand(commandName, message){
  276. var fs = require('fs');
  277. var logExists = fs.existsSync('log.txt');
  278. var content = "";
  279.  
  280. if(logExists){
  281. content = fs.readFileSync('log.txt', 'utf-8');
  282. }
  283. fs.writeFileSync('log.txt', content)
  284. function readableDate(ms){
  285. var time = new Date(ms);
  286.  
  287. return time.getUTCHours() + " hours " + time.getUTCMinutes() + " minutes " + time.getUTCSeconds() + " seconds";
  288. }
  289. }
  290. function readableDate(ms){
  291. var time = new Date(ms);
  292.  
  293. return time.getUTCHours() + " hours " + time.getUTCMinutes() + " minutes " + time.getUTCSeconds() + " seconds";
  294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement