likes

Auto-like module.

Watches threads for new posts and likes them, includes "binge" functionality to catch up with likes on older posts

Author: Accalia
License: MIT

likes.prepare(plugConfig, config, events, browser)

Prepare plugin prior to login

Kind: static method of likes

Param Type Description
plugConfig * Plugin specific configuration
config Config Overall Bot Configuration
events externals.events.SockEvents EventEmitter used for the bot
browser Browser Web browser for communicating with discourse

likes.start()

Start the plugin after login

Kind: static method of likes

likes.stop()

Stop the plugin prior to exit or reload

Kind: static method of likes

likes.messageHandler(data, topic, post)

Like the new post.

In the event of Discourse returning an HTTP 5xx status code, the like attempt will be retried up to a maximum of three attempts; if after three attempts Discourse is still returning 5xx codes, it is safe to assume that it is in the middle of a cooties storm, and there is therefore no point in continuing to retry the like action and placing unnecessary extra load on the server.

Kind: static method of likes

Param Type Description
data external.notifications.notification Notification data
topic external.topics.Topic Topic containing post generating notification
post external.posts.CleanedPost Post that generated notification

likes.binge()

Perform a like binge

Kind: static method of likes

likes.handlePost(post, callback)

Handle a post in a like binge

Kind: static method of likes

Param Type Description
post external.posts.CleanedPost Post to handle
callback completionCallback Completion Callback

likes~defaultConfig : object

Default configuration settings

Kind: inner typedef of likes

defaultConfig.binge : boolean

Whether like binges should be performed

Kind: static property of defaultConfig
Default: false

defaultConfig.bingeCap : number

Maximum number of likes to hand out as part of a like binge

Kind: static property of defaultConfig
Default: 500

defaultConfig.bingeHour : number

The hour of the day to go on a like binge in UTC (0-23)

Kind: static property of defaultConfig
Default: 0

defaultConfig.bingeMinute : number

The minute of the hour to go on a like binge in UTC (0-59)

Kind: static property of defaultConfig
Default: 0

defaultConfig.bingeRandomize : boolean

Randomise the time of day the likes binge starts (if set, overrides bingeHour and bingeMinute)

Kind: static property of defaultConfig
Default: true

defaultConfig.topics : Array.<number>

Topics to hand out likes in

Kind: static property of defaultConfig
Default: [1000]

defaultConfig.delay : number

Time to delay liking post as posts are streamed in

Kind: static property of defaultConfig

defaultConfig.scatter : number

Amount of time to scatter likes by

Kind: static property of defaultConfig

likes~internals : object

Internal status store

Kind: inner typedef of likes

internals.browser : Browser

Browser to use for communication with discourse

Kind: static property of internals

internals.config : object

Instance configuration

Kind: static property of internals

internals.bingeInterval : *

Interval token for like binges

Kind: static property of internals

internals.likeCount : number

Count of likes handed out during latest binge

Kind: static property of internals

internals.events : externals.events.SockEvents

EventEmitter used for internal communication

Kind: static property of internals

likes~completionCallback

Completion callback

Kind: inner typedef of likes

Param Type Default Description
[err] Error Error encountered before completion