Changeset 18 for trunk/amazonbot
- Timestamp:
- 09/07/06 14:17:40 (18 years ago)
- Location:
- trunk/amazonbot
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/amazonbot/amazonbot.ini.sample
r10 r18 9 9 10 10 [bot] 11 freq = 12012 11 nick = amazonbot 13 12 content = ãããªã¢ãã¿ã«ããããªã¹ã¹ã¡ … … 17 16 active_pattern = ããã|ãŽã¡ã³|ããŸã|ã¹ãã³|ãããŸãã 18 17 silent_pattern = éªé|ãããŸ|ãžã£ã|ãã(ãã|ããŒ)|ã ãŸã 18 19 [freq] 20 timeout = 600 21 lines = 10 22 lines_random = true -
trunk/amazonbot/amazonbot.py
r17 r18 91 91 _nick = config.get('bot', 'nick') 92 92 93 self._prev_time = time.time() - config.get('bot', 'freq', 'int') 93 self._current_lines = 0 94 self._prev_time = time.time() - config.get('freq', 'timeout', 'int') 94 95 self._silent = False 95 96 SingleServerIRCBot.__init__(self, _server, _nick, _nick) … … 131 132 return method(c, e, to, words[1:]) # words[0] == command name 132 133 134 # freq_lines 135 self._current_lines += 1 136 _freq_lines = config.get('freq', 'lines', 'int') 137 if _freq_lines: 138 if config.get('freq', 'lines_random', 'boolean'): 139 _freq_lines = random.randint(int(_freq_lines/2)+1, _freq_lines) 140 141 if __debug__: 142 print >> sys.stderr, 'DEBUG> Line count: now %d, next: %d' % (self._current_lines, _freq_lines) 143 144 if self._current_lines < _freq_lines: 145 return False 146 self._current_lines = 0 147 148 # freq 133 149 _current_time = time.time() 134 if _current_time < self._prev_time + config.get(' bot', 'freq', 'int'):150 if _current_time < self._prev_time + config.get('freq', 'timeout', 'int'): 135 151 if __debug__: 136 152 cur = time.strftime('%H:%M:%S', time.localtime(_current_time)) 137 go = time.strftime('%H:%M:%S', time.localtime(self._prev_time + config.get(' bot', 'freq', 'int')))153 go = time.strftime('%H:%M:%S', time.localtime(self._prev_time + config.get('freq', 'timeout', 'int'))) 138 154 print >> sys.stderr, 'DEBUG> Not expired: now %s, be expired at: %s' % (cur, go) 139 155 return False 140 156 self._prev_time = _current_time 141 157 158 # silence 142 159 self.silence(msg, c, e, to) 143 160 if self._silent:
Note: See TracChangeset
for help on using the changeset viewer.