Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

replchat.js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replchat.js

A library for making bots with replchat (https://replchat.vapwastaken.repl.co/)

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

About

replchat.js is a blazingly fast library for interacting with the replchat API

  • Object-oriented
  • Lightweight
  • Fast

Installation

npm install replchat.js

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:

const ReplBot = require('replbot.js')

const bot = new ReplBot()

bot.on('ready', () => {
  console.log('Bot is logged in!')
})

bot.login('your-auth-token')

After this we can add a simple command system:

const ReplBot = require('replbot.js')

const bot = new ReplBot()

const config = {
  prefix: '!'
}

const commands = [
  'ping'
]

bot.on('ready', () => {
  console.log('Bot is logged in!')
})

bot.on('message', (message) => {
  if (!message.content.startsWith(config.prefix)) return;

  var fullCommand = message.content.substr(config.prefix.length).split(" ")
  var command = fullCommand[0]
  var args = fullCommand.splice(0, 1)

  if (commands.includes(command)) {
    if (command === 'ping')
      message.reply('pong!')
  } else
    message.reply(`Invalid Command! Use \`${config.prefix}help\` for a list of valid commands!`)
})

bot.login('your-auth-token')

Events

Currently there are 10 events, they are as follows:

  • 'connected': called when the bot has connected
  • 'ready': called when the bot is connected and ready
  • 'message': called when a message is sent
  • 'left': called when a user leaves
  • 'joined': called when a user joins
  • 'refreshed': called when admin.refreshall is called
  • 'announcement': called when an announcement is made
  • 'error': used when an error occurs (such as the bot was banned or kicked)
  • 'debug': not currently used by replchat

Keywords

FAQs

Package last updated on 01 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc