Reading Message With Bit Handler


#1

Is it possible to read the message that is sent with a cheer? I’m looking to write a script that will update a total value by the amount of the cheer, and looking for a keyword to know which variable to update.

An example would be as follows;

cheer25 #team1

I need to read the #team1 so I can update the right variable.


#2

I don’t see a direct way to do it via the BitsEvent but you might be able to via logging the irc chat and looking for a bit message (Ex: Kappa100).


#3

I suppose we could look at sending the message on the event bus along with the bits, you can enter a feature request for that.


#4

Looks like its only 2 lines of code needing edited along with adding the String to the event. Not sure if the repro is outdated or what since I downloaded it and it had a lot of errors I had to fix just to see how events are done. I’ll definitely submit the feature request, but for now I can just use the bithandler to hardcode what I need in.


#5

Odd, I have no errors:

[morpheus] /opt/iobot/src/master/PhantomBot
illusion% git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
[morpheus] /opt/iobot/src/master/PhantomBot
illusion% git pull
ant clean distAlready up-to-date.
[morpheus] /opt/iobot/src/master/PhantomBot
illusion% ant clean dist
Buildfile: /usr/local/opt/iobot/src/master/PhantomBot/build.xml

git.revision:

post.compile:

clean:
   [delete] Deleting directory /usr/local/opt/iobot/src/master/PhantomBot/build

init:
    [mkdir] Created dir: /usr/local/opt/iobot/src/master/PhantomBot/build
    [mkdir] Created dir: /usr/local/opt/iobot/src/master/PhantomBot/build/classes

git.revision:

pre.compile:
     [echo] PhantomBot Version 2.4.0.3 (f0c175d) (stable)
     [echo] PhantomBot Control Panel Version 1.1

compile.src:
     [echo] Compiling with Java Version 1.8 (1.8.0_102)
    [javac] Compiling 189 source files to /usr/local/opt/iobot/src/master/PhantomBot/build/classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.

post.compile:

jar:
      [jar] Building jar: /usr/local/opt/iobot/src/master/PhantomBot/dist/build/PhantomBot.jar
     [echo] staging javascript-source into resources.
     [copy] Copying 24 files to /usr/local/opt/iobot/src/master/PhantomBot/resources/scripts
     [echo] staging lib folder into resources.
     [copy] Copying 27 files to /usr/local/opt/iobot/src/master/PhantomBot/dist/build
     [echo] staging files into distribution folder.
     [copy] Copying 28 files to /usr/local/opt/iobot/src/master/PhantomBot/dist/PhantomBot-2.4.0.3

dist:
   [delete] Deleting: /usr/local/opt/iobot/src/master/PhantomBot/dist/PhantomBot-2.4.0.3.zip
      [zip] Building zip: /usr/local/opt/iobot/src/master/PhantomBot/dist/PhantomBot-2.4.0.3.zip

BUILD SUCCESSFUL
Total time: 6 seconds

The Nightly has been building without issue and CI would throw an error. What errors did you see trying to compile the Java Core?


#6

This class doesn’t import DiscordUtil

Double ;;

Wrong package declaration

All of tv.phantombot.event.webpanel.websocket has the wrong package declaration.
This also breaks tv.phantombot.panel


#7

In Java the second semi-colon is harmless essentially, hence why the compiler still handles it. I have resolved that but, like I said, never broke the build.

The extend is fine, they are in the same package. If I were to provide a class that doesn’t exist, such as changing the extend to DiscordUtility:

    [javac] /usr/local/opt/iobot/src/master/PhantomBot/source/tv/phantombot/discord/DiscordAPI.java:50: error: cannot find symbol
    [javac] public class DiscordAPI extends DiscordUtility {
    [javac]                                 ^
    [javac]   symbol: class DiscordUtilty

Package definition is fine. It is under tv/phantombot/discord and that is the package.

The webpanel packages are correct, they extend from the base package. If you match the package to the class location:

     [echo] Compiling with Java Version 1.8 (1.8.0_102)
    [javac] Compiling 5 source files to /usr/local/opt/iobot/src/master/PhantomBot/build/classes
    [javac] /usr/local/opt/iobot/src/master/PhantomBot/source/tv/phantombot/event/webpanel/websocket/WebPanelSocketEvent.java:19: error: duplicate class: tv.phantombot.event.webpanel.WebPanelSocketEvent
    [javac] public abstract class WebPanelSocketEvent extends WebPanelEvent {
    [javac]                 ^
    [javac] /usr/local/opt/iobot/src/master/PhantomBot/source/tv/phantombot/event/webpanel/websocket/WebPanelSocketConnectedEvent.java:19: error: cannot access WebPanelSocketEvent
    [javac] public class WebPanelSocketConnectedEvent extends WebPanelSocketEvent {
    [javac]                                                   ^
    [javac]   bad source file: /usr/local/opt/iobot/src/master/PhantomBot/source/tv/phantombot/event/webpanel/websocket/WebPanelSocketEvent.java
    [javac]     file does not contain class tv.phantombot.event.webpanel.websocket.WebPanelSocketEvent
    [javac]     Please remove or make sure it appears in the correct subdirectory of the sourcepath.

I assume you are using a tool to tell you the items that are “broken” ?


#8

I am using the IDE eclipse which is giving me these errors.


#9

Here is my Eclipse IDE (I typically develop without it though) no issues:


#10

So, not sure. You might have additional warnings enabled or some other settings that I do not in my environment.

Cheers!


#11

Also, running in Validation:

So, not entirely sure!


#12

Could you please provide me the link to your github? Because clearly I dont have the right version if you’re seeing DiscordUtil in the same package as the DiscordAPI class.


#13

I git clone from the following via SSH then import as an existing project into Eclipse:

[email protected]:PhantomBot/PhantomBot.git

[Persephone] /cygdrive/c/users/illus/git/PhantomBot
illusion% git remote show origin
* remote origin
  Fetch URL: https://github.com/PhantomBot/PhantomBot.git
  Push  URL: https://github.com/PhantomBot/PhantomBot.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

#14

Honestly though, I only use Eclipse for Spring MVC development. I work on PhantomBot on a Linux server at home and use good old vi to make any changes. Did I mention I am old?

It is quite possible that the build which started before my time as a non-Eclipse project breaks some of the traditional rules of Java and are not caught by the compiler in ant and there might need to be some refactoring required to fit into any additional validations that Eclipse (or another IDE) provides.

So, it could be that Eclipse’s JIT compiler is not happy while the build is “proper.” (Note here I am using double quotes of course :smiley: )


#15

Yeah I’m confused as to why you aren’t getting the same issues I am. I just cloned it from the same link and its the same errors. Its also tells me theres a new version, but that might be because its doesn’t tell me the right version.

[04-18-2018 @ 20:43:08.989 GMT] New PhantomBot Release Detected: v2.4.0.3
[04-18-2018 @ 20:43:08.990 GMT] Release Changelog: https://github.com/PhantomBot/PhantomBot/releases/v2.4.0.3
[04-18-2018 @ 20:43:08.990 GMT] Download Link: https://github.com/PhantomBot/PhantomBot/releases/download/v2.4.0.3/PhantomBot-2.4.0.3.zip

I’m just going to fix the issues and add in the message for the BitEvent since the person I’m writing this script for only needs it for a short time.


#16

I mean to be fair, just going here you can see that its not the same packages that you have.


#17

Oddly, when I do a fresh build I do not get the new version item either. My guess is that the ant build is not executing and properly updating the version file which goes into your build. The version goes into RepoVersion.java file and is compared to the latest in a GitHub API call. My guess is that your RepoVersion.java still has the markers rather than the actual version:

    private static final String phantomBotVersion = "@[email protected]";
    private static final String repoVersion = "@[email protected]";
    private static final String buildType = "@[email protected]";
    private static final String panelVersion = "@[email protected]";

When you build with Eclipse, do you…

image

Right on though. Sorry for the troubles and for badgering you with questions. Appreciate the extra insight, and I may have to import the project differently into Eclipse.


#18

Odd, picture didn’t make it I think:


#19

I dont build with ant no. I’m just telling you the errors that eclipse finds when creating a new project in eclipse with the source files. I do appreciate your time in helping me figure this out.

On another note: Where do I put in a feature request?


#20

I think that explains why the build is wonky for you then and the project isn’t imported as the proper type. Well, proper for us at least :slight_smile: Let me know how you import it, and I can look into that at some point. Thanks again for the additional insight!

Feature Requests:
https://community.phantombot.tv/c/feature-requests

Thanks again!