Add banlist command

Shows a list of known items that can ban you on your Nintendo Switch™️
This commit is contained in:
Daniel 2021-11-03 17:56:10 -07:00
parent caa4556a77
commit b98a3d6e31
No known key found for this signature in database
GPG Key ID: 771601B78F6934C8

37
src/commands/banlist.ts Normal file
View File

@ -0,0 +1,37 @@
import Command from "../classes/Command";
import { config } from "../../config";
import fetch from "node-fetch";
import { Message } from "../../typings";
const discord_api = "https://discord.com/api/v9"
const getMessage = (channel_id, message_id) => {
return new Promise((resolve, reject) => {
fetch(`${discord_api}/channels/${channel_id}/messages/${message_id}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
authorization: `Bot ${process.env.bot_token || config.bot_token}`,
},
})
.then((r) => r.json())
.then(resolve)
.catch(reject)
})
}
const message_guild_id = "703301751171973190"
const message_channel_id = "703302552594284594"
const message_id = "824322420529823764"
export default new Command({
execute(interaction){
interaction.ack({ephemeral:false}).then(() => {
getMessage(message_channel_id, message_id).then((m) => {
interaction.reply({
content:`${(m as Message).content}\n\n[Jump to Message](https://discord.com/channels/${message_guild_id}/${message_channel_id}/${message_id})`
})
})
})
}
})