dirigeants / klasa-pieces

MIT License
44 stars 55 forks source link

fix(channelname,rolename): Fixed "this" references #212

Closed favna closed 5 years ago

favna commented 5 years ago

The channelname and rolename pieces were still referencing incorrect properties with "this.roles" and "this.channels". These were artifacts from https://github.com/dirigeants/klasa-pieces/commit/ef1c5ec4c41af4170daf15dd339640d6e0ccc592#diff-166a9a8e960a7d804797c9b584d3640f

Ref: This Discord conversation:

[22:28] Favna: related question to the one before, I see in the channelname and rolename argument pieces respectively this.channel and this.role being used (https://github.com/dirigeants/klasa-pieces/blob/590238bf0a90ab83f79f31ff8e453bbfc2bed3a9/arguments/channelname.js#L17), but at least according to the docs and the typings Argument class doesn't seem to have such properties nor support type generics so I'm assuming those this references are wrong, or the typings are incorrect. 

Which is it and if it's the former then what is the correct code? I previously assumed this.store.get('channel').run(arg, possible, msg) but now I'm doubting.

Not to mention that and the fact that I find it odd anyway that the role and channel pieces aren't throwing after the if (!msg.guild) check like the membername one is which would make sense since there are no roles or channels outside guilds barring DM channels
[22:39] Mr. Ao: oh you are right, looks like @Aryk messed up this commit: https://github.com/dirigeants/klasa-pieces/commit/ef1c5ec4c41af4170daf15dd339640d6e0ccc592#diff-166a9a8e960a7d804797c9b584d3640f
[22:40] Mr. Ao: it should be this.store.get(theRegularArgument).run(...stuff)
[22:40] Favna: bug busting first day i'm on this lib. wew :wink:
[22:40] Favna: thanks!
[22:41] Mr. Ao: I am not sure how much people use those on klasa-pieces
[22:41] Favna: I suppose it's an advantage of writing in TS. It screamed in my face when trying this.roles heh
[22:41] Mr. Ao: indeed
[22:42] Mr. Ao: you want to make a pr, or should I?
[22:43] Favna: I can do it