Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function resetFIH() {
- ScriptProperties.setProperty("fih", tostring(0))
- }
- function getFIH() {
- Logger.log(ScriptProperties.getProperty("fih"));
- }
- function disable() { ScriptProperties.setProperty("disabled", "yes"); }
- function enable() { ScriptProperties.setProperty("disabled", "no"); }
- /*
- function debugstuff() {
- var str = ScriptProperties.getProperty("last_post");
- Logger.log(str);
- var obj = JSON.parse(str);
- Logger.log(obj);
- var result;
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- result = key;
- break;
- }
- }
- Logger.log(result);
- var change = 0;
- Logger.log(result===" ");
- Logger.log(result==" ");
- Logger.log(result==" ");
- if (result === " ") { //stripped plusses
- change = 1;
- }
- else if (result === "--") {
- change = -1;
- }
- else if (parseInt(result)) {
- change = parseInt(result);
- }
- Logger.log(change);
- if (change != 0)
- {
- Logger.log("!=0");
- }
- }*/
- function doGet() {
- return ContentService.createTextOutput(ScriptProperties.getProperty("fih"));
- }
- function doPost(data) {
- if (ScriptProperties.getProperty("disabled") === "yes")
- return ContentService.createTextOutput("this command has been temporarily disabled");
- var param = data.parameter;
- var str;
- for (var key in param) {
- if (param.hasOwnProperty(key)) {
- str = key;
- break;
- }
- }
- ScriptProperties.setProperty("last_post",str);
- var change = 0;
- if (str === "**") { //stripped plusses
- change = 1;
- }
- else if (str === "--") {
- change = -1;
- }
- else if (parseInt(str)) {
- change = parseInt(str);
- }
- if (change != 0)
- {
- var current = parseInt(ScriptProperties.getProperty("fih"));
- current += change;
- ScriptProperties.setProperty("fih", current.toString());
- }
- return doGet();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement