enforce the rights
This commit is contained in:
parent
627e06f783
commit
75e546cf72
@ -7,6 +7,7 @@ import {
|
||||
MessageCreateEvent,
|
||||
MessageUpdateEvent,
|
||||
getPermission,
|
||||
getRights,
|
||||
CHANNEL_MENTION,
|
||||
Snowflake,
|
||||
USER_MENTION,
|
||||
@ -61,9 +62,10 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
|
||||
throw new HTTPError("Content length over max character limit")
|
||||
}
|
||||
|
||||
// TODO: are tts messages allowed in dm channels? should permission be checked?
|
||||
if (opts.author_id) {
|
||||
message.author = await User.getPublicUser(opts.author_id);
|
||||
const rights = await getRights(opts.author_id);
|
||||
rights.hasThrow("SEND_MESSAGES");
|
||||
}
|
||||
if (opts.application_id) {
|
||||
message.application = await Application.findOneOrFail({ id: opts.application_id });
|
||||
|
Loading…
x
Reference in New Issue
Block a user