Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Abstract the message object #20

Open
tristancamejo opened this issue Apr 20, 2022 · 1 comment
Open

Abstract the message object #20

tristancamejo opened this issue Apr 20, 2022 · 1 comment

Comments

@tristancamejo
Copy link
Contributor

tristancamejo commented Apr 20, 2022

Without abstraction it looks like this

client.on('message', (message: Message) => {
	if (message.content === 'test message')
		void message.reply({
			content: 'pong!'
		});

	if (message.content === 'test embed')
		void message.reply({
			embeds: [
				{
					description: 'hey an embed'
				}
			],
			allowed_mentions: {
				roles: ['id']
			}
		});
});

I'm wondering if we want to follow the api's snake_case conventions considering this is a JS library or if we want to further abstract it and handle converting the properties ourselves (user types camelCased properties and we convert it to snake_case). Just a thought though because using the raw API does make this a lot simpler.

Originally posted by @Nciklol in #18 (comment)

@megatank58
Copy link
Contributor

JS libraries generally use camelCase instead of snake_case but i perhaps we could modify REST to convert camelCase types automatically to snake_cased one

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants