parent
4fdb5d19e6
commit
479d009346
|
@ -74,13 +74,16 @@ def test_plugin(msg):
|
|||
The function will need to accept a single argument in order to accept a `Message` object from the bot.
|
||||
|
||||
The `Message` object has the following attributes:
|
||||
* `cmd`: the command that triggered the function
|
||||
* `cmd`: (for command plugins) the command that triggered the function
|
||||
* `nick`: the user who triggered the command
|
||||
* `arg`: all the trailing text after the command. This is what you will use to get optional information for the command
|
||||
* `arg`: (for command plugins) all the trailing text after the command. This is what you will use to get optional information for the command
|
||||
* `text`: (for listener plugins) the entire text of the message
|
||||
* `channel`: the channel where the command was initiated
|
||||
* `ops`: the list of bot operators
|
||||
* `botnick`: the nickname of the bot
|
||||
* `logger`: instance of `Bot`'s logger
|
||||
* `datetime`: aware `datetime.datetime` object when the `Message` object was created
|
||||
* `timestamp`: float for the unix timestamp when the `Message` object was created
|
||||
|
||||
It also contains the following IRC functions:
|
||||
* `privmsg`: send a message to an arbitrary channel or user
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from datetime import datetime, timezone
|
||||
import imp
|
||||
import logging
|
||||
import os
|
||||
|
@ -28,6 +29,8 @@ class Bot(irc.bot.SingleServerIRCBot):
|
|||
|
||||
class Message:
|
||||
def __init__(self, channel, nick, botnick, ops, logger, action, privmsg, notice, cmd=None, arg=None, text=None, nick_list=None):
|
||||
self.datetime = datetime.now(timezone.utc)
|
||||
self.timestamp = self.datetime.timestamp()
|
||||
self.channel = channel
|
||||
self.nick = nick
|
||||
self.nick_list = nick_list
|
||||
|
|
Loading…
Reference in New Issue