This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added
KlasaClient#settingsSync
event. (#475)
* feat: Added `KlasaClient#settingsSyncEntry` event. * docs: Correct PR number in CHANGELOG * src: Emit settingsSyncEntry on broadcastEval * fix: Entry settings not setting their existence status to true in shards * misc: Renamed `KlasaClient#{settingsUpdateEntry,settingsDeleteEntry,settingsCreateEntry}` to `KlasaClient#{settingsUpdate,settingsDelete,settingsCreate}`. * misc: Rename prefix settingsUpdate core event to... coreSettingsUpdate * fix: coreSettingsUpdate is not an once event
- Loading branch information
Showing
9 changed files
with
59 additions
and
38 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
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
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,29 @@ | ||
const { Event } = require('klasa'); | ||
const gateways = ['users', 'clientStorage']; | ||
|
||
module.exports = class extends Event { | ||
|
||
constructor(...args) { | ||
super(...args, { event: 'settingsUpdate' }); | ||
} | ||
|
||
run(settings) { | ||
if (this.client.shard && gateways.includes(settings.gateway.name)) { | ||
this.client.shard.broadcastEval(` | ||
if (this.shard.id !== ${this.client.shard.id}) { | ||
const entry = this.gateways.get('${settings.gateway.name}').get('${settings.id}'); | ||
if (entry) { | ||
entry._patch(${JSON.stringify(settings)}); | ||
entry.existenceStatus = true; | ||
this.emit('settingsSync', settings); | ||
} | ||
} | ||
`); | ||
} | ||
} | ||
|
||
init() { | ||
if (!this.client.shard) this.disable(); | ||
} | ||
|
||
}; |
This file was deleted.
Oops, something went wrong.
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
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
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
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
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