summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-07-13 18:33:23 +0200
committerRaindropsSys <contact@minteck.org>2023-07-13 18:33:23 +0200
commite92e3e4e10e0a5f388e637dc321871371021738a (patch)
treef3a89cf79f166b105d699dba3857e4fe98625242
parent2efa6cd8882e450ace2c53e0d43c49633412290b (diff)
downloadbutterscotch-e92e3e4e10e0a5f388e637dc321871371021738a.tar.gz
butterscotch-e92e3e4e10e0a5f388e637dc321871371021738a.tar.bz2
butterscotch-e92e3e4e10e0a5f388e637dc321871371021738a.zip
Updated 3 files and deleted 11 files (automated)
-rw-r--r--commands/what.js7
-rw-r--r--discord.js126
-rw-r--r--help/what.json6
-rw-r--r--matrix.js126
-rw-r--r--package-lock.json2
-rw-r--r--utilities/sentiments/.idea/.gitignore8
-rw-r--r--utilities/sentiments/.idea/discord.xml7
-rw-r--r--utilities/sentiments/.idea/inspectionProfiles/profiles_settings.xml6
-rw-r--r--utilities/sentiments/.idea/misc.xml4
-rw-r--r--utilities/sentiments/.idea/modules.xml8
-rw-r--r--utilities/sentiments/.idea/sentiments.iml8
-rw-r--r--utilities/sentiments/data.csv6
-rw-r--r--utilities/sentiments/main.py5
-rw-r--r--utilities/sentiments/train.py57
14 files changed, 1 insertions, 375 deletions
diff --git a/commands/what.js b/commands/what.js
deleted file mode 100644
index 67c602a..0000000
--- a/commands/what.js
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = (parameter, wrapper) => {
- if (lastMessages[wrapper.id]) {
- wrapper.send("πŸ‘“ Here are the last messages sent in this room:\n\n" + lastMessages[wrapper.id].map(i => "* " + i).join("\n"));
- } else {
- wrapper.send("😒 Sorry, I haven't seen any message in this room yet.");
- }
-} \ No newline at end of file
diff --git a/discord.js b/discord.js
index 7c431bf..2d113bd 100644
--- a/discord.js
+++ b/discord.js
@@ -45,132 +45,6 @@ function startDiscord() {
}
} else if (message.includes("<@" + client.user.id + ">")) {
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 (worth > 100) worth = 100;
-
- 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(".") && !text.endsWith("..") && !text.endsWith("...") && !text.endsWith(".c.")) {
- 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/help/what.json b/help/what.json
deleted file mode 100644
index c25edb8..0000000
--- a/help/what.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "description": "Shows the last 5 messages sent to this room.",
- "parameters": "",
- "aliases": [ "history", "w", "msg" ],
- "exempt": false
-} \ No newline at end of file
diff --git a/matrix.js b/matrix.js
index 3103a7a..8c63b79 100644
--- a/matrix.js
+++ b/matrix.js
@@ -78,132 +78,6 @@ function startMatrix() {
}
} else if (message.includes(require('./credentials.json').username) || (event.event.content.formatted_body && event.event.content.formatted_body.includes(require('./credentials.json').username))) {
matrixSend(room.roomId, "πŸ‘‹ Hello! I think you forgot my prefix is `.`, use `.help` to get help.");
- } else {
- if (!lastMessages[room.roomId]) lastMessages[room.roomId] = [];
- lastMessages[room.roomId].unshift(event.event.content.body);
- lastMessages[room.roomId] = lastMessages[room.roomId].splice(0, 5);
-
- let text = event.event.content.body.toLowerCase();
-
- 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;
- if (worth > 100) worth = 100;
-
- 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(".") && !text.endsWith("..") && !text.endsWith("...") && !text.endsWith(".c.")) {
- 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)) {
- matrixSend(room.roomId, "πŸŽ‰ 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/package-lock.json b/package-lock.json
index ba02fd8..4d53444 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "matrix-bot",
+ "name": "app",
"lockfileVersion": 2,
"requires": true,
"packages": {
diff --git a/utilities/sentiments/.idea/.gitignore b/utilities/sentiments/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/utilities/sentiments/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/utilities/sentiments/.idea/discord.xml b/utilities/sentiments/.idea/discord.xml
deleted file mode 100644
index d8e9561..0000000
--- a/utilities/sentiments/.idea/discord.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="DiscordProjectSettings">
- <option name="show" value="PROJECT_FILES" />
- <option name="description" value="" />
- </component>
-</project> \ No newline at end of file
diff --git a/utilities/sentiments/.idea/inspectionProfiles/profiles_settings.xml b/utilities/sentiments/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/utilities/sentiments/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<component name="InspectionProjectProfileManager">
- <settings>
- <option name="USE_PROJECT_PROFILE" value="false" />
- <version value="1.0" />
- </settings>
-</component> \ No newline at end of file
diff --git a/utilities/sentiments/.idea/misc.xml b/utilities/sentiments/.idea/misc.xml
deleted file mode 100644
index dc9ea49..0000000
--- a/utilities/sentiments/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
-</project> \ No newline at end of file
diff --git a/utilities/sentiments/.idea/modules.xml b/utilities/sentiments/.idea/modules.xml
deleted file mode 100644
index 449a77b..0000000
--- a/utilities/sentiments/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$/.idea/sentiments.iml" filepath="$PROJECT_DIR$/.idea/sentiments.iml" />
- </modules>
- </component>
-</project> \ No newline at end of file
diff --git a/utilities/sentiments/.idea/sentiments.iml b/utilities/sentiments/.idea/sentiments.iml
deleted file mode 100644
index 8437fe6..0000000
--- a/utilities/sentiments/.idea/sentiments.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
- <component name="NewModuleRootManager">
- <content url="file://$MODULE_DIR$" />
- <orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
- <orderEntry type="sourceFolder" forTests="false" />
- </component>
-</module> \ No newline at end of file
diff --git a/utilities/sentiments/data.csv b/utilities/sentiments/data.csv
deleted file mode 100644
index 241cc1b..0000000
--- a/utilities/sentiments/data.csv
+++ /dev/null
@@ -1,6 +0,0 @@
-"text";"sentiment"
-"Hi!";"happy"
-"Fuck you";"angry"
-"....";"sad"
-"I want to sleep...";"tired"
-"I'm.... scared.....";"scared" \ No newline at end of file
diff --git a/utilities/sentiments/main.py b/utilities/sentiments/main.py
deleted file mode 100644
index f60db38..0000000
--- a/utilities/sentiments/main.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from transformers import pipeline
-
-classifier = pipeline('sentiment-analysis', model="finiteautomata/bertweet-base-sentiment-analysis")
-result = classifier("pfff")
-print(result) \ No newline at end of file
diff --git a/utilities/sentiments/train.py b/utilities/sentiments/train.py
deleted file mode 100644
index 801a78f..0000000
--- a/utilities/sentiments/train.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import pandas as pandas
-import torch
-from transformers import AutoTokenizer
-
-dataset = pandas.read_csv("./data.csv")
-print(list(dataset))
-
-class TheDataset(torch.utils.data.Dataset):
- def __init__(self, reviews, sentiments, tokenizer):
- self.reviews = reviews
- self.sentiments = sentiments
- self.tokenizer = tokenizer
- self.max_len = tokenizer.model_max_length
-
- def __len__(self):
- return len(self.reviews)
-
- def __getitem__(self, index):
- review = str(self.reviews[index])
- sentiments = self.sentiments[index]
-
- encoded_review = self.tokenizer.encode_plus(
- review,
- add_special_tokens=True,
- max_length=self.max_len,
- return_token_type_ids=False,
- return_attention_mask=True,
- return_tensors="pt",
- padding="max_length",
- truncation=True
- )
-
- return {
- 'input_ids': encoded_review['input_ids'][0],
- 'attention_mask': encoded_review['attention_mask'][0],
- 'labels': torch.tensor(sentiments, dtype=torch.long)
- }
-
-
-# Load the tokenizer for the BERT model.
-tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
-
-train_set_dataset = TheDataset(
- reviews=dataset.text.tolist(),
- sentiments=dataset.vader_result.tolist(),
- tokenizer=tokenizer,
-)
-
-train_set_dataloader = torch.utils.data.DataLoader(
- train_set_dataset,
- batch_size=16,
- num_workers=4
-)
-
-train_data = next(iter(train_set_dataloader))
-
-print(train_data["input_ids"].size())