needs testing

This commit is contained in:
Skillz
2020-11-16 22:20:06 -05:00
parent 5b3ccbad24
commit a1832f3721
4 changed files with 32 additions and 1 deletions
+18 -1
View File
@@ -182,6 +182,17 @@ export async function sendMessage(
content.mentions.roles = content.mentions.roles.slice(0, 100);
}
}
if (content.mentions.repliedUser) {
if (
!(await botHasChannelPermissions(
channelID,
[Permissions.READ_MESSAGE_HISTORY],
))
) {
throw new Error(Errors.MISSING_SEND_MESSAGES);
}
}
}
const channel = await cacheHandlers.get("channels", channelID);
@@ -197,7 +208,13 @@ export async function sendMessage(
endpoints.CHANNEL_MESSAGES(channelID),
{
...content,
allowed_mentions: content.mentions,
allowed_mentions: content.mentions
? {
...content.mentions,
replied_user: content.mentions.repliedUser === true,
}
: undefined,
message_reference: content.replyMessageID,
},
);