Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: separate MESSAGE_CREATE fields from APIMessage object #434

Merged

Conversation

vvito7
Copy link
Contributor

@vvito7 vvito7 commented May 10, 2022

Please describe the changes this PR makes and why it should be merged:
Separates MESSAGE_CREATE and MESSAGE_UPDATE fields from APIMessage object.

If applicable, please reference Discord API Docs PRs or commits that influenced this PR:

@vladfrangu
Copy link
Member

Can you ensure the PR is up to date with the upstream PM? Let me know, and I'll merge it

deno/gateway/v10.ts Outdated Show resolved Hide resolved
@vvito7
Copy link
Contributor Author

vvito7 commented Jun 8, 2022

What do you think of transforming this (extra fields):

	/**
	 * ID of the guild the message was sent in
	 */
	guild_id?: Snowflake;
	/**
	 * Member properties for this message's author
	 *
	 * The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
	 * from text-based guild channels
	 *
	 * See https://discord.com/developers/docs/resources/guild#guild-member-object
	 */
	member?: APIGuildMember;
	/**
	 * Users specifically mentioned in the message
	 *
	 * The `member` field is only present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
	 * from text-based guild channels
	 *
	 * See https://discord.com/developers/docs/resources/user#user-object
	 * See https://discord.com/developers/docs/resources/guild#guild-member-object
	 */
	mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];

into an interface? Since we are using it twice, in the create and update event.

And also, should this kind of comment "The member object exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels" be keep in both tables? For example the mentions field.

@vercel
Copy link

vercel bot commented Jun 8, 2022

@vvito7 is attempting to deploy a commit to the Sapphire Team on Vercel.

A member of the Team first needs to authorize it.

@vladfrangu
Copy link
Member

into an interface? Since we are using it twice, in the create and update event.

sure

And also, should this kind of comment "The member object exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels" be keep in both tables? For example the mentions field.

Sure

@vvito7
Copy link
Contributor Author

vvito7 commented Jun 8, 2022

Can you ensure the PR is up to date with the upstream PM? Let me know, and I'll merge it

Hopefully everything is ok now

@vladfrangu vladfrangu changed the title refactor: separete MESSAGE_CREATE fields from APIMessage object refactor: separate MESSAGE_CREATE fields from APIMessage object Jun 8, 2022
@vladfrangu vladfrangu merged commit 0bb2204 into discordjs:main Jun 8, 2022
@vvito7 vvito7 deleted the separate-msg-obj-from-message-create-event branch June 8, 2022 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants