Closed devth closed 8 years ago
Hey there, I'm new to Clojure and would like to tackle this issue. I guess at some point I will be asking a few questions ;)
Awesome, feel free to ask anytime!
Here's a few suggestions to get started.
You'll want to add a subcommand regex after this line: https://github.com/devth/yetibot/blob/db13cd00f3f84e0d69e40cf9e1144bb1e6d4263d/src/yetibot/commands/twitter.clj#L87
Something like:
#"^show\s+(\S+)" show
That will send all twitter show <username>
commands to a show
function, which will look something like:
(defn show
"twitter show <screen-name> # show the top 10 tweets from <screen-name>"
[{[_ screen-name] :match}]
;; TODO, use the twitter `model` to do get results from twitter api
)
Command handlers (such as show
and lookup
) get a map of args including things like the matched regex, raw args, user, etc. We're only interested in :match
here - it contains the result of applying re-find
to your regex and the string. For example:
yetibot.core.repl=> (re-find #"show\s+(\S+)" "show yetibot")
["show yetibot" "yetibot"]
Since the first item in the vector is the full string, we ignore it and destructure the 2nd item into screen-name
: {[_ screen-name] :match}
.
Ping me if you need to!
Thanks for providing the awesome hints! Will start working on it this evening after work.
Can we still contribute?
hey, i got a basic implementation done. i will push to my fork this evening after work. maybe you want to have a look and help me get this done? i'm still new to clojure, so there will be enough space for improvements.
I had the repo on my work machine, so I could send a PR. Please have a look at the code
@dev-hartmann responded on your PR.
@manalipankaj yep, you're welcome to contribute!
Fixed by #569
Show the top 10 tweets for
username
. Maybe include options to exclude retweets and replies. Related: #552