JaffaMod
class JaffaMod extends EventEmitter {
//
}
2
3
Properties
StringenvironmentWhich environment the bot is running at. Eithertwitchordiscord.{String}optionsRuntime options.RavenravenSentry client.{function}modulesModules object.{function}commandsDynamic commands object.AxiosapiAPI client.RedisCachecacheCache client.MongoosedbDB client.StorestoreVersatile storage.- JaffMod supports hot-reloading which is the act of reloading the code while it's running. The store is basically just an Object which stays the same in between reloads so you can leverage that to store information.
Methods
registerCommand
registerCommand(name, callback, signature = undefined)
Function for registering dynamic commands and adding them to this.commands.
Returns: nothing.
StringnameCommand name.functioncallbackCommand logic callback.StringsignatureCommand signature.
The logic callback will be called with the following parameters:
callback(message, reply, discord)
ObjectmessageMessage object.StringcontentUser's message.[String]argumentsMessage arguments, excluding the command name itself.{String}userstateTwitch userstate. Only for Twitch.DiscordJS.Message...Discord message object which will be merged with the message object. Only for Discord.
functionreplyReply callback - handy shorthand to send a message to the originating Twitch chat channel/Discord server channel.BooleandiscordReturnstrueif platform is Discord.
The signature is a Linux-flavour (<required> [optional]) argument string like this: <example1> <example2> [example3] where example1 and example2 are required but example3 is optional.
The required/optional is processed at JaffaMod level before it reaches your callback.
The names inside the brackets are not linked to anything, the only significance is that JaffaMod will reply "Bad syntax. The command syntax is: " and then the signature string.
determineModerator
determineModerator(message, discord)
Returns: Boolean Whether the user is a moderator.
ObjectmessageA message object.BooleandiscordTrue if platform is Discord.
determineSubscriber
determineSubscriber(message, discord)
Returns: Boolean Whether the user is a subscriber.
ObjectmessageA message object.BooleandiscordTrue if platform is Discord.
resolveChannelID
resolveChannelID(message, discord) // Boolean
Returns: String Channel ID.
ObjectmessageA message object.BooleandiscordTrue if platform is Discord.
Events
raid
StringchannelChannel name.StringraiderRaider name.StringviewersRaid viewers.ObjectuserstateTwitch userstate.
this.emit('raid', { channel, raider, viewers, userstate });
subscription
Sent upon a subscription in a channel. Can be any of the following Twitch message types: sub, resub, subgift, anonsubgift, giftpaidupgrade.
StringchannelChannel name.StringmessageResubscription message.ObjectuserstateTwitch userstate.
this.emit('subscription', {channel, message, userstate});
cheer
Sent upon cheering in a channel. Can be anonymous.
StringchannelChannel name.StringmessageCheer message.ObjectuserstateTwitch userstate.
this.emit('cheer', {channel, message, userstate});
← Guide