Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added !reddit command. #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Christopher-Chianelli
Copy link
Contributor

No description provided.

@@ -78,7 +116,7 @@ public static void main( String[] args )

Configuration botConfiguration =
new Configuration.Builder().setName( ircNick ).setLogin( ircUser ).setRealName( ircRealName ).addServer( ircServerAddress,
ircPort ).addAutoJoinChannel( ircChannel ).setAutoReconnect( true ).addListener( new Vilebot() ).addListener( new AdminManagement() ).addListener( new AdminPing() ).addListener( new Auth() ).addListener( new GetLog() ).addListener( new com.oldterns.vilebot.handlers.admin.Help() ).addListener( new NickChange() ).addListener( new com.oldterns.vilebot.handlers.admin.Ops() ).addListener( new Quit() ).addListener( new AnswerQuestion() ).addListener( new Ascii() ).addListener( new ChatLogger() ).addListener( new Church() ).addListener( new Countdown() ).addListener( new Decide() ).addListener( new Excuses() ).addListener( new FakeNews() ).addListener( new Fortune() ).addListener( new GetInfoOn() ).addListener( new Help() ).addListener( new ImageToAscii() ).addListener( new Inspiration() ).addListener( new Jaziz() ).addListener( new Jokes() ).addListener( new Kaomoji() ).addListener( new Karma() ).addListener( new KarmaRoll() ).addListener( new LastMessageSed() ).addListener( new LastSeen() ).addListener( new Markov() ).addListener( new News() ).addListener( new Omgword() ).addListener( new Ops() ).addListener( new QuotesAndFacts() ).addListener( new RemindMe() ).addListener( new RockPaperScissors() ).addListener( new Trivia() ).addListener( new Ttc() ).addListener( new TwitterCorrection() ).addListener( new UrlTitleAnnouncer() ).addListener( new UrlTweetAnnouncer() ).addListener( new Userlists() ).addListener( new UserPing() ).addListener( new Weather() ).buildConfiguration();
ircPort ).addAutoJoinChannel( ircChannel ).setAutoReconnect( true ).addListener( new Vilebot() ).addListener( new AdminManagement() ).addListener( new AdminPing() ).addListener( new Auth() ).addListener( new GetLog() ).addListener( new com.oldterns.vilebot.handlers.admin.Help() ).addListener( new NickChange() ).addListener( new com.oldterns.vilebot.handlers.admin.Ops() ).addListener( new Quit() ).addListener( new AnswerQuestion() ).addListener( new Ascii() ).addListener( new ChatLogger() ).addListener( new Church() ).addListener( new Countdown() ).addListener( new Decide() ).addListener( new Excuses() ).addListener( new FakeNews() ).addListener( new Fortune() ).addListener( new GetInfoOn() ).addListener( new Help() ).addListener( new ImageToAscii() ).addListener( new Inspiration() ).addListener( new Jaziz() ).addListener( new Jokes() ).addListener( new Kaomoji() ).addListener( new Karma() ).addListener( new KarmaRoll() ).addListener( new LastMessageSed() ).addListener( new LastSeen() ).addListener( new Markov() ).addListener( new News() ).addListener( new Omgword() ).addListener( new Ops() ).addListener( new QuotesAndFacts() ).addListener( new Reddit() ).addListener( new RemindMe() ).addListener( new RockPaperScissors() ).addListener( new Trivia() ).addListener( new Ttc() ).addListener( new TwitterCorrection() ).addListener( new UrlTitleAnnouncer() ).addListener( new UrlTweetAnnouncer() ).addListener( new Userlists() ).addListener( new UserPing() ).addListener( new Weather() ).buildConfiguration();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y'all, what is this line? Ends on column 1645?? At the very least break it up a little:

            Configuration botConfiguration =
                new Configuration.Builder()
                    .setName( ircNick )
                    .setLogin( ircUser )
                    .setRealName( ircRealName )
                    .addServer( ircServerAddress, ircPort )
                    .addAutoJoinChannel( ircChannel )
                    .setAutoReconnect( true )
                    .addListener( new Vilebot() )
                    .addListener( new AdminManagement() )
                    .addListener( new AdminPing() )
                    .addListener( new Auth() )
                    .addListener( new GetLog() )
                    .addListener( new com.oldterns.vilebot.handlers.admin.Help() )
                    .addListener( new NickChange() )
                    .addListener( new com.oldterns.vilebot.handlers.admin.Ops() )
                    .addListener( new Quit() )
                    .addListener( new AnswerQuestion() )
                    .addListener( new Ascii() )
                    .addListener( new ChatLogger() )
                    .addListener( new Church() )
                    .addListener( new Countdown() )
                    .addListener( new Decide() )
                    .addListener( new Excuses() )
                    .addListener( new FakeNews() )
                    .addListener( new Fortune() )
                    .addListener( new GetInfoOn() )
                    .addListener( new Help() )
                    .addListener( new ImageToAscii() )
                    .addListener( new Inspiration() )
                    .addListener( new Jaziz() )
                    .addListener( new Jokes() )
                    .addListener( new Kaomoji() )
                    .addListener( new Karma() )
                    .addListener( new KarmaRoll() )
                    .addListener( new LastMessageSed() )
                    .addListener( new LastSeen() )
                    .addListener( new Markov() )
                    .addListener( new News() )
                    .addListener( new Omgword() )
                    .addListener( new Ops() )
                    .addListener( new QuotesAndFacts() )
                    .addListener( new Reddit() )
                    .addListener( new RemindMe() )
                    .addListener( new RockPaperScissors() )
                    .addListener( new Trivia() )
                    .addListener( new Ttc() )
                    .addListener( new TwitterCorrection() )
                    .addListener( new UrlTitleAnnouncer() )
                    .addListener( new UrlTweetAnnouncer() )
                    .addListener( new Userlists() )
                    .addListener( new UserPing() )
                    .addListener( new Weather() )
                    .buildConfiguration();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VIleBot1 formatter does that. However, this task should be done in a more generic way.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was a running joke tbh, which is why I never bothered to reformat it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running jokes have no place in code, not even in joke code

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the formatter is busted. Alternatively,

Builder builder = new Configuration.Builder();
builder.setName( ircNick );
builder.setLogin( ircUser )
// [...]

@@ -61,7 +61,7 @@
// update cache when new quotes/facts added
private Map<String, Integer> dumpSize = new HashMap<>();

private static final String PASTEBIN_API_URL = Vilebot.getConfig().get("pastebinApiUrl");
private static final String PASTEBIN_API_URL = Vilebot.getConfig().get( "pastebinApiUrl" );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for fixing this formatting, never got around to doing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvn did it for me; if you run mvn clean install it will auto-format your code

Copy link

@cuijulian cuijulian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some good fixes in this PR, +1! Please add some unit tests as well. Refer to NewsTest.java for examples. Other than that looks good!

import java.util.LinkedHashMap;
import java.util.List;
import java.util.regex.Matcher;

public abstract class NewsParser

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this class is used for something other than news parsing, maybe rename it to something more generic like FeedParser? Not a blocker, just a recommendation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants