-
Notifications
You must be signed in to change notification settings - Fork 25
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
Guild log #192
Guild log #192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few things to note if you could please change...
Also please note the Angular Commit Convention for commit messages and their types |
], | ||
}, | ||
run: async (bot, interaction, args) => { | ||
const member: string = args[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity, prefer the as
keyword for casts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript contains an as
keyword to 'cast' types (or at least the language's type coverage) from one type to another. Here args
is of type any[]
, meaning its items could be any type, but really we know one is a string, and one is a number.
So, to make it more clear that you're actually casting the variables, and not just explicitly typing them for no reason, you could use something like the following:
const member = args[0] as string;
const member: string = args[0]; | ||
const page: number = args[1]; | ||
|
||
if ((member && page) == undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if this is the intention, but this statement is not the same as member == undefined && page == undefined
. Regardless, might be best to rewrite this with an or statement if that's what you're going for
Please also use triple equality (===
) where possible.
const regex = | ||
/(([A-Za-z]{3}\s[0-9]{1,2}\s[0-9]{4})\s(([0-9]{2}):([0-9]{2}))\s((EDT|EST): ))([A-Za-z-0-9-_]{2,27})\s(joined|left|invited|kicked)(?:\s)?([A-Za-z-0-9-_]{2,27})?(?:\s)?([A-Za-z-0-9-\\!-_-\s]+)?/; | ||
|
||
bot.mineflayer.on( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chat listener and the one below have no timeout to remove them if the full message is not captured. See the Bot
class for an example
No description provided.