# Path: core/moduletemplate.py
# class BotModule:
#     PRIV_NONE = "none"
#     PRIV_MOD = "mod"
#     PRIV_MODERATOR = "mod"
#     PRIV_ADMIN = "admin"
#     PRIV_ADMINISTRATOR = "admin"
#     def __init__(self, conn, logger, module_name):
#     def on_module_load(self):
#     def on_module_unload(self):
#     def on_connect(self):
#     def on_disconnect(self):
#     def on_privmsg(self, target, nick, message):
#     def on_action(self, target, nick, action):
#     def on_join(self, nick, channel):
#     def on_part(self, nick, channel, message):
#     def on_self_join(self, channel):
#     def on_self_part(self, channel):
#     def on_kick(self, nick, channel, knick, reason):
#     def on_quit(self, nick, message):
#     def on_command(self, target, nick, command, commandtext, mod, admin):
#     def on_numeric(self, numeric, data):
#     def message(self, target, nick, message, parse=False):
#     def notice(self, nick, message, parse=False):
#     def action(self, target, action, parse=False):
#     def mode(self, target, modes):
#     def ban(self, nick, channel, quiet=False):
#     def getMask(self, nick):
#     def send_raw(self, raw_message):
#     def debug(self, message, format=False):
#     def log(self, message):
#     def log_verbose(self, message):
#     def warning(self, message):
#     def notice_verbose(self, message):
#     def warning_verbose(self, message):
#     def error(self, message):
#     def isOp(self, nick, channel):
#     def isVoice(self, nick, channel):
#     def isOn(self, nick, channel):
#     def isIdentified(self, nick):
#     def isOper(self, nick):
#     def getUserData(self, nick):
#     def getChannelData(self, channel):
#     def isBotAdministrator(self, nick):
#     def isBotModerator(self, nick):
#     def ratelimit(self, command, confName="rate_limit_delay", delay=10):
#     def register_command(self, command, params, help, priv, aliases=None):
#     def unregister_command(self, command):
#     def getConfigMetadata(self, metadata):
#     def requireApiKey(self, api_name):
#     def _getApiKey(self, api_name):
#     def _unregister_commands(self):
#     def _getModuleData(self):
# 
# Path: tools/duration.py
# def timesincetimestamp(timestamp, now=None):
# def timebeforetimestamp(timestamp, now=None):
# def timesince(d, now=None):
# def timeuntil(d, now=None):


from core import moduletemplate
from tools import duration
import time
import math
Note this however: This is not supposed to be a replacement for channel ops, it's just there to keep
control in a channel with large amounts of chatting.

The banmasks set are ineffecient and are not meant to go against ban evasion, they are supposed to give channel
ops the time to investigate the situation without some user wrecking havoc on the channel.

This module also unbans every ban the bot set on a purge.

It requires a lot of configuration, but the default values are generally fine. Ensure at LEAST "channels" is set.

Config options (in config.json):
 channels: string, Channels (, separated) to detect by default (nothing will happen if the bot is not in them)
 max_warnings: integer, number of warnings until nothing will happen (often equals a kickban or op supervision after)
 message_interval: integer, when a message expires and no longer counts towards the .. ->
 message_max_per_interval: integer, number of messages you can send before a warning is added.
 report_channel: string, much like "debug_chan", reports useful information to this channel (command uses, warnings).
 expiry_seconds: integer, Every expiry_seconds the bot will purge the storage, resetting warnings, and removing bans.

Additionally, code-wise, if you need something more specific from the module. You can edit self.actions in
on_module_load(). This includes writing your own actions, and adjusting the settings to see what works best for your
channel.

Known Issues:
 Channels with a ':' in them are not supported by the banlist. To fix this, manually adjust the code to use a different
 delimiter
"""





# Path: core/moduletemplate.py
# class BotModule:
#     PRIV_NONE = "none"
#     PRIV_MOD = "mod"
#     PRIV_MODERATOR = "mod"
#     PRIV_ADMIN = "admin"
#     PRIV_ADMINISTRATOR = "admin"
#     def __init__(self, conn, logger, module_name):
#     def on_module_load(self):
#     def on_module_unload(self):
#     def on_connect(self):
#     def on_disconnect(self):
#     def on_privmsg(self, target, nick, message):
#     def on_action(self, target, nick, action):
#     def on_join(self, nick, channel):
#     def on_part(self, nick, channel, message):
#     def on_self_join(self, channel):
#     def on_self_part(self, channel):
#     def on_kick(self, nick, channel, knick, reason):
#     def on_quit(self, nick, message):
#     def on_command(self, target, nick, command, commandtext, mod, admin):
#     def on_numeric(self, numeric, data):
#     def message(self, target, nick, message, parse=False):
#     def notice(self, nick, message, parse=False):
#     def action(self, target, action, parse=False):
#     def mode(self, target, modes):
#     def ban(self, nick, channel, quiet=False):
#     def getMask(self, nick):
#     def send_raw(self, raw_message):
#     def debug(self, message, format=False):
#     def log(self, message):
#     def log_verbose(self, message):
#     def warning(self, message):
#     def notice_verbose(self, message):
#     def warning_verbose(self, message):
#     def error(self, message):
#     def isOp(self, nick, channel):
#     def isVoice(self, nick, channel):
#     def isOn(self, nick, channel):
#     def isIdentified(self, nick):
#     def isOper(self, nick):
#     def getUserData(self, nick):
#     def getChannelData(self, channel):
#     def isBotAdministrator(self, nick):
#     def isBotModerator(self, nick):
#     def ratelimit(self, command, confName="rate_limit_delay", delay=10):
#     def register_command(self, command, params, help, priv, aliases=None):
#     def unregister_command(self, command):
#     def getConfigMetadata(self, metadata):
#     def requireApiKey(self, api_name):
#     def _getApiKey(self, api_name):
#     def _unregister_commands(self):
#     def _getModuleData(self):
# 
# Path: tools/duration.py
# def timesincetimestamp(timestamp, now=None):
# def timebeforetimestamp(timestamp, now=None):
# def timesince(d, now=None):
# def timeuntil(d, now=None):


# Path: modules_disabled/flooddetect.py
from core import moduletemplate
from tools import duration
import time
import math

Note this however: This is not supposed to be a replacement for channel ops, it's just there to keep
control in a channel with large amounts of chatting.

The banmasks set are ineffecient and are not meant to go against ban evasion, they are supposed to give channel
ops the time to investigate the situation without some user wrecking havoc on the channel.

This module also unbans every ban the bot set on a purge.

It requires a lot of configuration, but the default values are generally fine. Ensure at LEAST "channels" is set.

Config options (in config.json):
 channels: string, Channels (, separated) to detect by default (nothing will happen if the bot is not in them)
 max_warnings: integer, number of warnings until nothing will happen (often equals a kickban or op supervision after)
 message_interval: integer, when a message expires and no longer counts towards the .. ->
 message_max_per_interval: integer, number of messages you can send before a warning is added.
 report_channel: string, much like "debug_chan", reports useful information to this channel (command uses, warnings).
 expiry_seconds: integer, Every expiry_seconds the bot will purge the storage, resetting warnings, and removing bans.

Additionally, code-wise, if you need something more specific from the module. You can edit self.actions in
on_module_load(). This includes writing your own actions, and adjusting the settings to see what works best for your
channel.

Known Issues:
 Channels with a ':' in them are not supported by the banlist. To fix this, manually adjust the code to use a different
 delimiter
"""





class FloodDetect(moduletemplate.BotModule):