Permalink
Browse files

Adding a bit for the irc UA

  • Loading branch information...
1 parent 891b3bd commit 415c7de9ba83254787cdebecd92eb6fe1ba1cb6d @simonwex simonwex committed Aug 8, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 app/irc/bot-mysql.js
View
@@ -17,6 +17,34 @@ module.exports = {
});
},
+ updateChannelList: function(channels){
+ if (channels.length > 0){
+ mysql.query("DELETE FROM irc_channels", function(){
+
+ var placeholders = [];
+ var values = [];
+
+ for(var i in channels){
+ placeholders.push("(?,?,?)");
+
+ values.push(channels[i].name);
+ values.push(channels[i].users);
+ values.push(channels[i].topic);
+ }
+
+ mysql.query(
+ "INSERT IGNORE INTO irc_channels (name, users, topic) VALUES " +
+ placeholders.join(","),
+ values,
+ function(err, result){
+ if (err)
+ logger.error("Error inserting irc_channels: " + err);
+ }
+ );
+ });
+ }
+ },
+
insertNetworkUpdate: function(networks, nick, status, botUpdateId, callback){
if (typeof(networks) == 'string'){
networks = [networks];

0 comments on commit 415c7de

Please sign in to comment.