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

Guild log #192

Closed
wants to merge 7 commits into from
Closed

Guild log #192

wants to merge 7 commits into from

Conversation

Vliegenier04
Copy link
Member

No description provided.

@jejebecarte jejebecarte self-requested a review January 6, 2024 11:11
Copy link
Member

@jejebecarte jejebecarte left a 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...

src/commands/guildLog.ts Show resolved Hide resolved
src/commands/guildLog.ts Outdated Show resolved Hide resolved
src/commands/guildLog.ts Outdated Show resolved Hide resolved
src/commands/guildLog.ts Show resolved Hide resolved
@jejebecarte
Copy link
Member

Also please note the Angular Commit Convention for commit messages and their types

],
},
run: async (bot, interaction, args) => {
const member: string = args[0];
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain?

Copy link
Member

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) {
Copy link
Member

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(
Copy link
Member

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

src/commands/guildLog.ts Show resolved Hide resolved
@jejebecarte jejebecarte deleted the guild-log branch May 7, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants