diff plugins/ask/ask.js @ 773:8c44bbcbbab9

Misc: style, cleanup and update
author David Demelier <markand@malikania.fr>
date Fri, 26 Oct 2018 13:01:00 +0200
parents 3e816cebed2c
children 06cc2f95f479
line wrap: on
line diff
--- a/plugins/ask/ask.js	Wed Oct 24 13:24:03 2018 +0200
+++ b/plugins/ask/ask.js	Fri Oct 26 13:01:00 2018 +0200
@@ -18,11 +18,11 @@
 
 // Plugin information.
 info = {
-    name: "ask",
-    author: "David Demelier <markand@malikania.fr>",
-    license: "ISC",
-    summary: "Crazy module for asking a medium",
-    version: "@IRCCD_VERSION@"
+	name: "ask",
+	author: "David Demelier <markand@malikania.fr>",
+	license: "ISC",
+	summary: "Crazy module for asking a medium",
+	version: "@IRCCD_VERSION@"
 };
 
 // Modules.
@@ -33,41 +33,41 @@
 
 /* List of answers */
 var answers = [
-    "Yes",
-    "No"
+	"Yes",
+	"No"
 ];
 
 function onLoad()
 {
-    try {
-        // User specified file?
-        if (Plugin.config["file"])
-            path = Plugin.config["file"];
-        else
-            path = Plugin.paths.config + "/answers.conf";
+	try {
+		// User specified file?
+		if (Plugin.config["file"])
+			path = Plugin.config["file"];
+		else
+			path = Plugin.paths.config + "/answers.conf";
 
-        var file = new File(path, "r");
-        var line;
+		var file = new File(path, "r");
+		var line;
 
-        // Reset.
-        answers = [];
+		// Reset.
+		answers = [];
 
-        while ((line = file.readline()))
-            // Skip empty lines.
-            if (line.length > 0)
-                answers.push(line);
-    } catch (e) {
-        Logger.warning(path + ": " + e.message);
-        Logger.warning("using default answers");
-    }
+		while ((line = file.readline()))
+			// Skip empty lines.
+			if (line.length > 0)
+				answers.push(line);
+	} catch (e) {
+		Logger.warning(path + ": " + e.message);
+		Logger.warning("using default answers");
+	}
 }
 
 function onCommand(server, origin, channel)
 {
-    var target = Util.splituser(origin);
-    var response = answers[Math.floor(Math.random() * answers.length)];
+	var target = Util.splituser(origin);
+	var response = answers[Math.floor(Math.random() * answers.length)];
 
-    server.message(channel, target + ", " + response);
+	server.message(channel, target + ", " + response);
 }
 
 onReload = onLoad;