diff options
| author | jason | 2016-08-18 19:30:35 -0600 |
|---|---|---|
| committer | jason | 2016-08-18 19:30:35 -0600 |
| commit | 4518daba36678f52330513ec1fec82a44340fa81 (patch) | |
| tree | f5a95fa686516f1898c7ec66b44ad2ad583bbc95 /README.org | |
| parent | a427cd070d2246264e555b3d4779ebde8acd2e08 (diff) | |
| download | warmachine-ng-4518daba36678f52330513ec1fec82a44340fa81.tar.gz warmachine-ng-4518daba36678f52330513ec1fec82a44340fa81.zip | |
Remove the hard-coded config file path
- added a dynamic config file path
Diffstat (limited to 'README.org')
| -rw-r--r-- | README.org | 17 |
1 files changed, 11 insertions, 6 deletions
| @@ -30,6 +30,8 @@ you must call ~super()~. | |||
| 30 | ** ~self._loop~ | 30 | ** ~self._loop~ |
| 31 | This is given to you access to the asyncio loop. This is useful for scheduling | 31 | This is given to you access to the asyncio loop. This is useful for scheduling |
| 32 | tasks to be run later. | 32 | tasks to be run later. |
| 33 | ** ~self.config_dir~ | ||
| 34 | The directory to store any configuration files and other junk in. | ||
| 33 | ** ~self.log~ | 35 | ** ~self.log~ |
| 34 | This is a logger that you should use when logging messages. | 36 | This is a logger that you should use when logging messages. |
| 35 | ** ~recv_msg(channel, message)~ | 37 | ** ~recv_msg(channel, message)~ |
| @@ -76,18 +78,21 @@ you may want to do such as create configuration files that don't exist yet. | |||
| 76 | * Writing a Connection | 78 | * Writing a Connection |
| 77 | To write a new connection protocol you must inherit from | 79 | To write a new connection protocol you must inherit from |
| 78 | ~warmachine.connections.base.Connection~. This class defines an interface you | 80 | ~warmachine.connections.base.Connection~. This class defines an interface you |
| 79 | must implement to support the plugins. | 81 | must implement to support the plugins. If you override ~__init__~ you must call |
| 82 | ~super()~. | ||
| 80 | ** ~__config_prefix__~ | 83 | ** ~__config_prefix__~ |
| 81 | This global is used to decide which connection to use when it is found in the | 84 | This global is used to decide which connection to use when it is found in the |
| 82 | config file. E.g. IRC uses ~'irc'~ and Slack uses ~'slack'~. It should be | 85 | config file. E.g. IRC uses ~'irc'~ and Slack uses ~'slack'~. It should be |
| 83 | defined somewhere near the top of your file. | 86 | defined somewhere near the top of your file. |
| 84 | ** ~connect()~ | 87 | ** ~self.config_dir~ |
| 88 | The directory to store any configuration files and other junk in. | ||
| 89 | ** ~self.connect()~ | ||
| 85 | D'bolla uses python 3's asyncio to manage multiple connections concurrently thus | 90 | D'bolla uses python 3's asyncio to manage multiple connections concurrently thus |
| 86 | you should use ~asyncio.open_connection~ to create your connection. Once you | 91 | you should use ~asyncio.open_connection~ to create your connection. Once you |
| 87 | have successfully connected you must set ~self.status~ to | 92 | have successfully connected you must set ~self.status~ to |
| 88 | ~warmachine.connections.base.CONNECTED~. This indicates the connection is ready | 93 | ~warmachine.connections.base.CONNECTED~. This indicates the connection is ready |
| 89 | to use. | 94 | to use. |
| 90 | ** ~read()~ | 95 | ** ~self.read()~ |
| 91 | This method is constantly checked in a loop by the ~Bot~ class. When a message | 96 | This method is constantly checked in a loop by the ~Bot~ class. When a message |
| 92 | is returned it is passed into the ~recv_msg~ method in all loaded plugins. This | 97 | is returned it is passed into the ~recv_msg~ method in all loaded plugins. This |
| 93 | return value should be formatted in the following format: | 98 | return value should be formatted in the following format: |
| @@ -99,9 +104,9 @@ return value should be formatted in the following format: | |||
| 99 | 'message': 'The message that was received', | 104 | 'message': 'The message that was received', |
| 100 | } | 105 | } |
| 101 | #+END_SRC | 106 | #+END_SRC |
| 102 | ** ~say(message, destination)~ | 107 | ** ~self.say(message, destination)~ |
| 103 | This method is used by plugins to send a message to a channel or user. | 108 | This method is used by plugins to send a message to a channel or user. |
| 104 | ** ~id~ | 109 | ** ~self.id~ |
| 105 | This should return a unique id used to identify this particular connection. This | 110 | This should return a unique id used to identify this particular connection. This |
| 106 | is used by plugins when saving state. As an example, the IRC connection uses | 111 | is used by plugins when saving state. As an example, the IRC connection uses |
| 107 | something like this: | 112 | something like this: |
| @@ -115,6 +120,6 @@ def id(self): | |||
| 115 | value = '{}-{}'.format(self.host, self.nick) | 120 | value = '{}-{}'.format(self.host, self.nick) |
| 116 | return md5(value.encode()).hexdigest() | 121 | return md5(value.encode()).hexdigest() |
| 117 | #+END_SRC | 122 | #+END_SRC |
| 118 | ** ~get_users_by_channel(channel)~ | 123 | ** ~self.get_users_by_channel(channel)~ |
| 119 | This method should return a list of all users (including the bot) for the | 124 | This method should return a list of all users (including the bot) for the |
| 120 | connection. | 125 | connection. |