Changeset 20


Ignore:
Timestamp:
01/19/07 10:07:17 (17 years ago)
Author:
atzm
Message:
  • Add !status command and small bug fix
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/amazonbot/amazonbot.py

    r19 r20  
    147147            return method(c, e, to, words[1:]) # words[0] == command name 
    148148 
     149        # silence 
     150        self.silence(msg, c, e, to) 
     151        if self._silent: 
     152            return False 
     153 
    149154        # freq_lines 
    150155        self._current_lines += 1 
     
    169174            return False 
    170175        self._prev_time = _current_time 
    171  
    172         # silence 
    173         self.silence(msg, c, e, to) 
    174         if self._silent: 
    175             return False 
    176176 
    177177        nominals = mecab_parse(msg) 
     
    210210    def process_keyword(self, keyword): 
    211211        return [None, None] 
     212 
     213    def is_silent(self): 
     214        return self._silent 
     215    def get_current_lines(self): 
     216        return self._current_lines 
     217    def get_prev_time(self): 
     218        return self._prev_time 
    212219 
    213220class AmazonBot(AmazonBotBase): 
     
    237244        return 'AmazonBot by %s, based on python-irclib' % __author__ 
    238245 
     246    def onmsg_s(self, c, e, to, args): return self.onmsg_status(c, e, to, args) 
     247    def onmsg_status(self, c, e, to, args): 
     248        """Syntax: !status 
     249        """ 
     250        _debug('in status command: %s', str(args)) 
     251 
     252        c.notice(to, 'silent: %s' % self.is_silent()) 
     253        c.notice(to, 'current lines: %d' % self.get_current_lines()) 
     254        c.notice(to, time.strftime('previous time: %b %d %T', 
     255                                   time.localtime(self.get_prev_time()))) 
     256        return True 
     257 
    239258    def onmsg_isbn(self, c, e, to, args): 
    240259        """Syntax: !isbn <ISBN number> 
     
    315334        _from = nm_to_n(e.source()) # ログを流しおしたうのでヘルプは盎接送信å 
    316335ƒãž 
     336        c.notice(_from, self.get_version()) 
     337 
    317338        docs = [] 
    318339        for key in dir(self): 
Note: See TracChangeset for help on using the changeset viewer.