├── LICENSE
├── Procfile
├── README.md
├── dependency-reduced-pom.xml
├── pom.xml
├── src
└── main
│ └── java
│ └── MyBot
│ └── MyBot.java
└── target
├── classes
└── MyBot.class
├── gs-maven-0.1.0.jar
├── maven-archiver
└── pom.properties
├── maven-status
└── maven-compiler-plugin
│ └── compile
│ └── default-compile
│ ├── createdFiles.lst
│ └── inputFiles.lst
└── original-gs-maven-0.1.0.jar
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Sadra Aliabadi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | worker: java -cp target/gs-maven-0.1.0.jar MyBot
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## [@GithubFa](https://twitter.com/GithubFa)
2 | [](https://github.com/01sadra/GithubFa/blob/master/LICENSE)
3 | [](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2F01sadra%2FGithubFa)
4 | [](https://github.com/01sadra/GithubFa/network)
5 |
6 | A simple twitter bot for creating a Newsfeed from the Github repositories which is shared by Persian developer community
7 | based on [twitter4j libarary](http://twitter4j.org/en/index.html).
8 |
9 | I built it with maven and deployed on Heroku without IDE. Maybe Eclipse or Netbeans can't recognize the project.
10 |
11 | [Here](http://twitter4j.org/en/configuration.html) you can find some ways for configuring Twitter4J. In this project, I choosed the last one.
12 |
13 | # Contribution
14 | You can fork the repo, improve or fix it. If you want to apply your changes here, send a pull request. It will make me happy.
15 | :heart:
16 |
17 |
--------------------------------------------------------------------------------
/dependency-reduced-pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | org.springframework
5 | gs-maven
6 | 0.1.0
7 |
8 |
9 |
10 | maven-shade-plugin
11 | 2.1
12 |
13 |
14 | package
15 |
16 | shade
17 |
18 |
19 |
20 |
21 | hello.HelloWorld
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | org.springframework
6 | gs-maven
7 | jar
8 | 0.1.0
9 |
10 |
11 | org.twitter4j
12 | twitter4j-core
13 | [4.0,)
14 |
15 |
16 |
17 |
18 |
19 | org.apache.maven.plugins
20 | maven-shade-plugin
21 | 2.1
22 |
23 |
24 | package
25 |
26 | shade
27 |
28 |
29 |
30 |
32 | hello.HelloWorld
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/main/java/MyBot/MyBot.java:
--------------------------------------------------------------------------------
1 | import twitter4j.Status;
2 | import twitter4j.Twitter;
3 | import twitter4j.TwitterException;
4 | import twitter4j.TwitterFactory;
5 | import twitter4j.Query;
6 | import twitter4j.QueryResult;
7 | import twitter4j.StatusUpdate;
8 | import twitter4j.RateLimitStatus;
9 | import java.util.*;
10 |
11 | public class MyBot{
12 | //If something goes wrong, we might see a TwitterException
13 | public static void main(String... args) throws TwitterException{
14 | //Access the twitter API using your twitter4j.properties file
15 | Twitter twitter = TwitterFactory.getSingleton();
16 | //search for all tweets that include "github.com" and their lang is fa
17 | Query query = new Query("\"github.com\" AND lang:fa");
18 | QueryResult result = twitter.search(query);
19 |
20 | try {
21 | // Retweet the last 5 query
22 | for (int i =0; i <= 4 ; i++ ){
23 | Status tweetResult = result.getTweets().get(i);
24 | long statusId = tweetResult.getId();
25 | //Did retweeted by me or not
26 | if(tweetResult.isRetweetedByMe()) {
27 | System.out.println("we retweeted this before");
28 | System.out.println(statusId);
29 | }else{
30 | //Retweet the tweet
31 | twitter.retweetStatus(statusId);
32 | }
33 | //sleep for 30 min
34 | System.out.println("sleeping ");
35 | Thread.sleep(60*1000*30);
36 | }
37 | } catch (Exception e){
38 | System.out.println(e);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/target/classes/MyBot.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/01sadra/GithubFa/343a78c29ef1ef531ed06b6318a72f2c450471d8/target/classes/MyBot.class
--------------------------------------------------------------------------------
/target/gs-maven-0.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/01sadra/GithubFa/343a78c29ef1ef531ed06b6318a72f2c450471d8/target/gs-maven-0.1.0.jar
--------------------------------------------------------------------------------
/target/maven-archiver/pom.properties:
--------------------------------------------------------------------------------
1 | #Generated by Maven
2 | #Fri Jan 27 18:33:32 IRST 2017
3 | version=0.1.0
4 | groupId=org.springframework
5 | artifactId=gs-maven
6 |
--------------------------------------------------------------------------------
/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | MyBot.class
2 |
--------------------------------------------------------------------------------
/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | /home/sadra/MyBots/initial/src/main/java/MyBot/MyBot.java
2 |
--------------------------------------------------------------------------------
/target/original-gs-maven-0.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/01sadra/GithubFa/343a78c29ef1ef531ed06b6318a72f2c450471d8/target/original-gs-maven-0.1.0.jar
--------------------------------------------------------------------------------