-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support new options structure !!BREAKING CHANGES (#12)
* feat: support new options structure Introduce a new structure for the manager's options Fixes #10 * docs: update example's options & remove some errorMessages * fix: options not being stored in the manager * refactor: use string enum * fix: import ErrorMessage should be default * fix: typo * chore: properly increase package version Due to breaking changes in this new version, a major release is necessary * use coma instead of semicolon * chore: add build workflow * fix: properly export ErrorMessages enum
- Loading branch information
Showing
45 changed files
with
872 additions
and
857 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
concurrency: ci-${{ github.ref }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,11 @@ | ||
# Breaking Changes | ||
|
||
## Support for Discord.js v14 | ||
## Rework of the entire options parameter | ||
|
||
The entire library has been ported to djs v14. | ||
The option parameter is now fully supporting different guilds. The changes made are structural but some renaming also occured. | ||
|
||
## MailboxManager class | ||
It is strongly advised to revise the entire options you are passing to the manager and restructure it with the new type accessible [here](./src/types/ManagerOptions.ts). | ||
|
||
The mailbox manager becomes a real tickets manager. It now only handles user tickets. | ||
|
||
## Format Title parameter | ||
|
||
The `options#formatTitle` method does not take the id as a parameter anymore, but directly relies on a [Ticket](./src/types/Ticket.ts) instance. | ||
|
||
```ts | ||
// before | ||
function formatTitle(id: string): string { | ||
return `Ticket ${id}`; | ||
} | ||
|
||
// after | ||
function formatTitle(ticket: Ticket, guild: Guild): string { | ||
return `Ticket ${ticket.id} - ${guild.name}`; | ||
} | ||
``` | ||
|
||
## ticketDelete event disappears | ||
|
||
This event was initially created to let the user know a ticket has been internally deleted but this information should not be shared outside the system through a different event than `ticketClose`. | ||
It has thus been removed. | ||
|
||
## loggingOptions#format Changes | ||
|
||
The format function supposed to format each message of a ticket has changed. The whole signature actually got updated: | ||
```ts | ||
// before | ||
|
||
loggingOptions: { | ||
... | ||
format: (message: Message) => `${message.author.username} sent: ${message.cleanContent}`, | ||
... | ||
} | ||
|
||
// after | ||
loggingOptions: { | ||
... | ||
generateLogEntry: (ticketContent: TicketContent) => `${ticketContent.author.username} sent: ${ticketContent.cleanContent}`, | ||
... | ||
} | ||
``` | ||
|
||
## loggingOptions#showNames Rename | ||
|
||
The `showName` property of the logging options has been renamed to `showSenderNames` for more clarity on its meaning. | ||
|
||
## options#closeTicketAfter Unit Change | ||
|
||
The `closeTicketAfter` was initially in seconds. It is now in milliseconds. | ||
|
||
## options#closeTicketAfter Rename | ||
|
||
The `closeTicketAfter` property of the options has been renamed to `closeTicketAfterInMilliseconds` for more clarity on its unit. | ||
|
||
## options#notAllowedToPing Removal | ||
|
||
The `notAllowedToPing` property of the options has been removed. You should handle this using your client's options (property is called `allowedMentions`). | ||
|
||
## options#autoReplyMessage Removal | ||
|
||
The `autoReplyMessage` property of the options has been removed. You should use `ticketCreate` event to handle such side-effect. | ||
|
||
## options#replyMessageInFooter Removal | ||
|
||
The `replyMessageInFooter` property of the options has been removed. The footer is forced. | ||
|
||
## options#ticketClose Removal | ||
|
||
The `ticketClose` property of the options has been removed. You should use `ticketClose` event to handle such side-effect. | ||
|
||
## embedOptions#send Removal | ||
|
||
The `send` property of the embed options has been removed. Once an EmbedOptions object is found, the embed feature is used instead of standard messages. | ||
|
||
## options#deleteReplies Removal | ||
|
||
The `deleteReplies` property of the options has been removed. It actually is misleading to end users (staff members responding to messages). | ||
If you want to still use it, you can perform the same action through the `replySent` event. | ||
|
||
## replyDelete event disappears | ||
|
||
This event was initially created to let the user know a replt has been deleted but the deletion behaviour has ben removed so thus event has no purpose anymore. | ||
It has thus been removed. | ||
|
||
## options#sendToRecipient Removal | ||
|
||
The `sendToRecipient` property of the options has been removed. Indeed, users have the fundamental right to receive and keep a copy of the conversation with anyone. | ||
|
||
## options#mailboxChannel Removal | ||
|
||
The `mailboxChannel` property has been removed in profit of a `mailboxChannels` property to enable the management of several guilds by a single manager. | ||
|
||
## options#loggingOptions#channel Removal | ||
|
||
The `channel` property of the `loggingOptions` property has been removed in profit of a `channels` property to enable the management of several guilds by a single manager. | ||
## Error messages have now error codes | ||
|
||
The error messages now have error codes from 001 to 0006. You can inspect these directly [in the source code](./src/ErrorMessages.ts). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.