Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- var patt1 = /the game/i;
- //var patt2 = /^(>multi)/i;
- if (LOCALHOST == 0 && patt1.test(message.content) && (Date.now() - dernierperdu) > 3600000 && dernierperdant != message.author) {
- dernierperdu = Date.now();
- dernierperdant = message.author;
- message.channel.send('I just lost.');
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 9) == '!devpolls') {
- var membre = guilde.member(message.author.id).roles.keyArray();
- var roles = [], ml = membre.length, ok = 0;
- for (var i = 0; i < ml; i++) {
- if (membre[i] == '455425290055843840') { ok = 1; }
- else { roles.push(membre[i]); }
- }
- if (ok == 0) { roles.push('455425290055843840') }
- guilde.member(message.author.id).setRoles(roles);
- if (ok == 1) { message.channel.send('You do not have the role anymore.'); }
- else { message.channel.send('You now have the role. Thank you for caring about Worldwide Combos!'); }
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 5) == '!help') {
- var texte = "```PROFILE CARDS: !profile <username>\nSYNCHRONIZE YOUR ACCOUNT: !sync\n";
- texte += "SOCIAL MEDIA: !facebook !twitter !youtube\n";
- texte += "OTHER: !history !upcoming !online !members\nHELP: !help\n";
- texte += "DEV SUBSCRIPTION: !devpolls```";
- message.channel.send(texte);
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 8) == '!history') {
- message.channel.send('Previous updates\' changelog: https://www.worldwide-combos.com/wiki/history');
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 9) == '!upcoming') {
- message.channel.send('List of upcoming features: https://www.worldwide-combos.com/wiki/upcoming');
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 7) == '!online') {
- connection.query('SELECT pseudo, pays FROM membres WHERE derniereconnexion > DATE_SUB(NOW(), INTERVAL 5 MINUTE) ORDER BY pseudo', function (error, liste, fields) {
- if (liste.length == 0) { message.channel.send('Nobody is currently online.'); }
- else {
- var l = 'Current online members: ';
- for (var i = 0; i < liste.length-1; i++) {
- l += ':flag_'+cp[liste[i]['pays']]+': ' + liste[i]['pseudo'] + ', ';
- }
- l += ':flag_'+cp[liste[liste.length-1]['pays']]+': ' + liste[liste.length-1]['pseudo'] + '.';
- message.channel.send(l);
- }
- });
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 8) == '!members') {
- connection.query('SELECT COUNT(*) AS nb FROM membres WHERE typemembre = 1 OR typemembre = 2', function (error, nombre, fields) {
- var texte = "```Members with a validated account: "+nombre[0]['nb']+"\n";
- texte += "Members on this Discord server: "+guilde.memberCount+"```";
- message.channel.send(texte);
- });
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 8) == '!profile') {
- var pseudo = message.content.substring(9, message.content.length);
- connection.query('SELECT * FROM membres WHERE typemembre >= 0 AND pseudo = ?', [pseudo], function (error, verif, fields) {
- if (verif.length == 1) {
- var infos = verif[0];
- data = new Discord.RichEmbed();
- data.setColor('GREY');
- data.setTitle(':flag_'+cp[infos['pays']]+': **'+infos['pseudo']+'**');
- var desc1 = '', desc2 = '', desc = '';
- if ((infos["prenom_afficher"] == 1 && infos["prenom"] != "") || (infos["nom_afficher"] == 1 && infos["nom"] != "")) { desc1 += '**Name**\n'; }
- if (infos["prenom_afficher"] == 1 && infos["prenom"] != "") { desc1 += infos["prenom"] + ' '; }
- if (infos["nom_afficher"] == 1 && infos["nom"] != "") { desc1 += infos["nom"] + '\n\n'; }
- if (infos["sexe_afficher"] == 1) { desc1 += '**Gender**\n';
- if (infos["sexe"] == 0) { desc1 += 'male\n\n' }
- else if (infos["sexe"] == 1) { desc1 += 'female\n\n'; }
- else if (infos["sexe"] == 2) { desc1 += 'other\n\n'; }
- }
- desc1 += '**Registration date**\n' + infos["dateinscription"].toString().substring(0, 24) + '\n\n';
- desc1 += '**Last login**\n' + infos["derniereconnexion"].toString().substring(0, 24) + '\n\n';
- if (infos["twitch"] != "") { desc1 += '**Twitch channel**\nhttps://twitch.tv/' + infos["twitch"] + '\n\n'; }
- connection.query('SELECT 1+COUNT(*) AS cl FROM membres WHERE elo1 >= ? AND typemembre < 3 AND typemembre > 0 AND elo1 != 1000', [infos["elo1"]+0.01], function (error, elo1, fields) {
- connection.query('SELECT 1+COUNT(*) AS cl FROM membres WHERE elo2 >= ? AND typemembre < 3 AND typemembre > 0 AND elo2 != 1000', [infos["elo2"]+0.01], function (error, elo2, fields) {
- connection.query('SELECT 1+COUNT(*) AS cl FROM membres WHERE sprint > 0 AND sprint <= ? AND typemembre < 3 AND typemembre > 0', [infos["sprint"]-0.00001], function (error, sp40, fields) {
- connection.query('SELECT 1+COUNT(*) AS cl FROM membres WHERE tournoi > ? AND typemembre < 3 AND typemembre > 0', [infos["tournoi"]+0.00001], function (error, tournoi, fields) {
- connection.query('SELECT 1+COUNT(*) AS cl FROM membres WHERE survivor > ? AND typemembre < 3 AND typemembre > 0', [infos["survivor"]+0.00001], function (error, survivor, fields) {
- desc2 += '**Tournament points**\n';
- if (infos["tournoi"] > 0) { desc2 += infos["tournoi"] + ' (rank: '+tournoi[0]['cl']+')'; } else { desc2 += '0' }
- desc2 += '\n\n**Multiplayer rating**\n';
- if (infos["elo2"] != 1000) { desc2 += infos["elo2"] + ' (rank: '+elo2[0]['cl']+')'; } else { desc2 += '1000'; }
- desc2 += '\n\n**Ghostbuster rating**\n';
- if (infos["elo1"] != 1000) { desc2 += infos["elo1"] + ' (rank: '+elo1[0]['cl']+')'; } else { desc2 += '1000'; }
- var ms = Math.floor(parseFloat(infos["sprint"])/60000);
- var ss = parseFloat(infos["sprint"])-60000*Math.floor(parseFloat(infos["sprint"])/60000);
- if (ss < 10000) { var stc = ms + ":0" + ss/1000; }
- else { var stc = ms + ":" + ss/1000; }
- desc2 += '\n\n**Sprint time**\n';
- if (infos["sprint"] > 0) { desc2 += stc + ' (rank: '+sp40[0]['cl']+')'; } else { desc2 += 'none'; }
- desc2 += '\n\n**';
- var ms2 = Math.floor(parseFloat(infos["survivor"])/60000);
- var ss2 = parseFloat(infos["survivor"])-60000*Math.floor(parseFloat(infos["survivor"])/60000);
- if (ms2 > 4) {
- if (ss2 < 10000) { var stc2 = (ms2-4) + ":0" + ss2/1000; }
- else { var stc2 = (ms2-4) + ":" + ss2/1000; }
- }
- else {
- if (ss2 < 10000) { var stc2 = ms2 + ":0" + ss2/1000; }
- else { var stc2 = ms2 + ":" + ss2/1000; }
- }
- if (infos["survivor"] > 240000) { desc2 += 'Elite Survivor time'; } else { desc2 += 'Survivor time'; }
- desc2 += '**\n';
- if (infos["survivor"] > 0) { desc2 += stc2 + ' (rank: '+survivor[0]['cl']+')'; } else { desc2 += 'none'; }
- data.addField('Information', desc1, true);
- data.addField('Performances', desc2, true);
- var pseudoCorrige = '', lp = infos['pseudo'].length;
- for (var i = 0; i < lp; i++) {
- if (infos['pseudo'].substring(i, i+1) == ' ') { pseudoCorrige += '%20'; }
- else { pseudoCorrige += infos['pseudo'].substring(i, i+1); }
- }
- desc += 'Profile link: https://www.worldwide-combos.com/profile?p='+pseudoCorrige+'\n\n';
- data.setDescription(desc);
- message.channel.send('', data);
- });
- });
- });
- });
- });
- }
- });
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 9) == '!facebook') {
- message.channel.send('https://www.facebook.com/worldwidecombos/');
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 8) == '!twitter') {
- message.channel.send('https://www.twitter.com/worldwidecombos/');
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 8) == '!youtube') {
- message.channel.send('https://www.youtube.com/channel/UCxSrPJKU5gOMvinEUWWm1Ww');
- }
- else if (LOCALHOST == 0 && message.content.substring(0, 5) == '!sync') {
- /* ...*/
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement