Use message.create
This commit is contained in:
parent
38216b26bd
commit
0fb3306a25
@ -467,6 +467,7 @@ router.post(
|
|||||||
member_id: message.member_id,
|
member_id: message.member_id,
|
||||||
author_id: message.author_id
|
author_id: message.author_id
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
message.save(),
|
message.save(),
|
||||||
emitEvent({
|
emitEvent({
|
||||||
|
|||||||
@ -256,7 +256,7 @@ export class Message extends BaseClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async createWithDefaults(opts: Partial<Message>): Promise<Message> {
|
static async createWithDefaults(opts: Partial<Message>): Promise<Message> {
|
||||||
const message = new Message();
|
const message = Message.create();
|
||||||
|
|
||||||
if (!opts.author) {
|
if (!opts.author) {
|
||||||
if (!opts.author_id) throw new Error("Either author or author_id must be provided to create a Message");
|
if (!opts.author_id) throw new Error("Either author or author_id must be provided to create a Message");
|
||||||
|
|||||||
Reference in New Issue
Block a user