Compiling from Source.

61 views
Skip to first unread message

Kevin G.

unread,
May 30, 2015, 10:42:39 AM5/30/15
to pirc...@googlegroups.com
I want to compile pircbotx from Source, but everytime i try to build it, i get alot of PircBotX missing methods errors.
All depencies have been added :)
Any ideas?

Leon Blakey

unread,
May 30, 2015, 11:46:36 AM5/30/15
to pirc...@googlegroups.com
Most likely from project lombok, see here: https://projectlombok.org/download.html

Also PircBotX is moving to github, the most recent code is here: https://github.com/thelq/pircbotx . Mercurial mirror is still a work in progress

--
You received this message because you are subscribed to the Google Groups "pircbotx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pircbotx+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin G.

unread,
May 30, 2015, 12:34:29 PM5/30/15
to pirc...@googlegroups.com
Thanks for that, and realy greatwork on that Project :)
I'm gonna add the ability to parse IRCv3 Usertags, because i need that and pircbotx doesn't handle them yet.
There was no raw message on a event to parsethem there, so i need to add it to the Source :( 

Leon Blakey

unread,
May 30, 2015, 12:51:21 PM5/30/15
to pirc...@googlegroups.com

--

Kevin G.

unread,
May 30, 2015, 1:25:45 PM5/30/15
to pirc...@googlegroups.com
I have lombok in my library list but i still get enough errors
Channel:67 -> return bot.getConfiguration().getBotFactory().createOutputChannel(bot, Channel.this);
PircBotX doesn't have a getConfiguration() method. 

Kevin G.

unread,
May 30, 2015, 4:02:44 PM5/30/15
to pirc...@googlegroups.com
I'm not able to get this compiling fine, now i installed Maven and it stills throws alot of errors.
For Example:
ActionEvent.java
Syntax error on tokens, AnnotationName expected instead on the import statements wtf?
import javax.annotation.Nullable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;
import org.pircbotx.UserHostmask;
import org.pircbotx.hooks.Event;
import org.pircbotx.hooks.types.GenericChannelUserEvent;
import org.pircbotx.hooks.types.GenericMessageEvent;

All i want is write a simple tags parser, since there is no way off getting raw irc input lines or?

Leon Blakey

unread,
May 30, 2015, 4:11:55 PM5/30/15
to pirc...@googlegroups.com
Builds fine on my machine and on Travis CI ( https://travis-ci.org/TheLQ/pircbotx/builds/61071722 ). What IDE are you using? Did you follow the instructions on the project lombok downloads page?

I can answer your tags parser question if you tell me which tags feature your implementing.



--

Kevin G.

unread,
May 30, 2015, 4:23:36 PM5/30/15
to pirc...@googlegroups.com
I just need to get the list of tags. For Twitch
IDE is Eclipse. I installed Lombok by run it direct and installed/updated eclipse with it.

Leon Blakey

unread,
May 30, 2015, 5:40:43 PM5/30/15
to pirc...@googlegroups.com
... ok, that didn't answer my question. I tried it myself and your implementing this ( https://github.com/ircv3/ircv3-specifications/blob/master/core/message-tags-3.2.md ). I'm going to try to help you so you don't have to build or extend PircBotX

First, twitch.tv doesn't use a standard IRC server and instead wrote their own non-standard, broken version. They don't support CAP LS which breaks PircBotX's CAP handling but they do support CAP REQ :twitch.tv/tags. Add this to your listener

@Override
    public void onServerResponse(ServerResponseEvent event) throws Exception {
        if(event.getCode() == 376) {
            event.getBot().sendRaw().rawLineNow("CAP REQ :twitch.tv/tags");
        }
    }

Now every message is dispatched as an UnknownEvent as its not parsable anymore. It will be easier if I implement it in the parser cause I have to add tests to make sure it doesn't break anything. However until then, here's a basic implementation you can add to your listener:

@Override
    public void onUnknown(UnknownEvent event) throws Exception {
        String raw = event.getLine();
        if(!raw.contains("PRIVMSG"))
            return;
        String[] rawParts = StringUtils.split(raw, " ", 5);
       
        //Parse tags, starts with @
        String tagsRaw = rawParts[0].substring(1);
        ImmutableMap.Builder<String, String> tagsBuilder = ImmutableMap.builder();
        for(String entry : StringUtils.split(tagsRaw, ";")) {
            String[] entryParts = StringUtils.split(entry, "=");
            String key = entryParts[0];
            String value = entryParts.length > 1 ? entryParts[1] : "";
            tagsBuilder.put(key, value);
        }
       
        UserChannelDao<User, Channel> userChannelDao = event.getBot().getUserChannelDao();
       
        //Twitch doesn't support WHO and NAMES only has the ops, also starts with a colon
        String userRaw = rawParts[1].substring(1);
        UserHostmask user = event.getBot().getConfiguration().getBotFactory().createUserHostmask(event.getBot(), userRaw);
       
        //Channel (skip PRIVMSG)
        Channel channel = userChannelDao.getChannel(rawParts[3]);
       
        //Message, removing colon prefix
        String message = rawParts[4].substring(1);
       
        onTwitchMessage(tagsBuilder.build(), user, channel, message);
    }
   
    private void onTwitchMessage(ImmutableMap<String, String> tags, UserHostmask user, Channel channel, String message) {
        log.debug("Got message tags {} user {} channel {} message {}", tags, user, channel, message);
    }

Testing this on my machine I get

INFO  org.pircbotx.InputParser - @color=;display-name=TheLQ2;emotes=;subscriber=0;turbo=0;user-type=;user_type= :thelq2!the...@thelq2.tmi.twitch.tv PRIVMSG #thelq2 :test
DEBUG org.pircbotx.impl.PircBotXExample - Got message tags {color=, display-name=TheLQ2, emotes=, subscriber=0, turbo=0, user-type=, user_type=} user UserHostmask(extbanPrefix=null, nick=thelq2, login=thelq2, hostname=thelq2.tmi.twitch.tv) channel Channel(name=#thelq2, channelId=ab86e0eb-e54d-4fa5-9762-8238589a5c9c, ...) message test

That should get the job done until I can properly implement message tags

Hope this helps
-Leon

Kevin G.

unread,
May 30, 2015, 5:54:55 PM5/30/15
to pirc...@googlegroups.com
If you got a good parser you can add Getter/Setter on Events for getTags for example then :)
I never noticed problems when using pircbotx o ntwitch

Kevin G.

unread,
May 31, 2015, 5:17:33 AM5/31/15
to pirc...@googlegroups.com
Finnaly
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1:03.541s
Finished at: Sun May 31 11:17:06 CEST 2015
Final Memory: 33M/402M
------------------------------------------------------------------------
Now i can work on the tags parser and implement it.
I thougt about a Methond on events like getIRCv3Tags(). Wich returns a map with the Tags and the assigned values.
The map should be empty if there are no tags enabled or we got no from the Server.

Kevin G.

unread,
May 31, 2015, 7:20:34 AM5/31/15
to pirc...@googlegroups.com
Here is now a first example, maybe you can integrate it better:

    @Override
    public void onMessage(MessageEvent event)
    {
        System.out.println(String.format("[%s] %s", event.getUser().getNick(), event.getMessage()));
        System.out.println("IRC v3 Tags: " + event.getV3Tags().toString());
    }

Tested on Twitch:
[DQKev] Test
[main] INFO org.pircbotx.InputParser - @color=#FF4500;display-name=DQKev;emotes=1:14-15;subscriber=1;turbo=0;user-type=mod;user_type=mod :dqkev!dq...@dqkev.tmi.twitch.tv PRIVMSG #mrmaikap :Test
IRC v3 Tags: {user-type=mod, subscriber=1, user_type=mod, color=#FF4500, display-name=DQKev, emotes=1:14-15, turbo=0}

With disabeld tags:
[main] INFO org.pircbotx.InputParser - :dqkev!dq...@dqkev.tmi.twitch.tv PRIVMSG #mrmaikap :blubb
[DQKev] blubb
IRC v3 Tags: {}

The Parser checks if there are usertags and remove that part of the current input line, so that your InputParser can proceed on the correct line.
Maybe there is a better way of integrate it with the Events
Reply all
Reply to author
Forward
0 new messages