Skip to content
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

Accessing/editing command module properties on the spot #29

Closed
Vistril opened this issue Aug 7, 2018 · 3 comments
Closed

Accessing/editing command module properties on the spot #29

Vistril opened this issue Aug 7, 2018 · 3 comments
Labels

Comments

@Vistril
Copy link

Vistril commented Aug 7, 2018

I tried to edit a command module by adding another alias.
The first thing I did was go into the commandHandler object
const h = this.client.commandHandler.modules.map(e => e); const cmd = h[9]; cmd['aliases'].push('alias2');
The new aliases does get pushed, but the handler doesn't seem to use it. So then, I tried reloading after and the result of that was very, very confusing.
Input ->
const h = this.client.commandHandler.modules.map(e => e); const cmd = h[9]; cmd['aliases'].push('stats'); cmd.reload()
Output ->
> dice
"dice" is a completely different command module, and it didn't work there afterwards either.
Since Akairo is as modular as it is, could you just make another listener for new aliases to be added?

@1Computer1
Copy link
Member

Reloading is not for in-memory changes, but for physical code changes. Adding a new alias like that will not work. The correct way to do it would be to do handler.aliases.set('alias', command).

@1Computer1
Copy link
Member

Also, I recommend you to look at the register and deregister methods on CommandHandler. They may be of use, but this all seems like a very strange problem to have in the first place.

@Vistril
Copy link
Author

Vistril commented Aug 7, 2018

Hmm, alright

cataclym pushed a commit to cataclym/discord-akairo that referenced this issue Apr 15, 2021
Fix to Tinder reset time and Emotecount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants