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

♻️ Refactor the Baseplugin #595

Open
mraniki opened this issue Jul 23, 2023 · 0 comments
Open

♻️ Refactor the Baseplugin #595

mraniki opened this issue Jul 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@mraniki
Copy link
Owner

mraniki commented Jul 23, 2023

# def should_handle(self, message):
#     if not self.enabled:
#         return False
#     if message.startswith(settings.bot_ignore):
#         return False
#     return True

# async def handle_message(self, msg):
#     if not self.should_handle(msg):
#         return

#     command, *args = msg.split(" ")
#     command = command[1:]

#     command_mapping = self.get_command_mapping()

#     if command in command_mapping:
#         function = command_mapping[command]
#         await self.send_notification(f"{await function()}")

# def get_command_mapping(self):
#     return {}

and for a given plugin:

# def get_command_mapping(self):
#     return 
# {
#             settings.bot_command_help: self.trend.get_talkytrend_help,
#             settings.bot_command_info: self.trend.get_talkytrend_info,
#             settings.bot_command_tv: self.trend.get_tv,
#             settings.bot_command_trend: self.trend.check_signal,
#             settings.bot_command_news: self.trend.fetch_key_feed,
#         }
@mraniki mraniki added the enhancement New feature or request label Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant