Skip to content

fix: keep symbols in actions manager #9301

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion scripts/generateRequires.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ async function writeWebsocketHandlerImports() {
}

async function writeClientActionImports() {
const lines = ["'use strict';\n", 'class ActionsManager {', ' constructor(client) {', ' this.client = client;\n'];
const lines = [
"'use strict';\n",
'class ActionsManager {',
' constructor(client) {',
' this.client = client;\n',
' // These symbols represent fully built data that we inject at times when calling actions manually.',
' // Action#getUser for example, will return the injected data (which is assumed to be a built structure)',
' // instead of trying to make it from provided data',
" this.injectedUser = Symbol('djs.actions.injectedUser');",
" this.injectedChannel = Symbol('djs.actions.injectedChannel');",
" this.injectedMessage = Symbol('djs.actions.injectedMessage');\n",
];

const actionsDirectory = new URL('../src/client/actions', import.meta.url);
for (const file of (await readdir(actionsDirectory)).sort()) {
Expand Down
6 changes: 3 additions & 3 deletions src/client/actions/ActionsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class ActionsManager {
constructor(client) {
this.client = client;

// These symbols represent fully built data that we inject at times when calling actions manually. Action#getUser,
// for example, will return the injected data (which is assumed to be a built structure) instead of trying to make
// it from provided data
// These symbols represent fully built data that we inject at times when calling actions manually.
// Action#getUser, for example, will return the injected data (which is assumed to be a built structure)
// instead of trying to make it from provided data
this.injectedUser = Symbol('djs.actions.injectedUser');
this.injectedChannel = Symbol('djs.actions.injectedChannel');
this.injectedMessage = Symbol('djs.actions.injectedMessage');
Expand Down