Skip 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.

AltChat addition Question

Featured Replies

Hey everyone,

I am looking for any kind of guide or information on how to add the AltChat chatbot to my script I’m making. I know @ProjectPact and a few other scripters have it in their scripts, and can honestly say it makes a difference. My accounts are lasting much longer, and the conversations are actually really good (and sometimes really funny). I sent @ProjectPact a message, but he has not read it yet.

Any help would be great

Thank You!

What exactly do you need that isnt already on their website?

6 hours ago, FastNEasy said:

Hey everyone,

I am looking for any kind of guide or information on how to add the AltChat chatbot to my script I’m making. I know @ProjectPact and a few other scripters have it in their scripts, and can honestly say it makes a difference. My accounts are lasting much longer, and the conversations are actually really good (and sometimes really funny). I sent @ProjectPact a message, but he has not read it yet.

Any help would be great

Thank You!

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Base64;

public class API {

	public static void main(String[] args) throws IOException {
		String message = "Hello, how are you?";
		String email = "EMAIL";
		String apiKey = "API_KEY";
		String token = authenticate(email + ":" + apiKey);

		System.out.println("provided token:" + token);
		System.out.println("please type exit to terminate chat");
		System.out.println("chatbot:" + chat(token, message));
	}

	public static String authenticate(String usrCredit) {
		String userAuth = usrCredit;
		String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString(userAuth.getBytes());

		BufferedReader httpResponseReader = null;
		String result = "";
		try {

			// Connect to the web server endpoint
			URL serverUrl = new URL("http://api.altchat.app/login");

			HttpURLConnection urlConnection = (HttpURLConnection) serverUrl.openConnection();

			// Set HTTP method as GET
			urlConnection.setRequestMethod("GET");

			// Include the HTTP Basic Authentication payload
			urlConnection.addRequestProperty("Authorization", basicAuthPayload);

			// Read response from web server, which will trigger HTTP Basic Authentication
			// request to be sent.
			httpResponseReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
			String lineRead;
			while ((lineRead = httpResponseReader.readLine()) != null) {
				result = result + lineRead;
			}

		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (httpResponseReader != null) {
				try {
					httpResponseReader.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

		result = result.split(":")[1];
		result = result.replaceAll("}", "");
		result = result.replaceAll("\"", "");
		return result;
	}

	public static String chat(String token, String sent) throws IOException {
		URL url = new URL("http://api.altchat.app/" + token);
		HttpURLConnection con = (HttpURLConnection) url.openConnection();
		con.setRequestMethod("POST");
		con.setRequestProperty("Content-Type", "application/json; utf-8");
		con.setRequestProperty("Accept", "application/json");
		con.setDoOutput(true);
		String result = "";
		String jsonInputString = "{\"message\": \"" + sent + "\"}";

		try (OutputStream os = con.getOutputStream()) {
			byte[] input = jsonInputString.getBytes("utf-8");
			os.write(input, 0, input.length);
		}

		try (BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"))) {
			StringBuilder response = new StringBuilder();
			String responseLine = null;
			while ((responseLine = br.readLine()) != null) {
				response.append(responseLine.trim());
			}

			result = response.toString();
		}
		return result;
	}
}

 

Edited by Medusa

Hi @FastNEasy,

Sorry, I was asleep and didn’t see your private message. I assume you’re referring to hooking it up to your script and not just grabbing the source off their site.

I’ve actually had a lot of people asking how to add it because Cleverbot is definitely not the move anymore lol. Give me a little and I’ll release a snippet for you so you can add it to your script. 

 

 

EDIT: Here you go @FastNEasy

 

Edited by ProjectPact

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.