Created
March 8, 2020 17:22
-
-
Save zero734kr/453e6dccc627fbcf258c0598b5dfc0bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Command = require("../utils/command") | |
const fetch = require("node-fetch") | |
class Docs extends Command { | |
constructor(client) { | |
super(client) | |
this.name = "docs" | |
this.aliases = ["doc", "djs"] | |
this.category = "개발" | |
this.description = "discord.js 모듈의 문서를 확인합니다." | |
this.usage = "docs [code]" | |
this.dir = __filename | |
this.allowDM = true | |
this.perm = 3 | |
} | |
async run(message, args) { | |
let query = args.join(" ") | |
if (!query) return message.channel.send(`${message.author} 님, 검색할 키워드를 입력 해주세요.`) | |
const body = await fetch(`https://djsdocs.sorta.moe/v2/embed?src=https://raw.githubusercontent.com/discordjs/discord.js/docs/stable.json&q=${encodeURI(query)}`).then(res => res.json()) | |
if (!body) return message.channel.send(`${message.author} 님, 검색 결과가 없습니다.`) | |
body.author = { name: "Discord.js Docs - [stable]" } | |
const embed = new (require("discord.js").MessageEmbed)(body) | |
embed.setFooter(message.author.tag, message.author.avatarURL({ format: "png" })) | |
message.channel.send(embed) | |
} | |
} | |
module.exports = Docs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment