Skip to content

Instantly share code, notes, and snippets.

@Supinic
Created June 16, 2020 20:30
Show Gist options
  • Save Supinic/0df9359e0e7116aa7b8b5b542f05073d to your computer and use it in GitHub Desktop.
Save Supinic/0df9359e0e7116aa7b8b5b542f05073d to your computer and use it in GitHub Desktop.
First ever Supibot 1.x draft
(function (ircLib) {
var Bot = function () {
var $class = function (channels) {
this.irc = null;
this.nick = "Supibot";
this.server = "irc.chat.twitch.tv";
this.port = 6667;
this.channels = Array.isArray(channels) ? channels : channels.split(",");
this.initIRC();
};
$class.prototype.initIRC = function () {
this.irc = new ircLib.Client(this.server, this.nick, {
port: this.port,
channels: this.channels,
floodProtection: true,
floodProtectionDelay: 1000,
autoRejoin: true,
autoConnect: true
});
};
$class.prototype.buildCommandList = function () {
};
$class.prototype.load
};
module.exports = Bot;
})();
(function (fs) {
var FileSaveTicker = function () {
var saveAllDataToFile = function (fd, data) {
if (typeof data === "object") {
data = JSON.stringify(data);
}
fd.write
};
var $class = function (timeout, fileName) {
this.timeout = timeout || (5 * 60 * 1000);
this.data = {};
this.modified = null;
this.dataFile = null;
this.ticker = null;
this.ready = false;
fs.open(fileName, "a+", (err, fd) => {
if (err) {
throw new Error("Data file open failed", err);
}
this.dataFile = fd;
this.rawData = fs.read(this.dataFile, )
});
};
$class.prototype.init = function () {
this.ticker = setTimeout(this.tick, this.timeout);
};
$class.prototype.tick = function () {
if (this.modified === true) {
}
};
$class.prototype.loadData = function (data) {
this.data = data;
this.modified = true;
};
$class.prototype
};
module.exports = FileSaveTicker;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment