Skip to content

Commit

Permalink
new plugin hitokoto
Browse files Browse the repository at this point in the history
  • Loading branch information
xhan committed May 29, 2014
1 parent 1db08b0 commit 6e0c8d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -25,8 +25,9 @@
},

"dependencies": {
"log": ">= 1.4.0",
"js-yaml" : ">= 3.0.0"
"request": "*",
"log": ">= 1.4.0",
"js-yaml" : ">= 3.0.0"
},

"engines": {
Expand Down
14 changes: 14 additions & 0 deletions plugins/hitokoto.coffee
@@ -0,0 +1,14 @@
###
http://hitokoto.us/
简单来说,一言(ヒトコト)指的是就是一句话,可以是动漫中的台词,可以是小说中的语句,也可以是网络上的各种小段子。
或是感动,或是开心,又或是单纯的回忆,来到这里,留下你所喜欢的那一句句话,与大家分享,这就是一言存在的目的。
###

module.exports = (content ,send, robot, message)->

if content.match /^comic$/i
robot.request.get {url:"http://api.hitokoto.us/rand",json:true}, (e,r,data)->
if data and data.hitokoto
send data.hitokoto
else
send e
2 changes: 2 additions & 0 deletions src/qqbot.coffee
@@ -1,6 +1,7 @@
auth = require './qqauth'
api = require './qqapi'
Log = require 'log'
Request = require 'request'
Dispatcher = require './dispatcher'

log = new Log('debug')
Expand Down Expand Up @@ -33,6 +34,7 @@ class QQBot
@api = api
@dispatcher = new Dispatcher(@config.plugins,@)
@started = true
@request = Request

# @format PROTOCOL `群用户信息`
save_group_member: (group,info)->
Expand Down

0 comments on commit 6e0c8d8

Please sign in to comment.