- Katılım
- 4 Nis 2023
- Konular
- 1
- Mesajlar
- 4
- Tepki puanı
- 0
- Puanları
- 705
const Discord = require('discord.js');
const weather = require('weather-js'); // weather-js kütüphanesini kullanmak için
exports.run = (client, message, args) => {
// Komutun kullanımını kontrol et
if (!args[0]) {
return message.channel.send('Lütfen bir şehir adı belirtin.');
}
// weather-js ile hava durumu bilgisini al
weather.find({ search: args.join(' '), degreeType: 'C' }, function (error, result) {
if (error) {
return message.channel.send('Hava durumu bilgileri alınamadı.');
}
// Hava durumu bilgilerini mesaj olarak gönder
const current = result[0].current;
const location = result[0].location;
const weatherEmbed = new Discord.MessageEmbed()
.setTitle(`Hava Durumu: ${location.name}`)
.setDescription(`${current.skytext}`)
.addField('Sıcaklık', `${current.temperature} °C`, true)
.addField('Hissedilen Sıcaklık', `${current.feelslike} °C`, true)
.addField('Rüzgar', `${current.winddisplay}`, true)
.addField('Nem', `${current.humidity}%`, true)
.setThumbnail(current.imageUrl);
message.channel.send(weatherEmbed);
});
};
exports.conf = {
aliases: ['havadurumu', 'hava'],
permLevel: 0,
kategori: 'Genel',
};
exports.help = {
name: 'havadurumu',
description: 'Belirtilen şehirin hava durumunu gösterir.',
usage: 'havadurumu <şehir>',
};
const weather = require('weather-js'); // weather-js kütüphanesini kullanmak için
exports.run = (client, message, args) => {
// Komutun kullanımını kontrol et
if (!args[0]) {
return message.channel.send('Lütfen bir şehir adı belirtin.');
}
// weather-js ile hava durumu bilgisini al
weather.find({ search: args.join(' '), degreeType: 'C' }, function (error, result) {
if (error) {
return message.channel.send('Hava durumu bilgileri alınamadı.');
}
// Hava durumu bilgilerini mesaj olarak gönder
const current = result[0].current;
const location = result[0].location;
const weatherEmbed = new Discord.MessageEmbed()
.setTitle(`Hava Durumu: ${location.name}`)
.setDescription(`${current.skytext}`)
.addField('Sıcaklık', `${current.temperature} °C`, true)
.addField('Hissedilen Sıcaklık', `${current.feelslike} °C`, true)
.addField('Rüzgar', `${current.winddisplay}`, true)
.addField('Nem', `${current.humidity}%`, true)
.setThumbnail(current.imageUrl);
message.channel.send(weatherEmbed);
});
};
exports.conf = {
aliases: ['havadurumu', 'hava'],
permLevel: 0,
kategori: 'Genel',
};
exports.help = {
name: 'havadurumu',
description: 'Belirtilen şehirin hava durumunu gösterir.',
usage: 'havadurumu <şehir>',
};