Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. const tokens = require('../tokens.json');
  2. const Discord = require("discord.js");
  3. const sql = require(`sqlite`);
  4. const client = new Discord.Client();
  5.  
  6. sql.open(`pubg.sqlite`)
  7.  
  8. exports.run = async (client, msg, params) => {
  9. return new Promise(async(resolve, reject) => {
  10. let open = `yes`;
  11. let rows = await sql.all(`SELECT DISTINCT * FROM matchmaking WHERE open = "yes" AND guildID = "${msg.guild.id}" LIMIT 10`);
  12. const embed = new Discord.MessageEmbed()
  13. .setTitle(`Users Currently Matchmaking!`)
  14. .setDescription(`A list of Users who are currently matchmaking and the Paramaters they are searching for!`)
  15. .setThumbnail(msg.guild.iconURL)
  16. .setColor(0x00AE86)
  17. .setTimestamp()
  18. .setFooter(`${tokens.name} | `, "https://i.imgur.com/kin1Qv2.jpg")
  19. let matchmaking = require(`./join.js`);
  20. matchmaking[msg.guild.id].users.forEach((userID, i) => { embed.addField(`${i+1} **${users.userName}** Searching In **${users.region}**`, `Looking for a **${users.mode}** in **${users.perspective}** Mode!`)});
  21. msg.channel.send(
  22. embed,
  23. '',
  24. { disableEveryone: true }
  25. ).catch((error) => {client.channels.get(tokens.logID).send(error); console.log(error)});
  26. });
  27. };
  28.  
  29. exports.conf = {
  30. enabled: true,
  31. guildOnly: false,
  32. aliases: ['']
  33. };
  34.  
  35. exports.help = {
  36. name: 'queue',
  37. description: 'queue',
  38. usage: 'queue'
  39. };
  40.  
  41.  
  42. // The other file... cut down the uneccesary parts
  43.  
  44. const tokens = require('../tokens.json');
  45. const Discord = require("discord.js");
  46. const client = new Discord.Client();
  47.  
  48. exports.run = async (client, msg, params) => {
  49. return new Promise((resolve, reject) => {
  50. matchmaking = {};
  51. if(!matchmaking.hasOwnProperty(msg.guild.id)) {
  52. matchmaking[msg.guild.id] = {};
  53. matchmaking[msg.guild.id].searching = false;
  54. matchmaking[msg.guild.id].users = [];
  55. }
  56. matchmaking[msg.guild.id].users.push({userID: msg.author.id, userName: msg.author.username, perspective: perspective, mode: mode, region: region});
  57. module.exports = matchmaking[msg.guild.id];
  58. const embed = new Discord.MessageEmbed()
  59. .setThumbnail(msg.guild.iconURL)
  60. .setColor(0x00AE86)
  61. .addField(`**Matchmaking Started**`, `Searching for ${perspective} ${mode} in ${region}`)
  62. .setTimestamp()
  63. .setFooter(`${tokens.name} |`, "https://i.imgur.com/kin1Qv2.jpg")
  64. msg.channel.send(
  65. embed,
  66. '',
  67. { disableEveryone: true }
  68. ).catch((error) => {client.channels.get(tokens.logID).send(error); console.log(error)});
  69. console.log(matchmaking[msg.guild.id].users);
  70. });
  71. };
  72.  
  73. exports.conf = {
  74. enabled: true,
  75. guildOnly: false,
  76. aliases: ['']
  77. };
  78.  
  79. exports.help = {
  80. name: 'join',
  81. description: '',
  82. usage: 'join'
  83. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement