Skip to content

Commit

Permalink
fix(utils): default parameters should be placed after non-default ones (
Browse files Browse the repository at this point in the history
#55)

Fixes #53 

---

<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>

> ## TL;DR
> This pull request swaps the order of the `guildId` and `roleId` parameters in the `modifyUserRole` function in `Utils.ts`.
> 
> ## What changed
> In the `modifyUserRole` function, the `guildId` parameter was previously set to default to `SUPPORT_SERVER_ID` if no value was provided. This parameter was placed before the `roleId` parameter. This order has been swapped in this pull request, so now `roleId` comes before `guildId`.
> 
> ```diff
> -  guildId: Snowflake = SUPPORT_SERVER_ID,
>    roleId: Snowflake,
> +  guildId: Snowflake = SUPPORT_SERVER_ID,
> ```
> 
> ## How to test
> To test this change, call the `modifyUserRole` function with various combinations of parameters. Ensure that the function behaves as expected when `guildId` is not provided, and that it correctly uses the provided `roleId`.
> 
> ## Why make this change
> This change improves the readability and usability of the `modifyUserRole` function. By placing the `roleId` parameter before the `guildId` parameter, it is clearer that `roleId` is a required parameter, while `guildId` is optional and will default to `SUPPORT_SERVER_ID` if not provided. This makes the function easier to use and understand.
</details>
  • Loading branch information
dev-737 authored Mar 17, 2024
1 parent 1a45f96 commit 17e9900
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ export const modifyUserRole = async (
cluster: ClusterClient<Client> | ClusterManager,
action: 'add' | 'remove',
userId: Snowflake,
guildId: Snowflake = SUPPORT_SERVER_ID,
roleId: Snowflake,
guildId: Snowflake = SUPPORT_SERVER_ID,
) => {
await cluster.broadcastEval(
async (client, ctx) => {
Expand Down

0 comments on commit 17e9900

Please sign in to comment.