node-replit-comment-bot

1.0.10 • Public • Published

Node Replit Comment Bot

import Bot from 'node-replit-comment-bot'
// Open your secrets tab and set SID to your connect.sid cookie
const bot = new Bot(process.env.SID)

// Ping is the command
bot.on('ping', (comment) => {
	// Do whatever here
	bot.reply(comment.parent.id, `Pong!`) // You have to reply to the first comment in the chain
})

bot.start() // Start the bot

The comment object will look like this:

{
	id: Int,
	user: String,
	body: String,
 	command: String,
	args: [String],
	repl: {
		id: String,
		title: String,
		description: String,
		user: String
	},
	parent: {
		id: Int,
		user: String,
		body: String,
		replies: [{
			id: Int,
			user: String,
			body: String,
		}]
	}
}

You can do this to handle all comments

bot.on('*', (comment) => {
	
})

Install

DownloadsWeekly Downloads

28

Version

1.0.10

License

ISC

Unpacked Size

14 kB

Total Files

11

Last publish

Collaborators

  • pikachub2005