summary refs log tree commit diff
path: root/bot.ts
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-01-24 11:08:24 +0200
committerWlodekM <[email protected]>2025-01-24 11:08:24 +0200
commit8358d211ae3d6559956b6727bd35666429059f81 (patch)
treeb1a852af150a69ea05ab894fa9ffa55f76dae865 /bot.ts
definitely the first commit
Diffstat (limited to 'bot.ts')
-rw-r--r--bot.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/bot.ts b/bot.ts
new file mode 100644
index 0000000..eed58db
--- /dev/null
+++ b/bot.ts
@@ -0,0 +1,27 @@
+import Maelink from "./main.ts";
+import { username, password } from "./creds.json" with {type: "json"};
+
+const ml = new Maelink()
+console.log(
+    await ml.login(username, password)
+)
+
+interface Post {
+    _id: string,
+    p: string,
+    u: string,
+    e: string,
+    reply_to: null | string,
+    post_id: string
+}
+
+// ml.ws.onmessage = e => console.log(e)
+
+ml.on('post', ({p: post, _id}: Post) => {
+    console.log(post)
+    if (!post.startsWith(`@wlod-bot`)) return;
+    ml.sendMessage({
+        message: 'hello',
+        replyTo: _id
+    }) 
+})