Tanıtım Çekiliş Sistemi

LyloN

Ne Mutlu Türküm Diyene!
Katılım
1 Ocak 2020
Mesajlar
902
En iyi cevaplar
1
Tepki puanı
400
Puanları
825
Konum
İstanbul
Dakikalar içinde aktif Minecraft sunucunu kur! Lag’sız, düşük pingli TR lokasyon ile kendi dünyanı oluştur, arkadaşlarınla oyna Hemen başla
Vereceğim Kod Çekiliş Yapmanızı Sağlar
ms ve moment modülleri gerekmektedir.
Kod:
const Discord = require("discord.js");
const moment = require("moment");
const ms = require("ms");
exports.run = async (client, message) => {
  var time = moment().format("Do MMMM YYYY , hh:mm");
  var room;
  var title;
  var duration;
  var currentTime = new Date(),
    hours = currentTime.getHours() + 3,
    minutes = currentTime.getMinutes(),
    done = currentTime.getMinutes() + duration,
    seconds = currentTime.getSeconds();
  if (minutes < 10) {
    minutes = "0" + minutes;
  }
  var suffix = "AM";
  if (hours >= 12) {
    suffix = "PM";
    hours = hours - 12;
  }
  if (hours == 0) {
    hours = 12;
  }
  var filter = m => m.author.id === message.author.id;
  message.channel
    .send(
      `:eight_pointed_black_star:| **Çekilişin yapılacağı kanalın adını yaz**`
    )
    .then(msg => {
      message.channel
        .awaitMessages(filter, {
          max: 1,
          time: 20000,
          errors: ["time"]
        })
        .then(collected => {
          let room = message.guild.channels.find(
            "name",
            collected.first().content
          );
          if (!room)
            return message.channel.send(
              ":heavy_multiplication_x:| **Böyle bir kanal bulamadım**"
            );
          room = collected.first().content;
          collected.first().delete();
          msg
            .edit(
              ":eight_pointed_black_star:| **Çekilişin süresini belirle (1s, 1m, 1h, 1d, 1w)**"
            )
            .then(msg => {
              message.channel
                .awaitMessages(filter, {
                  max: 1,
                  time: 20000,
                  errors: ["time"]
                })
                .then(collected => {
                  if (!collected.first().content.match(/[1-60][s,m,h,d,w]/g))
                    return message.channel.send(
                      ":heavy_multiplication_x:| **Böyle bir süre bilmiyorum :(**"
                    );
                  duration = collected.first().content;
                  collected.first().delete();
                  msg
                    .edit(
                      ":eight_pointed_black_star:| **Şimdi de ödülü yaz bakalım**"
                    )
                    .then(msg => {
                      message.channel
                        .awaitMessages(filter, {
                          max: 1,
                          time: 20000,
                          errors: ["time"]
                        })
                        .then(collected => {
                          title = collected.first().content;
                          collected.first().delete();
                          msg.delete();
                          message.delete();
                          try {
                            let giveEmbed = new Discord.RichEmbed()
                              .setColor("#f558c9")
                              .setDescription(
                                `**Ödül: ${title}** \n'a Basarak Katıl \nKalan Süre : ${duration} \n **Başlama Zamanı :** ${hours}:${minutes}:${seconds} ${suffix}`
                              )
                              .setFooter(
                                message.author.username +
                                  " (GodChe çekiliş sistemi)",
                                message.author.avatarURL
                              );
                            message.guild.channels
                              .find("name", room)
                              .send(
                                " :heavy_check_mark: **ÇEKİLİŞ BAŞLADI** :heavy_check_mark:",
                                { embed: giveEmbed }
                              )


Eğer Kodda Hata Çıkarsa Yorum Atmanız Yeterlidir.
Discorddan Ulaşmak İçin GodChe#1059 Eklemeniz Yeterlidir.​
 

Moonshine

Risk almazsan, risk alanlar için çalışırsın.
Katılım
26 Ekim 2019
Mesajlar
65
En iyi cevaplar
1
Tepki puanı
-31
Puanları
1,215
Konum
Konya
Web Sitesi
batihost.com
Dakikalar içinde aktif Minecraft sunucunu kur! Lag’sız, düşük pingli TR lokasyon ile kendi dünyanı oluştur, arkadaşlarınla oyna Hemen başla
Güzel olmuş, başarılar dilerim.
 

Üst