replchat.js
Advanced tools
Comparing version 1.0.8 to 1.1.0
24
index.js
@@ -0,6 +1,6 @@ | ||
const EventEmitter = require('events').EventEmitter | ||
const io = require("socket.io-client"); | ||
const EventEmitter = require('events').EventEmitter | ||
module.exports = class Client extends EventEmitter { | ||
constructor(beta = false) { | ||
constructor() { | ||
super() | ||
@@ -10,5 +10,2 @@ | ||
// this.username = username | ||
this.beta = beta | ||
this.last = "" | ||
@@ -21,6 +18,2 @@ } | ||
disconnect() { | ||
this.socket.disconnect() | ||
} | ||
login(auth) { | ||
@@ -30,3 +23,2 @@ this.socket = io(`https://replchat.vapwastaken.repl.co/`, { | ||
extraHeaders: { | ||
// "X-Replit-User-Name": `${this.username}` | ||
"Cookie": `REPL_AUTH=${auth}` | ||
@@ -40,7 +32,2 @@ } | ||
this.socket.on('debug', (code) => { | ||
if (code === "REQUIRES_IDENTIFY") this.socket.emit('identify', `${this.username} [BOT]`) | ||
this.emit('debug', code) | ||
}) | ||
this.socket.on('getmessages', () => { | ||
@@ -78,3 +65,3 @@ this.emit('ready') | ||
this.emit('error', { | ||
'0': 'banned' | ||
data: 'banned' | ||
}) | ||
@@ -85,3 +72,3 @@ }) | ||
this.emit('error', { | ||
'0': 'kicked' | ||
data: 'kicked' | ||
}) | ||
@@ -94,4 +81,3 @@ }) | ||
username: data.username, | ||
avatar: data.pfp, | ||
bot: data.username.endsWith(' [BOT]') | ||
avatar: data.pfp | ||
}, | ||
@@ -98,0 +84,0 @@ content: data.message, |
{ | ||
"name": "replchat.js", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"description": "A library for making bots with replchat (https://replchat.vapwastaken.repl.co/)", | ||
@@ -15,3 +15,10 @@ "main": "index.js", | ||
"socket.io-client": "^4.4.1" | ||
}, | ||
"homepage": "https://github.com/AnyMinorDeerPanda/replchat.js#readme", | ||
"repository": "github:AnyMinorDeerPanda/replchat.js", | ||
"bugs": { | ||
"url" : "https://github.com/AnyMinorDeerPanda/replchat.js/issues", | ||
"email" : "contact@xtract.space" | ||
} | ||
} |
# About | ||
replchat.js is a blazingly fast library for making replchat bots that is Object-oriented | ||
replchat.js is a blazingly fast library for interacting with the replchat API | ||
- Object-oriented | ||
- Lightweight | ||
- Fast | ||
# Installation | ||
npm install replchat.js | ||
`npm install replchat.js` | ||
# Examples | ||
You will need to get an auth token for your bot however, in the future there may be a better method | ||
You will need to get an auth token for your bot, a tutorial will be provided soon | ||
## ! WARNING ! Do NOT share your auth token with ANYONE | ||
# Examples | ||
Basic Bot: | ||
``` | ||
```js | ||
const ReplBot = require('replbot.js') | ||
@@ -26,3 +30,3 @@ | ||
After this we can add a simple command system: | ||
``` | ||
```js | ||
const ReplBot = require('replbot.js') | ||
@@ -53,5 +57,5 @@ | ||
if (command === 'ping') | ||
bot.send('pong!') | ||
message.reply('pong!') | ||
} else | ||
bot.send(`Invalid Command! Use \`${config.prefix}help\` for a list of valid commands!`) | ||
message.reply(`Invalid Command! Use \`${config.prefix}help\` for a list of valid commands!`) | ||
}) | ||
@@ -58,0 +62,0 @@ |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
75
5454
70