yetibot

授权协议 EPL-1.0 License
开发语言 C/C++
所属分类 服务器软件、 电话/通讯/IM聊天
软件类型 开源软件
地区 不详
投 递 者 王才
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

A chat bot written in Clojure, at your service.

Yetibot

You can think of Yetibot as a communal command line. It excels at:

  • teaching: how to run internal automation, language evaluation for JS,Scala, Clojure, and Haskell
  • productivity: automating things around Jenkins, JIRA, running SSHcommands on various servers, and interacting with internal APIs via privateYetibot plugins
  • fun: Google image search, gif lookups, meme generation

Features that make Yetibot powerful and great, which is to say fun:

  • Unix-style pipes allow tremendousexpressiveness in chaining together complex and flexible commands.
  • Sub-expressions let youembed the output of one command into an outer command. They can be nested asmany levels deep as you can imagine (open a PR to add toEXAMPLES if you come up withsomething crazy!).
  • Aliases let you parameterizecomplex expressions and give them a name allowing your team to quickly buildup idiomatic team-specific Yetibot usages (not just memes!).
  • Per-channel settingslet you store arbitrary config at the channel level, which can be used bycommands or aliases to change the behavior of commands depending on whichchannel you're in (e.g. the default JIRA project(s) for a channel).
  • Feature category toggle letsyou disable or enable entire categories of commands per-channel; useful fordisabling gifs in the work-only channel �� .

Take a look at the usage examples tosee some fun useful things it can do.

This project is supported by:

New contributors

Welcome new contributors!

  • Feel free to tackle any issue
  • Issues labeled good first issueare good for first time Yetibot contributors
  • Ask @devth for help on Slack, GitHub oranywhere else you can find him

Use it right now

Get an invite to the official Yetibot slack atslack.yetibot.com. There's Yetibot running on aDroplet generously provided by DigitalOcean thatyou can play with in Slack.

Getting started

To quickly try out Yetibot with minimal config:

Yetibot users

Already using Yetibot? Please add yourself to the list of Yetibotusers!

Contributing

See CONTRIBUTING.

Road map

Yetibot has been undergoing continuous improvement since its inception. Theseare the immediate priorities, in addition to any bug fixes. Feedback andcontributions are very welcome!

  • Write docs on how to develop Yetibot - See the DevGuide
  • Dockerize Yetibot. Done! Check out the instructions.
  • Integrate with StackStorm for automation onsteriods. Done! Check outyetibot-stackstorm.
  • Create a Heroku deploy button to make it easy to get started
  • Make adapters plugable
  • Create more examples of plugins (e.g. Travis)
  • Run a demo Yetibot instance — you can now talk to a Yetibot on Freenode inthe #yetibot channel or join Yetibot Slack!
  • Design & build yetibot.comDone!
  • Flatten the config and obtain it viaenviron to follow 12 FactorApp practices#570

Installation

There are a few ways to run Yetibot:

  1. Follow the Docker instructions: the fastest way if you'realready using Docker.

  2. yetibot-helm: the officialHelm Chart for quickly running Yetibot on Kubernetes.

  3. Clone this repo: this gives you a standard Yetibot installation andprovides a git-ignored place to store configuration. Run from the root dirwith lein run.

  4. Make your own repo and depend on Yetibot: this gives you ultimatecustomizability, allowing you to depend on custom Yetibot plugins or defineyour own commands in-project, and gives you control over where you storeyour config (manual management, commit to private git repo, etc...)

Configuration

See Configuration docs.

Usage

For more docs see the User Guide.

All commands are prefixed by !.

Pipes

Output from one command can be piped to another, like Unix pipes.

!complete does IE support | xargs echo %s? No, it is sucky.

does ie support html5? No, it is sucky.
does ie support css3? No, it is sucky.
does ie support svg? No, it is sucky.
does ie support media queries? No, it is sucky.
does ie support ftps? No, it is sucky.
does ie support png? No, it is sucky.
does ie support canvas? No, it is sucky.
does ie support @font-face? No, it is sucky.
does ie support webgl? No, it is sucky.
does ie support ttf? No, it is sucky.

Backticks

Backticks provide a lightweight syntax for sub-expressions, but they can't benested.

!meme grumpy cat: `catfact` / False

Nested sub-expressions

For arbitrarily-nested sub-expressions, use $(expr) syntax, whichdisambiguates the open and closing of an expressions.

!meme philos: $(complete how does one $(users | random | letters | random) | random)

Combo

!echo `repeat 4 echo i don't always repeat myself but | unwords`…StackOverflowError | meme interesting:

Aliases

You can build your own aliases at runtime. These are stored in the configureddatabase, so upon restart they are restored.

!alias nogrid = repeat 3 echo `repeat 3 meme grumpy: no | join`

Pipes can be used, but the right-hand side must be quoted in order to treat itas a literal instead of being evaluated according to normal pipe behavior.

!alias i5 = "random | echo http://icons.wunderground.com/webcamramdisk/w/a/wadot/324/current.jpg?t=%s&.jpg"

You can specify placeholder arguments on the right-hand side using $s toindicate all arguments, or $n (where n is a 1-based index of which arg).

!alias temp = "weather $s | head 2 | tail"
!temp 98104
=> 33.6 F (0.9 C), Overcast

Adapter config

IRC: Yetibot can listen on any number of channels. You configurechannels inconfig.edn.You can also invite Yetibot to a channel at runtime using the IRC /invitecommand:

/invite yetibot #whoa

When you invite Yetibot to a new channel, config.edn is overwritten, so nexttime you restart Yetibot, it will re-join the same channels.

You can also use the !room command to tell yetibot to join or leave a channel.

!help room
room join <room> # join <room>
room leave <room> # leave <room>
room list # list rooms that yetibot is in
room set <key> <value> # configure a setting for the current room
room settings # show all chat settings for this room
room settings <key> # show the value for a single setting

Slack: bots can't join a channel on their own, they must be invited, soroom configuration doesn't apply. Instead, /invite @yetibot to any channelthat you're in, and /kick @yetibot if you want it to leave. NB: you might needspecial privileges in order to kick.

Campfire is no longer supported. If you use Campfire, open anissue and we can add it back in!

Other chat platforms: If your chat platform of choice is not supported, openan issue. Adding adapters is quite easy.

Broadcast

If a room has broadcast set to true, Tweets will be posted to that room.By default all rooms have it set to false. To enable:

!room set broadcast true

Help

Yetibot self-documents itself using the docstrings of its various commands. Ask itfor !help to get a list of help topics. !help all shows fully expanded commandlist for each topic.

!help | join ,
Use help <topic> for more details, !, <gen>that, alias, ascii, asciichart,
attack, buffer, catfact, chat, chuck, classnamer, clj, cls, complete, config,
count, curl, ebay, echo, eval, features, gh, giftv, grep, haiku, head, help,
history, horse, hs, http, image, info, jargon, jen, join, js, keys, list, log,
mail, meme, memethat, mustachefact, number, order, poke, poms, random, raw,
react, reload, repeat, rest, reverse, rhyme, scala, scalex, sed, set, sort, source,
split, ssh, status, tail, take, tee, twitter, update, uptime, urban, users,
vals, weather, wiki, wolfram, wordnik, words, xargs, xkcd, zen

Plugins

Yetibot has a plugin-based architecture. Its core which all plugins depend onis yetibot.core.

Yetibot will load all commands and observers with namespaces on the classpathmatching theseregexes.

This lets you build any number of independent plugin projects and combine themvia standard Leiningen dependencies.

How it works

Curious how the internals of Yetibot works? At a high level:

  1. commands are run through aparserbuilt on InstaParse:
  2. an InstaParsetransformeris configured to evaluate expressions through the interpreter, which handlesthings like nested sub-expressions and piped commands
  3. commandnamespacesarehookedinto the interpreter's handle-cmd function using a cmd-hook macro andtriggered via regex prefix matching

Getting help

If the docs or implementation code don't serve you well, please open a pullrequest and explain why so we can improve the docs. Also feel free to open anissue for feature requests!

Yetibot in the wild

License

Copyright © 2012-2019 Trevor Hartman. Distributed under the Eclipse PublicLicense 1.0, the same asClojure.

Logo designed by Freeform Design Co.

相关阅读

相关文章

相关问答

相关文档