GithubHelp home page GithubHelp logo

yossarian-bot's Introduction

yossarian-bot

license

An entertaining IRC bot that's easy to extend.

Features:

  • Simple real-time administration.
  • Unix fortunes (fortune must be present)
  • Catch-22 quotes
  • UrbanDictionary queries
  • Wolfram|Alpha queries
  • Smart weather queries (Wunderground)
  • Google searches
  • YouTube searches
  • ROT13 message "encryption"
  • Magic 8 Ball queries
  • Dictionary queries (Merriam-Webster)
  • Cleverbot discussions
  • Channel 'seen' log
  • Link compression (TinyURL)
  • ...and much more!

Installation

First, clone the repo and install yossarian-bot's dependencies:

$ git clone https://github.com/woodruffw/yossarian-bot
$ cd yossarian-bot
$ bundle install

If you get errors during the bundle installation process, make sure that you're using Ruby 3.0 or later and have Ruby's development headers installed. You may need them from your package manager. Earlier versions of Ruby might work, but are not guaranteed or tested.

yossarian-bot also requires API keys for several services. Make sure that they are exported to the environment (or set in the configuration) as follows:

  • Wolfram|Alpha - WOLFRAM_ALPHA_APPID_KEY
  • Weather Underground - WUNDERGROUND_API_KEY
  • WeatherStack - WEATHERSTACK_API_KEY
  • Merriam-Webster - MERRIAM_WEBSTER_API_KEY
  • YouTube (v3) - YOUTUBE_API_KEY
  • Last.fm - LASTFM_API_KEY, LASTFM_API_SECRET
  • Open Exchange Rates - OEX_API_KEY
  • Giphy - GIPHY_API_KEY
  • BreweryDB - BREWERYDB_API_KEY
  • AirQuality - AIRNOW_API_KEY
  • OMDB - OMDB_API_KEY

Additionally, the fortune utility must be present in order for Unix fortunes to work correctly. Some package managers also provide the fortunes, fortunes-off, and fortunes-bofh-excuses packages for additional fortune messages.

Running

Once all dependencies are installed, yossarian-bot can be run as follows:

$ ruby bot-control.rb start
$ # OR:
$ ruby yossarian-bot.rb # not run in background

Using Docker

docker build -t yossarian-bot:latest .
docker run -v $PWD/config.yml:/config.yml yossarian-bot

Using the bot

Configuration Options

yossarian-bot is configured via a YAML file named config.yml.

Look at the example config.yml to see a list of optional and required keys.

Commands

There are a bunch of commands that yossarian-bot accepts. You can see a complete list in the COMMANDS file.

Matches

yossarian-bot matches all HTTP(S) links and messages the title of the linked HTML page. This feature can be disabled by adding LinkTitling to the server's disabled_plugins array in config.yml.

Messages of the form s/(.+)/(.+) are also matched, and the first pattern matched is applied to the user's last previous message, with the second match replacing it. For example, a typo like "this is a setnence" can be corrected with s/setnence/sentence. This feature can be disabled by adding RegexReplace to the server's disabled_plugins array in config.yml.

Contributing

Contributions to yossarian-bot are welcomed and appreciated.

If you're writing a plugin, check out the quick style guide to writing plugins for yossarian-bot.

If you'd like to contribute but don't have any contributions in mind, check out the open issues. They're regularly updated with things that can be fixed, improved, and added.

License

yossarian-bot is licensed under a restricted modification of the MIT license.

For the exact terms, see the license file.

yossarian-bot's People

Contributors

arathnim avatar bheru27 avatar chrisatanasian avatar ckath avatar dependabot-preview[bot] avatar dependabot[bot] avatar emgram769 avatar ericboehs avatar ghalley avatar lightarrow47 avatar lykranian avatar mushrom avatar sandergroen avatar strong-code avatar winny- avatar woodruffw 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yossarian-bot's Issues

Authentication via SASL

yossarian-bot currently leverages cinch-identify for authentication and ignores cinch's built-in SASL support. Since SASL is always performed pre-join, it's preferable when available and should be enabled in the bot.

Idea:
Test server_info['auth']['type'] for 'sasl', then branch and fill in conf.sasl.username/password instead of the normal Cinch::Plugins::Identify configuration.

weather plugin rework

The weather plugin now uses apixu for weather data, apparently they decided to move to weatherstack (https://github.com/apilayer/weatherstack#important-apixu-shutdown-on-october-14th-2019) this is fairly straight forward to rework as the response is nearly the same. So I'll just do this beginning of October.

I'd like to also take this chance to implement any format changes people might have, the data returned is as follows:
image
currently the format is:

"Current temperature in $name, $region, $country is $temp_c°C ($temp_f°F) and $weather_description.",

Suggestion

Google Maps just got an API, maybe you could put that in and have some sort of Map command, like !map 32901 or !map 4053 Wilkes Drive Melbourne FL 32901 and then it would spit out a link to the address. It could also do Lat/Long coordinates

Also pizza command like taco but for pizza. i cant find a website that isnt from the major pizza makers. perhaps put it out to the community to see if they could find it

LastSeen Persistence

The LastSeen plugin does not persist its records across reboots (all seen records are stored in a single hash). This should be changed so that users can look up seen times for people who have not been since since before a reboot.

Ideas:
Look at UserIntros or any other persistent plugin for inspiration.

Support for environment variables in config

Various yossarian-bot plugins access the evironment for API keys.

It would be good to load such keys from a central location, rather than expecting them to be preloaded into the environment. For example, something like this in config.yml:

environment:
  FOO_API: value

The environment hash could then be loaded in yossarian-bot.rb.

Per-channel Plugin Control

Currently, yossarian-bot can only enable and disable plugins on a instance-wide basis. This is inconvenient for when different channels have different needs.

Idea:
!admin plugin <enable|disable> <#channel|*>

How to login as admin?

I can't figure out how to login as administrator. I see how to set nicks ... but surely there must be a password?

Gemify the Bot

yossarian-bot could be turned into a Gem with relative ease. This would make distribution even easier than the current git clone and allow versioning to match that in version.yml.

Misleading license at best

The readme states that this code is MIT-licensed: "licensed under the MIT License." but the license has additional restrictions that means this is not longer the MIT proper and not an open source nor a free software license. It would be nice to clarify to avoid confusion, uncertainty and doubts. NB: this also applies to several other repositories.= of yours

Cleverbot Plugin

The Cleverbot plugin is currently broken, following a change to cleverbot's interface. The plugin is backed by a gem that seems to be inactive/abandoned, so fixing this probably involves reverse engineering the new cleverbot interface.

CodeEval DRYness

(ruby-eval-in)[https://rubygems.org/gems/ruby-eval-in] provides an interface to https://eval.in via a gem, so CodeEval should use that instead of rolling its own system.

New Plugin Ideas

Copied directly from the old TODO.md:

Reply command

When you're sent a message, yosbot tells you to reply using the normal message syntax. Perhaps have messaging set up such that sending a message to someone sets you as the previous sender in a field under their nick. Then, using a !reply command would send a message to the last person to mail you.

HAL Per-channel and Persistence

HAL does not store its "brain" across reboots. This should be done to maximize learning. Additionally, it should learn on a per-channel basis.

Fix `YoutubeSearch`

Looks like I broke it:

=nil>>: #‹Thread: 0x00007fee50d3530 /home/william/yossarian-bot/vendor/bundle/ruby/3.2.0/gems/grinch-1.1.0/lib/cinch/handler.rb:94 run>
1 in total.
[2023/07/19 12:12:27.265] !! /home/william/yossarian-bot/plugins/youtube_search.r:34:in 'youtube_search': undefined method 'encode' for URI: Module (NoMethodError)
[2023/07/19 12:12:27.2651
It/home/william/yossarian-bot/vendor/bundle/ruby/3.2.0/gems/grinch-1.1.0/lib/cinch/plugin.rb:414:in'call'
[2023/07/19 12:12:27.265]
It/home/william/yossarian-bot/vendor/bundle/ruby/3.2.0/gems/grinch-1.1.0/lib/cinch/plugin.rb:414:in 'block (2 levels) in _register_mat
chers'
[2023/07/19 12:12:27.265] !!
At/home/william/yossarian-bot/vendor/bundle/ruby/3.2.0/gems/grinch-1.1.0/lib/cinch/handler.rb:101:in'blockincall'

A new Weather plugin

As of 90fe0e4, the old (Wunderground-based) Weather plugin has been disabled -- Wunderground appears to have broken much of the search functionality in their API.

Open to suggestions and PRs for a new Weather plugin.

Plugin and Core Documentation

Plugins are currently documented in COMMANDS.md, and the bot's core isn't really documented at all.

Ideas:

  • Document everything via YARD.
  • Move COMMANDS.md to a dedicated site (and add indexing/searching/etc).

A better WebSearch plugin

We originally had a !g plugin that searched the web using Google's old REST API, but they've since removed that in favor of the Custom Search API.

!s currently works, but uses some weird search engine that doesn't provide very good results.

Since Custom Search provides up to 100 free queries per day (source) and can be configured to provide default search results, we should just switch to that.

Edit: It looks like the trick with Custom Search is to create your search engine with only one schema: "Thing".

Travis Integration

Might be overkill for such a small project (since "building" it is literally 99% dependency installation), but I'd figure travis builds would be marginally helpful and quick to verify that PR builds are working fine.

Perhaps a prerequisite would be some kind of unit tests? Doesn't make sense to just randomly run the bot as a test and kill it.

Case Sensitivity

IRC isn't case sensitive for nicknames, but some plugins that use nicks probably are.

Ping Accuracy

Current, Ping just acknowledges the user with a UNIX timestamp. This isn't at all accurate, and doesn't give the user a good idea of their latency.

Ideas:
User should send a ISO 8601 stamp via !ping <stamp>, which is then subtracted from the current time. The stamp should either be in UTC or include a timezone offset.

Bug Bounty

There is currently a bounty on bugs that cause yossarian-bot to crash or busy loop (causing a denial of service). The first three reproducible bugs reported that meet these requirements will receive free Club-Mates.

Plugin DRYness

Most yossarian-bot plugins are very repetitive and repeat the same operations for slight variations of the same command.

This should be reduced via auxiliary methods in each plugin.

Extensions to CustomTriggers

Currently, CustomTriggers can only add triggers composed of runs of non-space characters.

It should be able to support (limited) regular expressions and triggers containing spaces.

Ideas:

  • !trigger add 'this is a trigger with spaces' 'this is the response'
  • !trigger add this is a trigger with spaces -> this is the response
  • !trigger add /match this/ this is a matched response

channel-based akick/banlist

Already an approved idea, but yos-bot would probably benefit from having a regex-based banlist from which it checks every new user in a channel for autokick functionality.

Proposed syntax:

!moderator <akick> <add | rm> <literal | /regex/>

where angle brackets indicate required operands and | means "or".

Configuration file (banlist.yml) should look like so (example channel is #and-the-rest):

---

'#and-the-rest:'
    - greenbagels # matches literal nick
    - /\w+bagels.+/ # matches regex string against entire hostmask

Obviously, there is some leeway for how to implement the regex matching itself... a general regex to handle all cases would probably be more elegant than actually requiring regex delimiters, since literals just require you to ignore metacharacters and character classes...

The general goal is to keep consistent syntax with the rest of the bot while avoiding too much overhead, lest we fall into inconsistency like so many projects before us (e.g. git).

issue with open-uri open()

all plugins that use open-uri and just call open() give me wrong number of arguments (given 2, expected 1). when changed to be called like URI.open(), they work fine. So far the plugins I've seen that do this are crypto and beedogs.

I dont recall this being an issue the last time I touched yossarian-bot, especially because beedogs does it in its init so I wouldve probably noticed it not starting
image

version info (cant remember what I had last time as I always uninstall it when I'm done with it):

  • ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
  • Bundler version 2.1.4
what I think are gem versions from 'gem list':
	activesupport (5.2.3)
	benchmark (default: 0.1.0)
	bigdecimal (default: 2.0.0)
	bundler (2.1.4)
	cgi (default: 0.1.0)
	concurrent-ruby (1.1.5)
	connection_pool (2.2.2)
	covid19_data_ruby (0.0.1)
	crass (1.0.4)
	csv (default: 3.1.2)
	daemons (1.3.1)
	date (default: 3.0.0)
	dbm (default: 1.1.0)
	delegate (default: 0.1.0)
	did_you_mean (default: 1.4.0)
	domain_name (0.5.20190701)
	duck-duck-go (1.1.3)
	etc (default: 1.1.0)
	faraday (0.15.4)
	fcntl (default: 1.0.0)
	fiddle (default: 1.0.0)
	fileutils (default: 1.4.1)
	flippy (0.1.3)
	forwardable (default: 1.3.1)
	gdbm (default: 2.1.0)
	genregen (0.0.8)
	getoptlong (default: 0.1.0)
	goodreads (0.7.0)
	google-search (1.0.3)
	grinch (1.0.1)
	grinch-identify (1.7.1)
	hashie (2.1.2)
	haste (0.2.3)
	htmlentities (4.3.4)
	http-cookie (1.0.3)
	httparty (0.17.0)
	httpclient (2.8.3)
	i18n (1.6.0)
	io-console (default: 0.5.3)
	ipaddr (default: 1.2.2)
	json (default: 2.3.0)
	lastfm (1.27.3)
	leetspeak (0.1.1)
	logger (default: 1.4.2)
	matrix (default: 0.2.0)
	mechanize (2.7.6)
	mime-types (3.3)
	mime-types-data (3.2019.0904)
	mini_portile2 (2.4.0)
	minitest (5.11.3)
	multi_xml (0.6.0)
	multipart-post (2.0.0)
	mutex_m (default: 0.1.0)
	myanimelist (1.0.0)
	net-http-digest_auth (1.4.1)
	net-http-persistent (3.0.1)
	net-pop (default: 0.1.0)
	net-smtp (default: 0.1.0)
	netrc (0.11.0)
	nokogiri (1.10.9)
	nokogumbo (2.0.1)
	ntlm-http (0.1.1)
	oauth (0.5.4)
	observer (default: 0.1.0)
	open3 (default: 0.1.0)
	open_uri_redirections (0.2.1)
	openssl (default: 2.1.2)
	optimist (3.0.0)
	ostruct (default: 0.2.0)
	prime (default: 0.1.1)
	pstore (default: 0.1.0)
	psych (default: 3.1.0)
	racc (default: 1.4.16)
	readline (default: 0.0.2)
	readline-ext (default: 0.1.0)
	reline (default: 0.1.2)
	research_topicgen (0.1.6)
	rest-client (2.0.2)
	rexml (default: 3.2.3)
	rss (default: 0.2.8)
	ruby-eval-in (0.0.7)
	ruby-termios (1.0.2)
	ruby-upworthy (1.0.0)
	sanitize (5.1.0)
	sdbm (default: 1.0.0)
	singleton (default: 0.1.0)
	stringio (default: 0.1.0)
	strscan (default: 1.0.3)
	telegraph (1.0.1)
	thread_safe (0.3.6)
	time_difference (0.7.0)
	timeout (default: 0.1.0)
	tracer (default: 0.1.0)
	tzinfo (1.2.5)
	unf (0.1.4)
	unf_ext (0.0.7.6)
	uri (default: 0.10.0)
	webrick (default: 1.6.0)
	webrobots (0.1.2)
	wolfram (0.2.1)
	xkcd (1.1.1)
	xml-simple (1.1.5)
	yaml (default: 0.1.0)
	zlib (default: 1.1.0)

Complete command error messages

'remind' doesn't handle the error case of the first argument not being an integer. Ideally, the error(s) should include the full syntax of the command.

Automated updating

Currently, yossarian-bot is updated by fetching changes to the git repository and running ./bot-control.rb restart. Ideally, this could be automated from within the bot and issued from within IRC itself.

Idea:
!admin update, which diffs the fetch before merging it to see which plugins need to be restarted. This won't work for the core, which will need to restart entirely in the event of changes.

Issue command

A command that uses the github API to submit an issue to this repo, allowing more direct feedback for potential bugfixes.

Youtube

So you said the youtube app said that some apis will not be supported after april 2015
problem

also its not reporting youtube info, must be related to the above item

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.