nyx/commands/Moderation/pin.js

22 lines
687 B
JavaScript
Raw Normal View History

2021-06-14 12:53:39 +02:00
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "pin",
usage: "(Message ID)",
description: "Pin a message in the server",
BotPerm: "MANAGE_MESSAGES",
UserPerm: "MANAGE_MESSAGES",
run: async (client, message, args) => {
if (!args[0]) return client.err(message, "Moderation", "pin", 27);
try {
const ch = message.guild.channels.cache.get(message.channel.id);
const msgs = await ch.messages.fetch(args[0]);
if (!msgs) return client.err(message, "Moderation", "pin", 52);
await msgs.pin();
} catch (e) {
console.log(e);
return client.err(message, "Moderation", "pin", 999);
}
},
};