Skip to content

Instantly share code, notes, and snippets.

@ikr7
Created August 26, 2015 16:32
Show Gist options
  • Save ikr7/ae60ba50ed14fb27604f to your computer and use it in GitHub Desktop.
Save ikr7/ae60ba50ed14fb27604f to your computer and use it in GitHub Desktop.
便利システム(便利〜!)
require! {
\twitter : Twitter
}
class TwitterProxy
(keys, targetScreenName) ->
@account = new Twitter keys
@rules = []
(stream) <~ @account.stream \user, _
stream.on \data, (data) ~>
if data.text and data.user.screen_name is targetScreenName
text = @rules.reduce ((p, c) -> c(p)), data.text
@account.post \statuses/update, status: text, ->
module.exports = TwitterProxy
require! {
\twitter : Twitter
\./twitter-proxy : TwitterProxy
}
IKR7GYAZO_KEYS =
consumer_key : \iamuniverse
consumer_secret : \mypenisisverystrong
access_token_key : \sexsexsex
access_token_secret: \aaaaaaaa
tp = new TwitterProxy(IKR7GYAZO_KEYS, \lk_uta);
tp.rules.push (text) -> text.replace '痴漢', '$chikan$'
tp.rules.push (text) -> text.replace '置換', '痴漢'
tp.rules.push (text) -> text.replace '$chikan$', '置換'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment