diff options
author | WlodekM <[email protected]> | 2025-01-24 11:08:24 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2025-01-24 11:08:24 +0200 |
commit | 8358d211ae3d6559956b6727bd35666429059f81 (patch) | |
tree | b1a852af150a69ea05ab894fa9ffa55f76dae865 /bot.ts |
definitely the first commit
Diffstat (limited to 'bot.ts')
-rw-r--r-- | bot.ts | 27 |
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 + }) +}) |