[英]how to grab the name and picture of a discord server in discord.js
如果您使用 discord.js 您可以簡單地使用<Client>.fetchInvite()
:
const client = <Client>
client.fetchInvite(invite_url)
.then(console.log);
這將返回一個 Invite 實例:
https://discord.js.org/#/docs/main/stable/class/Invite
之后只需通過.guild
訪問公會:
const client = <Client>
client.fetchInvite(invite_url)
.then(inv => {
console.log(inv.guild);
console.log(inv.guild.name, inv.guild.iconURL());
});
If you want to use https://discordapp.com/api/v6/invites/H4ySkbn
just fetch the link with axios or node-fetch resolve it in JSON and then access the properties there, but in that case the icon url will be一個 hash
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.