如何制作 Geo IP 查找命令?
How to make Geo IP lookup command?
我目前正在研究通过 JSON Api 查找 IP 的命令。
我想让输出更易于阅读,换句话说,我的问题是格式。
组织:Cloudflare
城市:CityNameHere
国家:澳大利亚
地区:昆士兰
ISP:Cloudflare DNS 解析器
时区:Aus/Bris
状态:成功。
我当前的代码:
const Discord = require("discord.js");
const snekfetch = require('snekfetch');
module.exports = (client, message,args) => {
snekfetch.get(`http://ip-api.com/json/${args}` ).then(r => {
var string =JSON.stringify(r.body);
let Geo = new Discord.RichEmbed()
.setTimestamp()
.setThumbnail(`https://image.ibb.co/kcFJ09/resolver.png`)
.setTitle(`**Deluxo Puller - GeoIP Lookup**`)
.setDescription(`**__GeoIP Lookup Information__**\n**Looked Up IP**: ${args}\n${string}`)
.setFooter(`Resolved By: ${message.author.tag}`)
message.channel.send({embed: Geo})
这是结果:
http://prntscr.com/knz47k
非常感谢任何帮助。
r.body
已经是一个对象,所以只需在其上使用属性即可。在此示例中,我显示了 IP 地址的 ASN 和城市。您可以根据需要添加。
snekfetch.get(`http://ip-api.com/json/${args}`).then(r => {
let Geo = new Discord.RichEmbed()
.setTimestamp()
.setThumbnail(`https://image.ibb.co/kcFJ09/resolver.png`)
.setTitle(`**Deluxo Puller - GeoIP Lookup**`)
.setDescription(`**__GeoIP Lookup Information__**
**Looked Up IP**: ${args}
**ASN**: ${r.body.as}
**City**: ${r.body.city}`)
.setFooter(`Resolved By: ${message.author.tag}`);
message.channel.send({ embed: Geo });
});
我目前正在研究通过 JSON Api 查找 IP 的命令。 我想让输出更易于阅读,换句话说,我的问题是格式。
组织:Cloudflare
城市:CityNameHere
国家:澳大利亚
地区:昆士兰
ISP:Cloudflare DNS 解析器
时区:Aus/Bris
状态:成功。
我当前的代码:
const Discord = require("discord.js");
const snekfetch = require('snekfetch');
module.exports = (client, message,args) => {
snekfetch.get(`http://ip-api.com/json/${args}` ).then(r => {
var string =JSON.stringify(r.body);
let Geo = new Discord.RichEmbed()
.setTimestamp()
.setThumbnail(`https://image.ibb.co/kcFJ09/resolver.png`)
.setTitle(`**Deluxo Puller - GeoIP Lookup**`)
.setDescription(`**__GeoIP Lookup Information__**\n**Looked Up IP**: ${args}\n${string}`)
.setFooter(`Resolved By: ${message.author.tag}`)
message.channel.send({embed: Geo})
这是结果: http://prntscr.com/knz47k
非常感谢任何帮助。
r.body
已经是一个对象,所以只需在其上使用属性即可。在此示例中,我显示了 IP 地址的 ASN 和城市。您可以根据需要添加。
snekfetch.get(`http://ip-api.com/json/${args}`).then(r => {
let Geo = new Discord.RichEmbed()
.setTimestamp()
.setThumbnail(`https://image.ibb.co/kcFJ09/resolver.png`)
.setTitle(`**Deluxo Puller - GeoIP Lookup**`)
.setDescription(`**__GeoIP Lookup Information__**
**Looked Up IP**: ${args}
**ASN**: ${r.body.as}
**City**: ${r.body.city}`)
.setFooter(`Resolved By: ${message.author.tag}`);
message.channel.send({ embed: Geo });
});