🫶 Community#
🚧 Build Your Plugin#
here is a plugin example:
1from tt.config import logger, settings
2from tt.plugins.plugin_manager import BasePlugin
3
4# import MyClass / Your Class Object
5
6
7class ExamplePlugin(BasePlugin):
8 """Example Plugin
9 Initialization of imported class MyClass
10 """
11
12 def __init__(self):
13 """Plugin Initialization"""
14 super().__init__()
15 self.enabled = settings.example_plugin_enabled
16 if self.enabled:
17 logger.debug("example plugin enabled")
18 # init MyClass here
19
20 async def start(self):
21 """Starts the plugin"""
22 logger.debug("example plugin started")
23 if self.enabled:
24 logger.debug("example plugin enabled")
25
26 async def handle_message(self, msg):
27 """
28 Handles incoming messages.
29
30 Args:
31 msg (str): The incoming message.
32 """
33 if self.should_filter(msg):
34 return
35 elif self.is_command_to_handle(msg):
36 command, *args = msg.split(" ")
37 command = command[1:]
38
39 command_mapping = {
40 self.bot_command_help: self.myadhocfunction,
41 # self.bot_command_mycommand: self.Myclass.function,
42 }
43
44 if command in command_mapping:
45 function = command_mapping[command]
46 await self.send_notification(f"{await function()}")
47
48 async def myadhocfunction(self):
49 """
50 This is an example if you need an adhoc function.
51 Your class object should be in the initialization.
52 and the handle_message should be used to retrieve
53 your functions fro MyClass
54 """
55 return "this is an example"
🧑💻 Contributing#
We're really excited that you're interested in contributing! Before contributing, make sure you read through existing issues. Before working on a large PR, please open an issue to discuss first.
TalkyTrader, CI pipeline and linked libraries are built using the below framework: