Compare commits
21 Commits
5c782f2a88
...
22e81f9101
Author | SHA1 | Date |
---|---|---|
Shadow15510 | 22e81f9101 | |
Shadow15510 | 8be96abc44 | |
Shadow15510 | b8deded736 | |
Shadow15510 | cc7af23461 | |
Shadow15510 | b89d7fc86d | |
Shadow15510 | 557d6b09ac | |
Shadow15510 | efc29350f1 | |
Shadow15510 | d6940b85d8 | |
Shadow15510 | d1c54d5a81 | |
Shadow15510 | 92c6c27f72 | |
Shadow15510 | 884fa50ab2 | |
Shadow15510 | 994a2fef1f | |
Shadow15510 | e5525b4ab8 | |
Shadow15510 | 785b6de7f7 | |
Shadow15510 | 9924c7a7f6 | |
Shadow15510 | 4157fbcf63 | |
Shadow15510 | 4453cedf96 | |
Shadow15510 | da7d6960fe | |
Shadow15510 | 6c74b5c95a | |
Shadow15510 | 1ed3c073af | |
Shadow15510 | 48cc55091d |
11
docs/bot.rst
11
docs/bot.rst
|
@ -4,6 +4,11 @@
|
|||
Bot
|
||||
---
|
||||
.. automodule:: irc_api.bot
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
:ignore-module-all:
|
||||
|
||||
.. autoclass:: Bot
|
||||
.. autoclass:: BotCommand
|
||||
.. autoexception:: WrongArg
|
||||
.. autofunction:: check_args
|
||||
.. autofunction:: convert
|
||||
.. autofunction:: parse
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
Commands
|
||||
--------
|
||||
.. automodule:: irc_api.commands
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
:ignore-module-all:
|
||||
|
||||
.. autodecorator:: command
|
||||
.. autodecorator:: channel
|
||||
.. autodecorator:: every
|
||||
.. autodecorator:: on
|
||||
.. autodecorator:: user
|
||||
.. autofunction:: auto_help
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
History
|
||||
-------
|
||||
.. automodule:: irc_api.history
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
:ignore-module-all:
|
||||
|
||||
.. autoclass:: History
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
IRC
|
||||
---
|
||||
.. automodule:: irc_api.irc
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
:ignore-module-all:
|
||||
|
||||
.. autoclass:: IRC
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
Message
|
||||
-------
|
||||
.. automodule:: irc_api.message
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
:ignore-module-all:
|
||||
|
||||
.. autoclass:: Message
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
sphinx
|
||||
sphinx-autodocgen
|
||||
sphinx-rtd-theme
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "1.0.6"
|
||||
__version__ = "1.0.7"
|
||||
|
|
|
@ -34,18 +34,25 @@ class Bot:
|
|||
|
||||
Methods
|
||||
-------
|
||||
start : NoneType, public
|
||||
Runs the bot and connects it to IRC server.
|
||||
send : NoneType, public
|
||||
Send a message on the IRC server.
|
||||
add_command : NoneType, public
|
||||
Add a single command to the bot.
|
||||
add_commands : NoneType, public
|
||||
Allow to add a list of command to the bot.
|
||||
add_commands_module : NoneType, public
|
||||
Allow to add a module of command to the bot.
|
||||
remove_command : NoneType, public
|
||||
Remove a command.
|
||||
.. automethod:: __init__
|
||||
.. automethod:: add_command
|
||||
.. automethod:: add_commands
|
||||
.. automethod:: add_commands_module
|
||||
.. automethod:: remove_commands
|
||||
.. automethod:: send
|
||||
.. automethod:: start
|
||||
|
||||
Examples
|
||||
--------
|
||||
Assuming the module was imported as follow: ``from irc_api import api``
|
||||
You can create a bot::
|
||||
|
||||
my_bot = api.Bot(
|
||||
irc_params=(irc.exemple.com, 6697),
|
||||
channels=["#general", "#bot-test"],
|
||||
prefix="!",
|
||||
cmnd_pack1, cmnd_pack2
|
||||
)
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -72,18 +79,6 @@ class Bot:
|
|||
The message history of the bot. By default, the bot will remind 100 messages.
|
||||
*commands_module : optionnal
|
||||
Modules of commands that you can give to the bot at it's creation.
|
||||
|
||||
Examples
|
||||
--------
|
||||
Assuming the module was imported as follow: ``from irc_api import api``
|
||||
You can create a bot::
|
||||
|
||||
my_bot = api.Bot(
|
||||
irc_params=(irc.exemple.com, 6697),
|
||||
channels=["#general", "#bot-test"],
|
||||
prefix="!",
|
||||
cmnd_pack1, cmnd_pack2
|
||||
)
|
||||
"""
|
||||
self.prefix = prefix
|
||||
|
||||
|
@ -240,9 +235,9 @@ class BotCommand:
|
|||
The description of the BotCommand. By default, the function's docstring is used.
|
||||
cmnd_type : int, public
|
||||
The type of the command.
|
||||
- if ``cmnd_type = 0``, the command is triggered on an event.
|
||||
- if ``cmnd_type = 1``, the command is a named command.
|
||||
- if ``cmnd_type = 2``, the command is a routine automatically triggered.
|
||||
* if ``cmnd_type = 0``, the command is triggered on an event.
|
||||
* if ``cmnd_type = 1``, the command is a named command.
|
||||
* if ``cmnd_type = 2``, the command is a routine automatically triggered.
|
||||
bot : irc_api.bot.Bot, public
|
||||
The bot the command belongs to.
|
||||
"""
|
||||
|
@ -261,9 +256,9 @@ class BotCommand:
|
|||
The description of the BotCommand. By default, the function's docstring is used.
|
||||
cmnd_type : int
|
||||
The type of the command.
|
||||
- if ``cmnd_type = 0``, the command is triggered on an event.
|
||||
- if ``cmnd_type = 1``, the command is a named command.
|
||||
- if ``cmnd_type = 2``, the command is a routine automatically triggered.
|
||||
* if ``cmnd_type = 0``, the command is triggered on an event.
|
||||
* if ``cmnd_type = 1``, the command is a named command.
|
||||
* if ``cmnd_type = 2``, the command is a routine automatically triggered.
|
||||
"""
|
||||
self.name = name
|
||||
self.func = func
|
||||
|
|
|
@ -12,19 +12,11 @@ class History:
|
|||
|
||||
Methods
|
||||
-------
|
||||
add : NoneType, public
|
||||
Add an element to the History. If the History is full, the oldest message is deleted.
|
||||
get : list, public
|
||||
Returns the content of the History.
|
||||
.. automethod:: add
|
||||
.. automethod:: get
|
||||
"""
|
||||
def __init__(self, limit: int):
|
||||
"""Initialize the History.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
limit : int
|
||||
The maximum number of messages the History's instance can handle.
|
||||
"""
|
||||
"""Constructor method."""
|
||||
self.__content = []
|
||||
if limit:
|
||||
self.__limit = limit
|
||||
|
@ -32,7 +24,7 @@ class History:
|
|||
self.__limit = 100
|
||||
|
||||
def __len__(self):
|
||||
"""Returns the lenght of the History's instance."""
|
||||
"""Returns the length of the History's instance."""
|
||||
return len(self.__content)
|
||||
|
||||
def add(self, elmnt):
|
||||
|
|
|
@ -25,20 +25,13 @@ class IRC:
|
|||
|
||||
Methods
|
||||
-------
|
||||
connection : NoneType, public
|
||||
Starts the IRC layer and manage authentication.
|
||||
send : NoneType, public
|
||||
Sends a message to a given channel.
|
||||
receive : Message, public
|
||||
Receive a new raw message and return the processed message.
|
||||
join : NoneType, public
|
||||
Allows to join a given channel.
|
||||
waitfor : str, public
|
||||
Wait for a raw message that matches the given condition.
|
||||
.. automethod:: __init__
|
||||
.. automethod:: connection
|
||||
.. automethod:: join
|
||||
.. automethod:: receive
|
||||
.. automethod:: send
|
||||
.. automethod:: waitfor
|
||||
|
||||
handle : NoneType, private
|
||||
Handles the ping and store incoming messages into the inbox attribute.
|
||||
|
||||
"""
|
||||
def __init__(self, host: str, port: int):
|
||||
"""Initialize an IRC wrapper.
|
||||
|
|
Loading…
Reference in New Issue