Created
March 8, 2020 17:30
-
-
Save zero734kr/218f27185a5370cf009d9b287eb09c73 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
//... | |
client.on("message", async message => { | |
//if(...) return 설정들 | |
/** | |
* 아래 두개의 선언이 뭘 하는것인지 알고 싶으시다면: | |
* @see https://github.com/Zero-Brazil734/discord.js-bot-index/blob/master/index.js#L22 | |
* */ | |
const args = message.content.slice("접두사".length).trim().split(/ +/g) | |
const command = args.shift().toLowerCase() | |
if(command === "docs") { | |
let query = args.join(" ") | |
if (!query) return message.channel.send(`${message.author} 님, 검색할 키워드를 입력 해주세요.`) | |
const body = await require("node-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) | |
} | |
}) | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment