Skip to content

Channel cloning and extending (2.x)

Eana Hufwe edited this page Apr 13, 2019 · 3 revisions

Written by Eana Hufwe for v2.0.0

By cloning an existing module, you can make changes to the existing code and override methods and behaviors of a module. This is done by extending the module class and overriding the module ID, you can also modify a module locally in this way.

Note: To have multiple accounts with the same channel, use "Instance ID".

It should work for most modules, depending on their implementations.


This example is simplified for just cloning a channel with minimum modifications. If you want to make further changes, please refer to the documentation for details.

  1. Look for the channel class you want to clone, and note down it's full qualified name, that is a name that you can import with. In this example, efb_dummy_slave.DummyChannel will be used.
  2. Navigate to the modules path, or EFB_DATA_PATH/modules, defaulted to ~/.ehforwarderbot/modules.
  3. Create a file, and include the following code:
    from efb_dummy_slave import DummyChannel
    class DummyCloneChannel(DummyChannel):
        channel_id = "dummy_clone.DummyCloneChannel"  
        # This is usually the file name and the class name of the clone
        channel_name = "Dummy clone channel"
        channel_emoji = "💭"
  4. Configure the channel as instructed by the channel author, but with the new channel ID (dummy_clone.DummyCloneChannel).
  5. Enable the channel in your config.yaml with the new ID.

Technical details

EFB adds EFB_DATA_PATH/modules to its PYTHON_PATHS before it runs, and try to use the registered name as a fully qualifying path to import the class.