Skip to content

Conversation

@robobenklein
Copy link

Made this modification for a project I'm working on.

Purely feature-enabling, does not change any behaviour if feature is not used.

Copy link
Owner

@bernardopires bernardopires left a comment

Choose a reason for hiding this comment

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

Thanks for the patch, this is a great feature!

db_logger.py Outdated

try:
self.cursor.execute("INSERT INTO chat_log (sender, message, channel, date) VALUES (%s, %s, %s, %s)",
if self.senders_whitelist is not None and sender in self.senders_whitelist:
Copy link
Owner

Choose a reason for hiding this comment

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

if (self.senders_whitelist is not None and sender in self.senders_whitelist) or (self.senders_whitelist is None):

db_logger.py Outdated
if self.senders_whitelist is not None and sender in self.senders_whitelist:
self.cursor.execute("INSERT INTO chat_log (sender, message, channel, date) VALUES (%s, %s, %s, %s)",
(sender, message, channel, current_time_in_milli()))
elif self.senders_whitelist is None:
Copy link
Owner

Choose a reason for hiding this comment

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

Delete this and the next line

manager.py Outdated
self.log_filename = log_filename
self.channels = channels
self.db_logger = DatabaseLogger(settings.DATABASE['HOST'],
if settings.USERS is not None and len(settings.USERS) is not 0:
Copy link
Owner

Choose a reason for hiding this comment

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

You do not need this if condition here. If settings.USERS is None, it will do exactly what it should.

manager.py Outdated
settings.IRC['PASSWORD'],
self.log_filename)
bot_db_logger = DatabaseLogger(settings.DATABASE['HOST'],
if settings.USERS is not None and len(settings.USERS) is not 0:
Copy link
Owner

Choose a reason for hiding this comment

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

Same comment as above.

users = [] now valid for no users
@robobenklein
Copy link
Author

This is working for me. Let me know if any other changes are needed.

Copy link
Owner

@bernardopires bernardopires left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in the review! These should be simple fixes and then I'll merge it. Thanks again!

manager.py Outdated
self.log_filename = log_filename
self.channels = channels
self.db_logger = DatabaseLogger(settings.DATABASE['HOST'],
if settings.USERS is not None:
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry I should have been more explicit here. You don't actually need the if here (neither the else and the contents inside it). In case settings.USERS is None, you will automatically be passing None as the last argument as well.

settings.IRC['PASSWORD'],
self.log_filename)
bot_db_logger = DatabaseLogger(settings.DATABASE['HOST'],
if settings.USERS is not None:
Copy link
Owner

Choose a reason for hiding this comment

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

Same comment as above.

Also forgot some formatting below...
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.

3 participants