pyhoneybot / honeybot

🛩 A python IRC bot with simple plugins dev. Ignited in mauritius, first-timers friendly!
https://pyhoneybot.github.io/honeybot-store/
MIT License
78 stars 88 forks source link

improved structure and readability of main.py #196

Closed AnastasiosZyngiridis closed 1 year ago

AnastasiosZyngiridis commented 1 year ago

1.Removed unnecessary import statements (import sys, import shutil, import getpass).

2.Encapsulated the code inside the BotCore class to provide better organization and encapsulation.

3.Replaced hardcoded configuration values with variables (self.server_url, self.port, self.name, etc.).

4.Utilized the os.path module for path-related operations instead of manually concatenating strings.

5.Updated the logging statements to use the logger instance.

6.Refactored the message_info method to handle exceptions and return a dictionary with all fields set to prevent None values.

7.Updated the methods method to return a dictionary of method references.

8.Added docstrings to functions and methods.

9.Fixed the indentation of the code to conform to Python style guidelines.

10.Replaced the print statements with logger statements for consistent logging.

11.Modified the load_plugins_from_folder method to handle different sources of plugin names (from configuration file or directory) and log errors appropriately.

12.Updated the load_plugins method to load plugins from the specified folders.

13.Refactored the run_plugins method to use the loaded plugins and pass the necessary arguments to the plugin's run method.

14.Renamed command_parser method to core_commands_parse for clarity.

15.Removed unused methods and variables (self.sp_command, self.core_plugins, pull).

16.Added missing exception handling in the quit method.

17.Cleaned up the code formatting and removed unnecessary comments.

Description

How Has This Been Tested?

Additional context

Add any other context or screenshots about the pull request here.

Checklist

Code of Conduct

By submitting this issue, you agree to follow our Code of Conduct