Code Monkey home page Code Monkey logo

pyhole's People

Contributors

antonym avatar burlito avatar comstud avatar jerdfelt avatar jk0 avatar jkoelker avatar jmeridth avatar justinwyer avatar kjmancuso avatar msparks avatar notmyname avatar opie4624 avatar pschwartz avatar pvo avatar rconradharris avatar tr3buchet avatar troytoman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyhole's Issues

Msg target can be changed by fast messages to the bot.

There is a current issue with the msg target that allows the target to change if multiple messages coming before a plugin writes to the irc bot.

This is due to target being a member of the IRC class.

I think the best method to correct this is to encapsulate the message building/sending to a class external of the IRC class and use the object built to send the message.

To ease this the class should include a Factory to allow rapid creation of message in place.

Automatically Save Config Changes

Pyhole needs to automatically save things like join/part/nick/etc calls to the config file, since they have to be manually entered now.

request doesn't get automatically pulled in by pip

$ pip install pastee-client
Collecting pastee-client
Using cached pastee-client-0.0.12.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-vpuEWv/pastee-client/setup.py", line 17, in
import pastee
File "/tmp/pip-build-vpuEWv/pastee-client/pastee.py", line 17, in
import requests
ImportError: No module named requests

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vpuEWv/pastee-client/
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ pip install requests
Collecting requests
Downloading requests-2.11.0-py2.py3-none-any.whl (514kB)
100% |████████████████████████████████| 522kB 2.9MB/s
Installing collected packages: requests
Successfully installed requests
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ pip install pastee-client
Collecting pastee-client
Using cached pastee-client-0.0.12.tar.gz
wCollecting requests>=2.10.0 (from pastee-client)
Using cached requests-2.11.0-py2.py3-none-any.whl
Building wheels for collected packages: pastee-client
Running setup.py bdist_wheel for pastee-client ... done
Stored in directory: /home/ubuntu/.cache/pip/wheels/32/8d/31/18e39f8db00f8aa8a65dd2c55c52c49b563b689abc78300ee8
Successfully built pastee-client
Installing collected packages: requests, pastee-client
Successfully installed pastee-client-0.0.12 requests-2.11.0
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

required config options

When trying to start pyhole without a redmine section, it complains and won't connect.

I can see a few options:

  1. Don't load plugins if they're missing required startup options
  2. Just return error when calling plugin from channel
  3. Add config section to know which plugins to load

(.virtualenv)castor:pyhole paul$ ./pyhole.py
08:11:20 [MAIN] Connecting to IRC Networks: FreeNode
08:11:20 [FreeNode] No section: 'Redmine'
08:11:20 [FreeNode] Retrying in 60 seconds
^CProcess Process-1:

Pyhole sends double messages

Steps to reproduce:

  • Send a pyhole command to pyhole in a direct message via slack.
  • See each response line printed twice.
  • Send a pyhole command to a different chatroom on slack.
  • See each response line printed only once.

bug: pyhole fork itself

I'm experiencing very strange behavior of pyhole bot. Today and yesterday it fork itself (about 7pm @freenode) in to two processes, changed nick and for every command it responded 2 times. For example when I type help (admin plugin) it will respond me with two identical help messages.

Here is output from logs at time when that happened:

18:59:30 [Pyhole] 'unicode' object has no attribute 'nick'
Traceback (most recent call last):
  File "/opt/local/lib/python2.7/site-packages/irc_pyhole-0.6.6_aaf29-py2.7.egg/pyhole/core/irc/process.py", line 47, in run
    connection.start()
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 1225, in start
    self.ircobj.process_forever()
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 267, in process_forever
    self.process_once(timeout)
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 248, in process_once
    self.process_data(i)
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 213, in process_data
    c.process_data()
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 561, in process_data
    self._process_line(line)
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 625, in _process_line
    self._handle_event(Event("action", prefix, target, m[1:]))
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 651, in _handle_event
    self.irclibobj._handle_event(self, event)
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 387, in _handle_event
    result = handler.callback(connection, event)
  File "/opt/local/lib/python2.7/site-packages/irc/client.py", line 1188, in _dispatcher
    method(connection, event)
  File "/opt/local/lib/python2.7/site-packages/irc_pyhole-0.6.6_aaf29-py2.7.egg/pyhole/core/irc/client.py", line 309, in on_action
    source = event.source.nick
AttributeError: 'unicode' object has no attribute 'nick'
18:59:30 [Pyhole] Retrying in 60 seconds

Very same log I had from another day. At time when this happened there was no activity in channel or on bot query itself. There is no other message at near of that time.

We are using standart Admin module from pyhole source and this MysqlLogger module: https://github.com/burlito/Dezider-plugins

Here is output how it comunicate when I belive it'is forked:

21:29 <burlak> help
21:29 <Dezider26> Learn how to use active commands (ex: .help <command>)
21:29 <Dezider26> Active Commands: MysqlLogRefresh, MysqlLogRefresh, deop, deop, help, help, join, join, nick, nick, op, op, part, part, quit, quit, reload, reload, say, say, version, version
21:29 <Dezider26> Active Keywords: 
21:29 <Dezider26> Learn how to use active commands (ex: .help <command>)
21:29 <Dezider26> Active Commands: MysqlLogRefresh, MysqlLogRefresh, deop, deop, help, help, join, join, nick, nick, op, op, part, part, quit, quit, reload, reload, say, say, version, version
21:29 <Dezider26> Active Keywords: 
21:29 <burlak> reload
21:29 <Dezider26> Loaded Plugins: Admin, MysqlLogger
21:29 <Dezider26> Loaded Plugins: Admin, MysqlLogger
21:30 <burlak> say burlak I belive I'm broken.
21:30 <Dezider26> I belive I'm broken.
21:30 <burlak> help
21:30 <Dezider26> Learn how to use active commands (ex: .help <command>)
21:30 <Dezider26> Active Commands: MysqlLogRefresh, deop, help, join, nick, op, part, quit, reload, say, version
21:30 <Dezider26> Active Keywords: 

As you can see after reload It repaired itself (yesterday this didn't helped) but failed to regain it's original nickname (Dezider) and still uses nick with number suffix.

Edit:
I forgot to mention: This bug was observed/tested on SmartOS (Solaris/Illumos)

# uname -a
SunOS xlc-1.cust.erigones.com 5.11 joyent_20130629T040542Z i86pc i386 i86pc Solaris

Error handling in pyhole

Pyhole should either, retry or crash on any exception. There's lots of room for partial failure. @jk0 do we automatically respawn pyhole on crash?

Plugins looking for kwargs["full_message"]

Some plugins are still looking for the full_message in kwargs:

$ pss full_message
./plugins/launchpad.py
82: line = kwargs["full_message"].split("/")
94: line = kwargs["full_message"].split("/")

./plugins/urls.py
44: self.url = kwargs["full_message"].split(" ", 1)[0]

./plugins/kernel.py
80: bug_id = kwargs["full_message"].split("id=", 1)[1].split(" ", 1)[0]

./plugins/redmine.py
78: line = kwargs["full_message"].split("/")

They should be using message.message AFAICT

BeautifulSoup renamed in newer version.

BeautifulSoup came down as bs4 (/usr/local/lib/python2.7/dist-packages/bs4) instead of BeautifulSoup on Ubuntu Natty 11.04 using Python 2.7. The egg-info is still BeautifulSoup. I changed line 26 in utils.py to "from bs4 import BeautifulSoup" and then pyhole could generate the conf file.

Failed connections cause duplicate plugin loads

18:28:15 [EFnet] <opie4624> help
18:28:15 [EFnet] Not connected.
18:28:15 [EFnet] Not connected.
18:28:15 [EFnet] Not connected.
18:28:15 [EFnet] Not connected.
18:28:15 [EFnet] <meatless> Learn how to use active commands (ex: .help <command>)
18:28:15 [EFnet] <meatless> Active Commands: cnn, cnn, cnn, cnn, cnn, deop, deop, deop, deop, deop, digg, digg, digg, digg, digg, g, g, g, g, g, google, google, google, google, google, group
hug, grouphug, grouphug, grouphug, grouphug, help, help, help, help, help, imdb, imdb, imdb, imdb, imdb, join, join, join, join, join, lastnight, lastnight, lastnight, lastnight, lastnight,
nick, nick, nick, nick, nick, op, op, op, op, op, part, part, part, part, part, reddit, reddit, reddit, reddit, reddit, reload, reload, reload, reload, reload, roll, roll, roll, roll, roll,
say, say, say, say, say, title, title, title, title, title, twitter, twitter, twitter, twitter, twitter, urban, urban, urban, urban, urban, version, version, version, version, version, w, w,
 w, w, w, weather, weather, weather, weather, weather, wikipedia, wikipedia, wikipedia, wikipedia, wikipedia, youtube, youtube, youtube, youtube, youtube
18:28:15 [EFnet] <meatless> Active Keywords:
18:28:15 [EFnet] Calling: pyhole.plugins.admin.help(None)

nic bug

Neat one. I haven't dug into it yet.

19:18:33 [Pyhole] Connecting to IRC Networks: FreeNode
19:18:33 [FreeNode] Loaded Plugins: Admin, Dice, News
19:18:33 [FreeNode] Connecting to asimov.freenode.net:6667 as derrickthepyhole
19:18:54 [FreeNode] Couldn't connect to socket: [Errno 110] ETIMEDOUT
19:18:54 [FreeNode] Retrying in 60 seconds
19:19:54 [FreeNode] Loaded Plugins: Admin, Dice, News
19:19:54 [FreeNode] Connecting to asimov.freenode.net:6667 as derrickthepyhole
19:19:54 [FreeNode] -asimov.freenode.net- *** Looking up your hostname...
19:19:54 [FreeNode] -asimov.freenode.net- *** Checking Ident
19:19:54 [FreeNode] -asimov.freenode.net- *** No Ident response
19:19:54 [FreeNode] -asimov.freenode.net- *** Found your hostname
19:19:54 [FreeNode] IRC nick 'derrickthepyhole' is currently in use
19:19:54 [FreeNode] Setting IRC nick to 'derrickthepyhole21'
19:19:54 [FreeNode] IRC nick 'derrickthepyhole21' is currently in use
19:19:54 [FreeNode] Setting IRC nick to 'derrickthepyhole2194'
19:19:54 [FreeNode] IRC nick 'derrickthepyhole2194' is currently in use
19:19:54 [FreeNode] Setting IRC nick to 'derrickthepyhole219433'
19:19:54 [FreeNode] IRC nick 'derrickthepyhole219433' is currently in use
19:19:54 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341'
19:19:54 [FreeNode] IRC nick 'derrickthepyhole21943341' is currently in use
19:19:54 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166'
19:19:55 [FreeNode] IRC nick 'derrickthepyhole2194334166' is currently in use
19:19:55 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661'
19:19:56 [FreeNode] IRC nick 'derrickthepyhole219433416661' is currently in use
19:19:56 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184'
19:19:57 [FreeNode] IRC nick 'derrickthepyhole21943341666184' is currently in use
19:19:57 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494'
19:19:58 [FreeNode] IRC nick 'derrickthepyhole2194334166618494' is currently in use
19:19:58 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445'
19:19:59 [FreeNode] IRC nick 'derrickthepyhole219433416661849445' is currently in use
19:19:59 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576'
19:20:00 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576' is currently in use
19:20:00 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658'
19:20:01 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658' is currently in use
19:20:01 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582'
19:20:02 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582' is currently in use
19:20:02 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273'
19:20:03 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658273' is currently in use
19:20:03 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345'

19:20:07 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347' is currently in use
19:20:07 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273453483476'
19:20:08 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658273453483476' is currently in use
19:20:08 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345348347695'
19:20:09 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347695' is currently in use
19:20:09 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582734534834769575'
19:20:10 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582734534834769575' is currently in use
19:20:10 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273453483476957526'
19:20:11 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658273453483476957526' is currently in use
19:20:11 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345348347695752647'
19:20:12 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347695752647' is currently in use
19:20:12 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582734534834769575264732'
19:20:13 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582734534834769575264732' is currently in use
19:20:13 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582734534834769575264732100'
19:20:14 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582734534834769575264732100' is currently in use
19:20:14 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273453483476957526473210065'
19:20:15 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658273453483476957526473210065' is currently in use
19:20:15 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345348347695752647321006593'
19:20:16 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347695752647321006593' is currently in use
19:20:16 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582734534834769575264732100659335'
19:20:17 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582734534834769575264732100659335' is currently in use
19:20:17 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345348347695752647321006593357'
19:20:18 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347695752647321006593357' is currently in use
19:20:18 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273453483476957526473210065933577'
19:20:19 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658273453483476957526473210065933577' is currently in use
19:20:19 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345348347695752647321006593357779'
19:20:20 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347695752647321006593357779' is currently in use
19:20:20 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582734534834769575264732100659335777932'
19:20:21 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582734534834769575264732100659335777932' is currently in use
19:20:21 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273453483476957526473210065933577793225'
19:20:22 [FreeNode] IRC nick 'derrickthepyhole2194334166618494457658273453483476957526473210065933577793225' is currently in use
19:20:22 [FreeNode] Setting IRC nick to 'derrickthepyhole219433416661849445765827345348347695752647321006593357779322525'
19:20:23 [FreeNode] IRC nick 'derrickthepyhole219433416661849445765827345348347695752647321006593357779322525' is currently in use
19:20:23 [FreeNode] Setting IRC nick to 'derrickthepyhole21943341666184944576582734534834769575264732100659335777932252584'
19:20:24 [FreeNode] IRC nick 'derrickthepyhole21943341666184944576582734534834769575264732100659335777932252584' is currently in use
19:20:24 [FreeNode] Setting IRC nick to 'derrickthepyhole2194334166618494457658273453483476957526473210065933577793225258439'
19:20:25 [FreeNode] Disconnected from asimov.freenode.net:6667
19:20:25 [FreeNode] Reconnecting in 60 seconds

utils.decode_entities does more than it should

In addition to replacing various HTML entities and numeric references, it removes non-printable ASCII characters and strips the string. It should not do anything more than what the function comment says it does.

Furthermore, it would probably be better to have this function wrap logic from elsewhere. See http://stackoverflow.com/questions/1208916/decoding-html-entities-with-python for a more complete solution to this. BeautifulSoup.BeautifulStoneSoup would work.

Better Logging

Pyhole needs to log each channel in its own file, preferably with each network having its own folder of channel log files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.