Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- if (!points[message.author.id]) points[message.author.id] = {
- points: 0,
- };
- if(!message.guild) return;
- let id = message.author.id,prefix="s!";
- if (speed[id] && (new Date).getTime() - speed[id] < 15*1000) {
- let r = (new Date).getTime() - speed[id];
- r = 15*1000 - r;
- }
- if ( message.content == prefix+'speed'){
- try{
- }catch(e){
- }
- if(!message.channel.guild) return message.reply('**هذا الأمر للسيرفرات فقط**').then(m => m.delete(3000));
- const item = speed[Math.floor(Math.random() * speed.length)];
- const filter = response => {
- return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
- };
- message.channel.send('**Game is Start now...!**').then(msg => {
- const embed = new Discord.RichEmbed()
- .setColor("0054dd")
- .setAuthor(`⏳ |You have »15« seconds to type the word`)
- .setImage(`${item.type}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- msg.channel.send(embed).then(() => {
- message.channel.awaitMessages(filter, { maxMatches: 1, time: 15000, errors: ['time'] })
- .then((collected) => {
- const sh = new Discord.RichEmbed()
- .setColor("04791c")
- .setDescription('**✅ |Good Job +1P**')
- .addField('Type $mypoints', 'To Show ur Points' , true)
- .setFooter(message.author.username, message.author.avatarURL)
- message.channel.sendEmbed(sh);
- let won = collected.first().author; // في هذا السطر يقوم الكود بسحب الأي دي الذي قام بالأجابة اولاً
- points[won.id].points++;
- })
- .catch(collected => { // في حال لم يقم أحد بالإجابة
- message.channel.send(`🔚 |**Time Is End**`);
- })
- fs.writeFile("./points.json", JSON.stringify(points), (err) => {
- if (err) console.error(err)
- })
- })
- })
- speed[id] = (new Date).getTime()
- }
- });
- client.on('message', message => {
- if (message.content.startsWith(prefix + 'mypoints')) {
- if(!message.channel.guild) return message.reply('**هذا الأمر للسيرفرات فقط**').then(m => m.delete(3000));
- let userData = points[message.author.id];
- let embed = new Discord.RichEmbed()
- .setAuthor(`${message.author.tag}`, message.author.avatarURL)
- .setColor('#000000')
- .setDescription(`نقاطك: \`${userData.points}\``)
- message.channel.sendEmbed(embed)
- }
- fs.writeFile("./points.json", JSON.stringify(points), (err) => {
- if (err) console.error(err)
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement