Kod Gelişmiş Twitch İstatistik Komutu.

KenDayy#0001
Katılım
26 Ağu 2021
Mesajlar
247
Tepkime puanı
124
Şehir
Yurtdışı
Kod Bana Aittir "Twitch Yayıncılarıyla Alakalı Bilgileri" Gösteren Bir Komuttur (İzinsiz Paylaşmayınız).
Kod Yapımcısı: Barış Özcan#0001
Diğer Modüller: Superagent
Kodlama Dili: Discord.js@v13 Sürümü "Slash Komuttur"


JavaScript:
const { CommandInteraction, MessageEmbed } = require("discord.js");
const superagent = require('superagent');

module.exports = {
    name: "twitch",
    description: "Twitch İstatistiklerini Gösterir",
    options: [
        {
            name: "user",
            description: "Bilgi alınacak kullanıcı",
            type: "STRING",
            required: true
        }
    ],
    /**
     *
     * @param {CommandInteraction} interaction
     * @param {Client} client
     */
    async execute(interaction) {
        const { options, member, guild, channel } = interaction;
        const channelName = options.getString("user");
        

        if(!channelName)
        return interaction.reply({content: "Lütfen bir Twitch kanal adı girin.", ephermeral: true});

        try {
            const Response = await  superagent.get(`https://api.crunchprank.net/twitch/followcount/${channelName.toLowerCase()}`);
            const upTime = await superagent.get(`https://api.crunchprank.net/twitch/uptime/${channelName.toLowerCase()}`);
            const totalViews = await superagent.get(`https://api.crunchprank.net/twitch/total_views/${channelName.toLowerCase()}`);
            const accountage = await superagent.get(`https://api.crunchprank.net/twitch/creation/${channelName.toLowerCase()}`);
            const lastGame = await superagent.get(`https://api.crunchprank.net/twitch/game/${channelName.toLowerCase()}`);


            const embed = new MessageEmbed()
            .setColor("#0099ff")
            .setTitle(`${channelName}'ın Twitch İstatistikleri`)
            .setDescription(`❣️ **Takipçiler**: ${Response.text} \n👀 **Görüntüleme**: ${totalViews.text}\n ⬆ **Yayın süresi**: ${upTime.text} \n📝 **Oluşturulma Tarihi**: ${accountage.text}  \n⏮️ **Son Oynadığı Oyun**: ${lastGame.text} \n🔴 **Yayın**: ${upTime.text}`)
            .setFooter(`${member.user.tag} tarafından talep edildi`, member.user.displayAvatarURL())
            .addField(`ㅤ`, `[**Destek**](https://discord.gg/invite-code)`)
            .setURL(`https://twitch.tv/${channelName}`)
            .setThumbnail("https://pngimg.com/uploads/twitch/twitch_PNG27.png")

            .setTimestamp()
            interaction.reply({embeds: [embed]});
            if (upTime.text === `${channelName} çevrimdışı`) {
                upTime.text = "Offline";
            }
            
        } catch (error) {
            console.error(error);
            return interaction.reply({content: "Twitch istatistikleri alınırken bir hata oluştu.", ephermeral: true});
        }
    }
}
 
  • Beğen
Tepkiler: slorixsh
slorixsh#6304
Katılım
24 Kas 2021
Mesajlar
140
Tepkime puanı
33
Şehir
İzmir
Kod Bana Aittir "Twitch Yayıncılarıyla Alakalı Bilgileri" Gösteren Bir Komuttur (İzinsiz Paylaşmayınız).
Kod Yapımcısı: Barış Özcan#0001
Diğer Modüller: Superagent
Kodlama Dili: Discord.js@v13 Sürümü "Slash Komuttur"


JavaScript:
const { CommandInteraction, MessageEmbed } = require("discord.js");
const superagent = require('superagent');

module.exports = {
    name: "twitch",
    description: "Twitch İstatistiklerini Gösterir",
    options: [
        {
            name: "user",
            description: "Bilgi alınacak kullanıcı",
            type: "STRING",
            required: true
        }
    ],
    /**
     *
     * @param {CommandInteraction} interaction
     * @param {Client} client
     */
    async execute(interaction) {
        const { options, member, guild, channel } = interaction;
        const channelName = options.getString("user");
       

        if(!channelName)
        return interaction.reply({content: "Lütfen bir Twitch kanal adı girin.", ephermeral: true});

        try {
            const Response = await  superagent.get(`https://api.crunchprank.net/twitch/followcount/${channelName.toLowerCase()}`);
            const upTime = await superagent.get(`https://api.crunchprank.net/twitch/uptime/${channelName.toLowerCase()}`);
            const totalViews = await superagent.get(`https://api.crunchprank.net/twitch/total_views/${channelName.toLowerCase()}`);
            const accountage = await superagent.get(`https://api.crunchprank.net/twitch/creation/${channelName.toLowerCase()}`);
            const lastGame = await superagent.get(`https://api.crunchprank.net/twitch/game/${channelName.toLowerCase()}`);


            const embed = new MessageEmbed()
            .setColor("#0099ff")
            .setTitle(`${channelName}'ın Twitch İstatistikleri`)
            .setDescription(`❣️ **Takipçiler**: ${Response.text} \n👀 **Görüntüleme**: ${totalViews.text}\n ⬆ **Yayın süresi**: ${upTime.text} \n📝 **Oluşturulma Tarihi**: ${accountage.text}  \n⏮️ **Son Oynadığı Oyun**: ${lastGame.text} \n🔴 **Yayın**: ${upTime.text}`)
            .setFooter(`${member.user.tag} tarafından talep edildi`, member.user.displayAvatarURL())
            .addField(`ㅤ`, `[**Destek**](https://discord.gg/invite-code)`)
            .setURL(`https://twitch.tv/${channelName}`)
            .setThumbnail("https://pngimg.com/uploads/twitch/twitch_PNG27.png")

            .setTimestamp()
            interaction.reply({embeds: [embed]});
            if (upTime.text === `${channelName} çevrimdışı`) {
                upTime.text = "Offline";
            }
           
        } catch (error) {
            console.error(error);
            return interaction.reply({content: "Twitch istatistikleri alınırken bir hata oluştu.", ephermeral: true});
        }
    }
}
Eline Sağlık. Yayıncılar beğendi bile :D
 
xlorienull#8543
Katılım
28 Ocak 2022
Mesajlar
39
Tepkime puanı
12
Şehir
Yurtdışı
Eline sağlık dostum. Baya kullanışlı ✌️
 
Calpim#0008
Katılım
4 Mar 2022
Mesajlar
1,723
Tepkime puanı
451
Şehir
Yurtdışı
Paylaşım için teşekkürler.🌈
 

Konuyu 1 kişi okuyor. (0 kayıtlı üye ve 1 ziyaretçi)

  • Bilgi