|
|
@@ -4,7 +4,7 @@ import messages from '../messages.json'; |
|
|
|
import { transferPin } from '../utils/common'; |
|
|
|
|
|
|
|
const pin = async ( |
|
|
|
message: Message, pinTextChannel: TextChannel, silent = false, |
|
|
|
message: Message, mainTextChannel: TextChannel, pinTextChannel: TextChannel, silent = false, |
|
|
|
): Promise<void> => { |
|
|
|
const isReply = message.type === 'REPLY'; |
|
|
|
if (!isReply) { |
|
|
@@ -12,6 +12,18 @@ const pin = async ( |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const authorMember = await message.guild?.members.fetch(message.author); |
|
|
|
if (!authorMember) { |
|
|
|
await message.reply(messages.INVALID_PERMISSIONS); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const authorCanPin = authorMember.permissionsIn(mainTextChannel).has('MANAGE_MESSAGES'); |
|
|
|
if (!authorCanPin) { |
|
|
|
await message.reply(messages.INVALID_PERMISSIONS); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const reply = await message.fetchReference(); |
|
|
|
await transferPin(reply, pinTextChannel, silent); |
|
|
|
await message.reply(messages.PIN_COMPLETE); |
|
|
|