Giter VIP home page Giter VIP logo

ircbot's Introduction

ircbot

Build Status

IRC bot for account creation and other things.

Working on ircbot

We recommend working on supernova, the staff login server. supernova has all of the configuration files and libraries necessary to run ircbot. See our instructions for logging into supernova.

$ git clone https://github.com/ocf/ircbot.git
$ make install-hooks

Once you've made changes, you can run make dev to run the bot in testing mode. In this mode, the bot will join #yourusername on IRC. Your username's channel probably isn't bridged to slack, so you will need to connect to IRC to interact with the bot.

ircbot's People

Contributors

abizer avatar aesthetic avatar andrewke avatar asottile avatar bzh-bzh avatar cg505 avatar chriskuehl avatar daradib avatar dkess avatar dongkyunc avatar encadyma avatar ethanhs avatar fawaf avatar fydai avatar ja5087 avatar jvperrin avatar kalissaac avatar kkuehlz avatar kpengboy avatar matthew-mcallister avatar mrminos avatar nikhiljha avatar notryan avatar pre-commit-ci[bot] avatar pxhanus avatar saurabhnarain avatar singingtelegram avatar steven676 avatar yvbbrjdr avatar zpfeiffer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  avatar

ircbot's Issues

replace "x hit wtc" in the "!sux x" command

We copied this from kochira, the old unofficial IRC bot that used to be in the channel, but it's in pretty poor taste and we should replace it.

Some possibilities:

  • X is the worst
  • X went to stanford
  • X has outdated wordpress
  • X voted for trump
  • X called us "the ofc"
  • X killed net neutrality
  • X uses windows
  • X caused a kernel panic

any other suggestions?

We don't necessarily need to pick just one; it'd be cool to have a list of lots of these and have each !sux invocation randomly pick 4 to use.

RT integration

This was discussed at BoD yesterday.

I proposed we use RT's REST API to post to a specific channel whenever a new help ticket is posted. In addition, we could have create post to #rebuild when a security ticket is sent (since those are higher priority).

We could also have create ping a group (root? sms? help queue group?) for security tickets especially.

Avoid UnicodeDecodeErrors by using a different buffer

I believe we can do this by using a different buffer, like the following (taken from https://pypi.python.org/pypi/irc under "Decoding Input"):

from jaraco.stream import buffer
irc.client.ServerConnection.buffer_class = buffer.LenientDecodingLineBuffer

Otherwise, if invalid tokens are given, we get this error:

Exception in thread Thread-2:
Traceback (most recent call last):
 File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
   self.run()
 File "/usr/lib/python3.5/threading.py", line 862, in run 
   self._target(*self._args, **self._kwargs)
 File "/opt/ircbot/venv/lib/python3.5/site-packages/irc/bot.py", line 332, in start
   super(SingleServerIRCBot, self).start()
 File "/opt/ircbot/venv/lib/python3.5/site-packages/irc/client.py", line 1195, in start
   self.reactor.process_forever()
 File "/opt/ircbot/venv/lib/python3.5/site-packages/irc/client.py", line 273, in process_forever
   consume(infinite_call(one))
 File "/opt/ircbot/venv/lib/python3.5/site-packages/more_itertools/recipes.py", line 159, in consume
   deque(iterator, maxlen=0)
 File "/opt/ircbot/venv/lib/python3.5/site-packages/jaraco/itertools.py", line 386, in <genexpr>
   return (f() for _ in itertools.repeat(None))
 File "/opt/ircbot/venv/lib/python3.5/site-packages/irc/client.py", line 254, in process_once
   self.process_data(i)
 File "/opt/ircbot/venv/lib/python3.5/site-packages/irc/client.py", line 218, in process_data
   c.process_data()
 File "/opt/ircbot/venv/lib/python3.5/site-packages/irc/client.py", line 535, in process_data
   for line in self.buffer:
 File "/opt/ircbot/venv/lib/python3.5/site-packages/jaraco/stream/buffer.py", line 104, in lines
   self.handle_exception()
 File "/opt/ircbot/venv/lib/python3.5/site-packages/jaraco/stream/buffer.py", line 102, in lines
   yield line.decode(self.encoding, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 511: unexpected end of data

Traceback (most recent call last):
 File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
   "__main__", mod_spec)
 File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
   exec(code, run_globals)
 File "/opt/ircbot/ircbot/ircbot.py", line 367, in <module>
   main()
 File "/opt/ircbot/ircbot/ircbot.py", line 361, in main
   raise RuntimeError('Thread exited: {}'.format(thread))
RuntimeError: Thread exited: <Thread(Thread-2, stopped daemon 140446527051520)>

Respond to private messages

Certain modules should work with private messaging. Not account approval or that kind of stuff, but things like ping or shruuuug, whatever help output we add as a part of #1, rackspace monitoring status, commands like that.

consolidate backing tables of certain plugins

since many plugins are quite similar and have similar backing tables, it might make sense to consolidate them into a single table. For example, quotes and inspire, what_is and macros, etc. etc. might be a decent starter ticket project for new staff.

Store recent messages by channel

Currently, all recent messages in all channels are stored together, which sometimes causes weird behavior when using regex substitution and a message from another channel matches it instead. Recent messages should be grouped by channel instead.

make better no-ping code

We should just make a function that is available to all plugins that add 0-length spaces to a message for everything that could be a nick. This is currently done (badly) in turing. (See #91.) We should do it better and probably add it to some other commands (such as !quote).

shorturls/add should handle invalid characters

When the command !shorturl add ^fieldunits <redacted> was run, the following error was reported.

A problem was encountered and reported via ocflib:

ircbot exception in shorturls/add: shorturl '^fieldunits' contains illegal characters

Traceback (most recent call last):
File "/opt/ircbot/ircbot/ircbot.py", line 250, in on_pubmsg
listener.fn(self, msg)
File "ircbot/plugin/shorturls.py", line 45, in add
add_shorturl(ctx, slug, target)
File "/opt/ircbot/venv/lib/python3.7/site-packages/ocflib/misc/shorturls.py", line 38, in add_shorturl
_validate_slug(slug)
File "/opt/ircbot/venv/lib/python3.7/site-packages/ocflib/misc/shorturls.py", line 22, in _validate_slug
raise ValueError("shorturl '{}' contains illegal characters".format(slug))
ValueError: shorturl '^fieldunits' contains illegal characters

expand tweets inline

we currently have create expand rt, discourse, stackoverflow, etc. inline on IRC. considering how many tweets get linked on IRC, we may want to consider expanding them inline as well.

Add AQI information to weather (or create: aqi?)

image

https://airnowapi.org provides API access to AQI data.

I think it would be nice to include this information in weather, but perhaps a separate command would be better? I have no strong feeling.

You can sign up for an account and you get a GUID(?) API key.

Calls look like:

http://www.airnowapi.org/aq/observation/zipCode/current/?format=application/json&zipCode=94720&distance=25&API_KEY=<REDACTED>

The output changes based on region (ugh) but gives either the catagory (Unhealthy/Moderate/etc) or the AQI value.

You can also get data based on lat/lon information.

Print any Rackspace status changes

It would be nice to see the service statuses change automatically instead of having to do create: status each time. It would probably be easiest to store the last status output and only print out a change if the new status fetched is any different.

add `create: rebuild <service>`

with some authenticated jenkins webhooks we could let IRC privileged ops rebuild projects without having to log in and navigate the awful jenkins interface. we already allow the marathon equivalent of this in create: restart <x>

Log directly to stdout

Now that we are using kubernetes logging, the container should not use stdin2syslog as in

exec /opt/share/utils/sbin/stdin2syslog ircbot

We can probably delete the whole services directory, and simply modify the Dockerfile to run the command
exec /opt/ircbot/venv/bin/python -m ircbot.ircbot
instead.

This should allow us to see logs by running something like kubectl -n app-ircbot get logs deployment/deployment instead of having to connect to democracy to see logs.

!fileatask

next in the line of ircbot functionality to steal from Facebook, we should have a plugin that files GitHub issues against the mentioned repository using the GH API, e.g.

!fileatask ircbot make a fileatask plugin
!fileatask ocfweb migrate to kubernetes

Preview links from previewed tweets

When expanding tweets, if the tweet contains a link, create should also expand it inline as it would with other links shared by users in the channel.

lock all connection usage

#167 implements basic locking around the say function. This should be expanded to make sure we lock every time the connection is accessed (including things like setting the topic or getting the current oper list).

plugin to mirror status blog updates

it might be nice to have a small plugin that checks if the status blog has been updated in the past couple minutes and if so, updates #rebuild with a link to new posts

add kanboard integration

Like d#999 or rt#9999, k#99 should link to ocf.io/k/99 and provide a short description of the task.

lazy load (possibly paginate) macros

it takes a long time to load all the pictures for macros so it might be a nice idea to lazy load them to save bandwidth. might need javascript for this though :(

add webserver smoketest

#113 caused jinja to hard fail since the show_topic method didn't have a docstring. This is especially annoying because Marathon uses the webserver to healthcheck the bot—so a broken webserver leaves ircbot in a deploy loop. We can't reasonably expect people to remember to docstring methods when writing plugins. We should have make test run a smoke test that ensures the webserver 200s to catch these errors.

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.