summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-05-27 17:43:41 +0200
committerRaindropsSys <contact@minteck.org>2023-05-27 17:43:41 +0200
commit426f5b8b751832cfa16b75381ce6974831333c52 (patch)
treee2289e06b4e9e52956cd10ad3b634a91df9db258
parented1f20d62510e56831a708798d6b8d981a4e8a27 (diff)
downloadbutterscotch-426f5b8b751832cfa16b75381ce6974831333c52.tar.gz
butterscotch-426f5b8b751832cfa16b75381ce6974831333c52.tar.bz2
butterscotch-426f5b8b751832cfa16b75381ce6974831333c52.zip
Updated 4 files (automated)
-rw-r--r--discord.js138
-rw-r--r--handler.js6
-rw-r--r--index.js5
-rw-r--r--matrix.js10
4 files changed, 148 insertions, 11 deletions
diff --git a/discord.js b/discord.js
index 985fa3f..1a84fa1 100644
--- a/discord.js
+++ b/discord.js
@@ -7,6 +7,16 @@ function startDiscord() {
console.log(`Logged in as ${client.user.tag}!`);
});
+ function send(channel, text) {
+ channel.send({
+ embeds: [
+ {
+ description: text
+ }
+ ]
+ })
+ }
+
client.on('messageCreate', (msg) => {
if (!msg.guild || msg.author.bot) return;
@@ -27,17 +37,139 @@ function startDiscord() {
source: "discord",
message: msg,
channel: msg.channel,
- client
+ client,
+ discordSend: send
});
} catch (e) {
- msg.channel.send("❓ Hmm, something isn't quite right! I was trying to process your message and something wrong happened. I think you need to report this so it can be fixed!\n\n```plaintext\n" + e.stack + "\n```");
+ send(msg.channel, "❓ Hmm, something isn't quite right! I was trying to process your message and something wrong happened. I think you need to report this so it can be fixed!\n\n```plaintext\n" + e.stack + "\n```");
}
} else if (message.includes("<@" + client.user.id + ">")) {
- msg.channel.send("πŸ‘‹ Hello! I think you forgot my prefix is `.`, use `.help` to get help.");
+ send(msg.channel, "πŸ‘‹ Hello! I think you forgot my prefix is `.`, use `.help` to get help.");
} else {
if (!lastMessages[msg.channel.id]) lastMessages[msg.channel.id] = [];
lastMessages[msg.channel.id].unshift(message);
lastMessages[msg.channel.id] = lastMessages[msg.channel.id].splice(0, 5);
+
+ let text = msg.content.toLowerCase().trim();
+
+ if (message.author.id === "186730180872634368" || message.author.id === "189069518016872448" || message.author.id === "493845599469174794") {
+ let worth = 1 / (score['score'] / 100);
+ if (worth < 0.1) worth = 0.1;
+
+ if (score['score'] === 0) {
+ score['score'] = 0.01;
+ }
+
+ if (text.includes("....")) {
+ score['score'] -= text.replace(/[^.]/gm, "").length * worth;
+ }
+
+ if (text.replace(/[^.]/gm, "").length === text.length) {
+ score['score'] -= text.replace(/[^.]/gm, "").length * 5 * worth;
+ }
+
+ if (text.includes(".c.")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("neigh")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("-c-")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("bye")) {
+ score['score'] -= 50 * worth;
+ }
+
+ if (text.endsWith(".")) {
+ score['score'] -= 10 * worth;
+ }
+
+ if (text.match(/^\*(.*)\*$/gm)) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("❀")) {
+ score['score'] += text.replace(/[^❀]/gm, "").length * 3 * worth;
+ }
+
+ if (text.includes("hehe")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("pff")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("mhm!")) {
+ score['score'] += 1 * worth;
+ }
+
+ if (text.includes("cutie")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("silly")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("sweetie")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("sis")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("nini")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("good night")) {
+ score['score'] += 2 * worth;
+ }
+
+ if (text.includes("hehehehe")) {
+ score['score'] += 4 * worth;
+ }
+
+ if (text.includes("hehehe")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("woo!")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("yay!")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("/s")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (text.includes("love you")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("love u")) {
+ score['score'] += 5 * worth;
+ }
+
+ if (text.includes("^c^")) {
+ score['score'] += 3 * worth;
+ }
+
+ if (Math.floor(score['percentage']) < Math.floor(score['score'] / 12.5)) {
+ send(msg.channel, "πŸŽ‰ Congrats! Your love score is now at " + Math.floor(score['score'] / 12.5) + "%, keep it up!");
+ }
+
+ score['percentage'] = score['score'] / 12.5;
+ }
}
});
diff --git a/handler.js b/handler.js
index c323de5..5af8880 100644
--- a/handler.js
+++ b/handler.js
@@ -75,7 +75,7 @@ module.exports = (config) => {
if (config['source'] === "matrix") {
matrixSend(config['room'].roomId, "🚫 Sorry, you do not have any knowledge credits left, run `.usage` for more details.");
} else if (config['source'] === "discord") {
- config['channel'].send("🚫 Sorry, you do not have any knowledge credits left for now, run `.usage` for more details.");
+ config['discordSend'](config['channel'], "🚫 Sorry, you do not have any knowledge credits left for now, run `.usage` for more details.");
}
return;
} else {
@@ -95,7 +95,7 @@ module.exports = (config) => {
if (config['source'] === "matrix") {
matrixSend(config['room'].roomId, "🚫 Sorry, you do not have any knowledge credits left, run `.usage` for more details.");
} else if (config['source'] === "discord") {
- config['channel'].send("🚫 Sorry, you do not have any knowledge credits left for now, run `.usage` for more details.");
+ config['discordSend'](config['channel'], "🚫 Sorry, you do not have any knowledge credits left for now, run `.usage` for more details.");
}
return;
} else {
@@ -110,7 +110,7 @@ module.exports = (config) => {
if (config['source'] === "matrix") {
matrixSend(config['room'].roomId, "🚫 `." + command + "` is not a valid command.");
} else if (config['source'] === "discord") {
- config['channel'].send("🚫 `." + command + "` is not a valid command.");
+ config['discordSend'](config['channel'], "🚫 `." + command + "` is not a valid command.");
}
}
} \ No newline at end of file
diff --git a/index.js b/index.js
index d4fdcd2..d6c63d5 100644
--- a/index.js
+++ b/index.js
@@ -14,6 +14,10 @@ try {
global.aliases = {};
+process.on('uncaughtException', (e) => {
+ console.error(e);
+});
+
try {
global.ratelimits = JSON.parse(fs.readFileSync("cache/ratelimits.json").toString());
} catch (e) {
@@ -41,6 +45,7 @@ setInterval(() => {
if (worth < 0.1) worth = 0.1;
if (score['score'] > 0) score['score'] -= worth;
+ score['percentage'] = score['score'] / 12.5;
}, 1800000);
setInterval(() => {
diff --git a/matrix.js b/matrix.js
index 8dea476..ce5978f 100644
--- a/matrix.js
+++ b/matrix.js
@@ -85,7 +85,7 @@ function startMatrix() {
let text = event.event.content.body.toLowerCase();
- if (event.event.sender === "@cloudburst:equestria.dev" || event.event.sender === "@raindrops:equestria.dev") {
+ if (event.event.sender === "@cloudburst:equestria.dev" || event.event.sender === "@raindrops:equestria.dev" || event.event.sender === "@stargrove:equestria.dev") {
let worth = 1 / (score['score'] / 100);
if (worth < 0.1) worth = 0.1;
@@ -197,11 +197,11 @@ function startMatrix() {
score['score'] += 3 * worth;
}
- if (Math.floor(score['percentage']) < Math.floor(score['score'] / 20)) {
- matrixSend(room.roomId, "πŸŽ‰ Congrats! Your love score is now at " + Math.floor(score['score'] / 20) + "%, keep it up!");
+ if (Math.floor(score['percentage']) < Math.floor(score['score'] / 12.5)) {
+ matrixSend(room.roomId, "πŸŽ‰ Congrats! Your love score is now at " + Math.floor(score['score'] / 12.5) + "%, keep it up!");
}
- score['percentage'] = score['score'] / 20;
+ score['percentage'] = score['score'] / 12.5;
}
}
}
@@ -217,7 +217,7 @@ function startMatrix() {
})();
} catch (e) {
setTimeout(() => {
- startDiscord();
+ startMatrix();
}, 300000);
}
}