Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. // removed Network Discord Bot
  2. // Created by LamboCreeper
  3. // Written in JavaScript
  4. // Using DiscordJS and NodeJS.
  5.  
  6.  
  7. const Discord = require('discord.js');
  8. const client = new Discord.Client();
  9.  
  10. // Connect to MySQL database
  11.  
  12.  
  13. var mysql = require('mysql');
  14. var connection = mysql.createConnection({
  15. host: '',
  16. user: '',
  17. password: '',
  18. database: '',
  19. });
  20.  
  21. connection.connect(function(err){
  22. if(err){
  23. console.log('error');
  24. }else{
  25. console.log('connected');
  26. }
  27. });
  28.  
  29. client.on('ready', () => {
  30. console.log('I am ready!');
  31.  
  32. client.user.setGame("")
  33.  
  34. });
  35.  
  36. client.on('message', message => {
  37.  
  38. // Help Commands
  39.  
  40. if (message.content === '/sql_test') {
  41. connection.connect();
  42. connection.query("SELECT * FROM lambo", function(eer, rows, fields) {
  43. if (eer) throw err;
  44.  
  45. message.reply(rows);
  46.  
  47. });
  48. connection.end();
  49.  
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement