Advertisement
Bangh

Weather Parancs

Nov 19th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. const Discord = require('discord.js')
  2. const weather = require('weather-js')
  3.  
  4. exports.run = async (client, message, args) => {
  5.  
  6. weather.find({search: args.join(" "), degreeType: 'C'}, function(err, result) {
  7. if (err) message.channel.send(err);
  8.  
  9.  
  10. if (result.length === 0) {
  11. message.channel.send('**Kérlek adj meg egy valós települést.**')
  12. return;
  13. }
  14.  
  15.  
  16. var current = result[0].current;
  17. var location = result[0].location;
  18.  
  19.  
  20. const embed = new Discord.RichEmbed()
  21. embed.setDescription(`**${current.skytext}**`)
  22. embed.setAuthor(`${current.observationpoint} Időjárása`)
  23. embed.setThumbnail(current.imageUrl)
  24. embed.setColor(0x00AE86)
  25. embed.addField('Időzóna',`UTC${location.timezone}`, true)
  26. embed.addField('Fok',location.degreetype, true)
  27. embed.addField('Hőmérséklet',`${current.temperature} Fok`, true)
  28. embed.addField('Szél-sebesség',current.winddisplay, true)
  29. embed.addField('Páratartalom', `${current.humidity}%`, true)
  30.  
  31.  
  32. message.channel.send({embed});
  33. });
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement