Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

gerwinb500

Members
  • Joined

  • Last visited

Everything posted by gerwinb500

  1. Pusher takes care of maintaning the connections, authentication etc. If I would use a socket server I would have to implement all this by myself.
  2. As far as I can tell there are two other java-pusher libraries which both use the GSON library for JSON parsing. So these probably also use reflection. The source code is available on GitHub, so maybe I can do a few adjustments to get rid of the error. I will try your suggestion. Thank you for your help.
  3. Finaly managed to solve the problem. I needed to allow reflection in the OsBot client. Even tough I now get the following uncaught exception: java.lang.RuntimeException: Unable to invoke no-args constructor for class com.pusher.client.channel.impl.PresenceChannelImpl$Presence. Registering an InstanceCreator with Gson for this type may fix this problem. at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:228) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212) at com.google.gson.Gson.fromJson(Gson.java:927) at com.google.gson.Gson.fromJson(Gson.java:892) at com.google.gson.Gson.fromJson(Gson.java:841) at com.google.gson.Gson.fromJson(Gson.java:813) at com.pusher.client.channel.impl.PresenceChannelImpl.extractPresenceDataFrom(PresenceChannelImpl.java:162) at com.pusher.client.channel.impl.PresenceChannelImpl.handleSubscriptionSuccessfulMessage(PresenceChannelImpl.java:100) at com.pusher.client.channel.impl.PresenceChannelImpl.onMessage(PresenceChannelImpl.java:58) at com.pusher.client.channel.impl.ChannelManager.onMessage(ChannelManager.java:116) at com.pusher.client.connection.websocket.WebSocketConnection.handleEvent(WebSocketConnection.java:177) at com.pusher.client.connection.websocket.WebSocketConnection.access$600(WebSocketConnection.java:27) at com.pusher.client.connection.websocket.WebSocketConnection$6.run(WebSocketConnection.java:261) at com.pusher.client.util.Factory$1.run(Factory.java:119) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.UnsupportedOperationException: Cannot allocate class com.pusher.client.channel.impl.PresenceChannelImpl$Presence at com.google.gson.internal.UnsafeAllocator$4.newInstance(UnsafeAllocator.java:104) at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:225) ... 16 more Everything seems to work fine. Would like to fix this tho.
  4. It seems that you are right. When I try to connect to a public channel where no authorization is required, I get the following exception: java.security.AccessControlException: access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at org.osbot.LpT7.checkPermission(ns:156) at java.lang.reflect.AccessibleObject.setAccessible(Unknown Source) at com.google.gson.internal.reflect.PreJava9ReflectionAccessor.makeAccessible(PreJava9ReflectionAccessor.java:31) at com.google.gson.internal.ConstructorConstructor.newDefaultConstructor(ConstructorConstructor.java:103) at com.google.gson.internal.ConstructorConstructor.get(ConstructorConstructor.java:85) at com.google.gson.internal.bind.MapTypeAdapterFactory.create(MapTypeAdapterFactory.java:127) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.Gson.toJson(Gson.java:696) at com.google.gson.Gson.toJson(Gson.java:683) at com.google.gson.Gson.toJson(Gson.java:638) at com.google.gson.Gson.toJson(Gson.java:618) at com.pusher.client.channel.impl.ChannelImpl.toSubscribeMessage(ChannelImpl.java:132) at com.pusher.client.channel.impl.ChannelManager$1.run(ChannelManager.java:149) at com.pusher.client.util.Factory$1.run(Factory.java:119) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) This exception is thrown when this line of code is executed in the pusher-websocket-java library: GSON.toJson(jsonObject); This is probably also the reason why subscibing to a presence channel doesn't work. It seems that OsBot blocks some functionallity of the GSON library due to secuirity reasons. I don't know why tho. Does anybody know a way to solve this problem?
  5. Thank you both for your reaction. @Nbacon Yes, the authentication works when I run it outside of OsBot. Also, the authentication works in OsBot when running OsBot in debug mode as I mentioned above. Maybe I could try your possible fix if you still think it can help? @Jarl I probably should've mentioned this before, but the code has exited before it even makes a subscribe request to Pusher. If I check in the Pusher debug console, I can see the client has connected. But I don't see any subscription request/failure in the debug console or the error logs. So the script throws an exception before it even sends a subscribe request to Pusher. If the problems was one of those you mentioned, I probably should've seen it in the Pusher debug consolse/error logs. I think the problem has something to do with the GSON library. In the error below (also mentioned above) you can see that the server responded correctly. Otherwise the channel_data would not match the correct values. Authentication failure due to [Unable to parse response from Authorizer: {"auth":"315578f9acfb71d039d6:f0487dc4d6e28bfed9a556366afb2ff8ef660dc36de5864f6a426f696a028406","channel_data":"{\"user_id\":5,\"user_info\":{\"id\":5,\"name\":\"name\",\"email\":\"name@name.com\",\"type\":\"bot\",\"botpass\":\"pass\",\"server\":1,\"is_mule\":0,\"stage\":\"readybot\",\"is_online\":0,\"email_verified_at\":null,\"api_token\":\"{the correct api token}\",\"created_at\":\"2021-01-28T17:14:00.000000Z\",\"updated_at\":\"2021-01-28T17:14:00.000000Z\"}}"}], exception was [com.pusher.client.AuthorizationFailureException: Unable to parse response from Authorizer: {"auth":"315578f9acfb71d039d6:f0487dc4d6e28bfed9a556366afb2ff8ef660dc36de5864f6a426f696a028406","channel_data":"{\"user_id\":5,\"user_info\":{\"id\":5,\"name\":\"name\",\"email\":\"name@name.com\",\"type\":\"bot\",\"botpass\":\"pass\",\"server\":1,\"is_mule\":0,\"stage\":\"readybot\",\"is_online\":0,\"email_verified_at\":null,\"api_token\":\"{the correct api token}\",\"created_at\":\"2021-01-28T17:14:00.000000Z\",\"updated_at\":\"2021-01-28T17:14:00.000000Z\"}}"}] Logging the response from pusher is not possible because the code throws an exception before sending a subscribe request. Maybe someone can explain what the difference is between starting OsBot from intellij like I mentioned above, and starting OsBot the normal way?
  6. Thank you for your reaction. You are right, I should've put the error in. Here it is: Authentication failure due to [Unable to parse response from Authorizer: {"auth":"315578f9acfb71d039d6:f0487dc4d6e28bfed9a556366afb2ff8ef660dc36de5864f6a426f696a028406","channel_data":"{\"user_id\":5,\"user_info\":{\"id\":5,\"name\":\"name\",\"email\":\"name@name.com\",\"type\":\"bot\",\"botpass\":\"pass\",\"server\":1,\"is_mule\":0,\"stage\":\"readybot\",\"is_online\":0,\"email_verified_at\":null,\"api_token\":\"{the correct api token}\",\"created_at\":\"2021-01-28T17:14:00.000000Z\",\"updated_at\":\"2021-01-28T17:14:00.000000Z\"}}"}], exception was [com.pusher.client.AuthorizationFailureException: Unable to parse response from Authorizer: {"auth":"315578f9acfb71d039d6:f0487dc4d6e28bfed9a556366afb2ff8ef660dc36de5864f6a426f696a028406","channel_data":"{\"user_id\":5,\"user_info\":{\"id\":5,\"name\":\"name\",\"email\":\"name@name.com\",\"type\":\"bot\",\"botpass\":\"pass\",\"server\":1,\"is_mule\":0,\"stage\":\"readybot\",\"is_online\":0,\"email_verified_at\":null,\"api_token\":\"{the correct api token}\",\"created_at\":\"2021-01-28T17:14:00.000000Z\",\"updated_at\":\"2021-01-28T17:14:00.000000Z\"}}"}] As you can see my local http server, which handles the authorization, responses with correct message. Only the message cannot be parsed for some reason. The Pusher-websocket-java library I downloaded comes with it's dependencies. I got it from here. Also I checked if the dependencies for the library it self where there, and they where. It contains both the GSON and Websocket dependency. I also tried to download and use the Pusher-websocket-java library without the dependencies, and added the dependencies manually, but I still got the same error. My artifacts tab looks tike this: I extracted the Pusher-websocket-java, and some other libraries, into the output root. Am I missing something?
  7. Currently I'm working on a script that supports communication trough Pusher (websockets). For this I use the Pusher-websocket-java library. I've been trying to get some code working that connects to Pusher and subscribes to a Presence channel. Connecting to Pusher is no problem at all, but when I try to subscribe to the prescence channel I receive an error. After some trial and error, I decided to try and debug the script with intellij as explained here. This is how I found out that the code works whenever I start the OsBot client from intellij. I believe it has something to do with the this: Based on this I think the problem is that the Pusher library is not build the right way. But I don't get any missing library errors, and connecting to Pusher does work which uses the same library.... I added the Pusher library to the output root. I think this is the right way to use external libraries in OsBot? In short: The Pusher library only works whenever I use the debugger. Any suggestions on how to fix this?
  8. Already fixed it, thanks for replies tho. I started programming java about a week ago, so I'm still a noob lol
  9. I think understand what you mean, but I don't know how to implement the nul check of w and w.getInteractActions(). Could you maybe write a sample code or explain?
  10. Hi everyone. Currently I'm working on a script that buys items needed. Unfortunatly , I ran in to a problem. When buying the item, I want it to press the +5% button in the buy screen. To do this I need to filter out this button. Since I'm not willing to use ID's, I tried filtering on interact actions. This is the code I used: RS2Widget plusButton = getWidgets().singleFilter(getWidgets().getAll(), w -> w.getInteractActions()[0].equals("+5%")); plusButton.interact(); When I run this code, the OSBot logger returns the following error: [ERROR][Bot #1][03/23 05:07:58 PM]: Error in script executor! java.lang.NullPointerException at PlainPizzaMaker.buyItem(PlainPizzaMaker.java:130) at PlainPizzaMaker.onLoop(PlainPizzaMaker.java:116) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(nj:193) at java.lang.Thread.run(Unknown Source) Any suggestions on how to fix it and why it's not working?

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.