replchat.js
Advanced tools
Comparing version 1.1.3 to 1.2.0
15
index.js
@@ -5,6 +5,7 @@ const EventEmitter = require('events').EventEmitter | ||
module.exports = class Client extends EventEmitter { | ||
constructor() { | ||
constructor(username) { | ||
// Construct Client | ||
super() | ||
this.username = username | ||
this.socket = {} | ||
@@ -21,3 +22,3 @@ | ||
login(auth) { | ||
login() { | ||
// Authenticate with replchat | ||
@@ -27,3 +28,4 @@ this.socket = io(`https://replchat.bddy.repl.co/`, { | ||
extraHeaders: { | ||
"Cookie": `REPL_AUTH=${auth}` | ||
"X-Replit-User-Name": this.username | ||
// "Cookie": `REPL_AUTH=${auth}` | ||
} | ||
@@ -36,2 +38,9 @@ }); | ||
this.socket.on('debug', (code) => { | ||
if (code == "REQUIRES_IDENTIFY") | ||
this.socket.emit('identify', `${this.username} [BOT]`) | ||
this.emit('debug', code) | ||
}) | ||
this.socket.on('getmessages', () => { | ||
@@ -38,0 +47,0 @@ this.emit('ready') |
{ | ||
"name": "replchat.js", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "A library for making bots with replchat (https://replchat.bddy.repl.co/)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,6 +10,5 @@ # About | ||
You will need to get an auth token for your bot, a tutorial will be provided soon | ||
replchat no longer requires an auth token! Instead, you now put your bots | ||
username in as a parameter when constructiong the class. (More details in examples) | ||
## ! WARNING ! Do NOT share your auth token with ANYONE | ||
# Examples | ||
@@ -21,3 +20,3 @@ | ||
const bot = new ReplBot() | ||
const bot = new ReplBot("TestBot") // Replace "TestBot" with the name of your bot | ||
@@ -28,3 +27,3 @@ bot.on('ready', () => { | ||
bot.login('your-auth-token') | ||
bot.login() | ||
``` | ||
@@ -36,3 +35,3 @@ | ||
const bot = new ReplBot() | ||
const bot = new ReplBot("TestBot") // Replace "TestBot" with the name of your bot | ||
@@ -65,3 +64,3 @@ const config = { | ||
bot.login('your-auth-token') | ||
bot.login() | ||
``` | ||
@@ -68,0 +67,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5704
79
74