poppyrock2 — 6/17/2022, 9:06:33 PM

@lankybox01 OK HOW DO I GET AN AUTOMATED NODE.JS PROGRAM TO READ WALL MESSAGES AND FIND COMMAND COMMENTS LIKE MEE6 DID IM SUCH A DUMBASS WHEN IT COMES TO ACTUALLY MAKING SOMETHING

asking for my good bot friend: @notawkward

♥ 2 ↩ 1 💬 33 comments

comments

nebulous:

https://gist.github.com/lankybox02/f918a2c37749d3c72f5a112712233d9c

6/17/2022, 9:18:14 PM
poppyrock2:

thanks, also check discord i gave you the svg for my bundle logo

6/17/2022, 9:20:20 PM
nebulous:

okay thanks

6/17/2022, 9:20:48 PM
poppyrock2:

The errors haunt me…

Hint: hit control+c anytime to enter REPL.
/home/runner/notawkward-bot/index.js:3
const WasteOfSession = require("wasteof-client");
                       ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/notawkward-bot/node_modules/wasteof-client/index.js from /home/runner/notawkward-bot/index.js not supported.
Instead change the require of /home/runner/notawkward-bot/node_modules/wasteof-client/index.js in /home/runner/notawkward-bot/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/notawkward-bot/index.js:3:24)
    at async Promise.all (index 0) {
  code: 'ERR_REQUIRE_ESM'
}
repl process died unexpectedly: exit status 1
6/17/2022, 9:27:38 PM
poppyrock2:

I ran npm i wasteof-client

6/17/2022, 9:28:03 PM
poppyrock2:

@lankybox01

6/17/2022, 9:31:54 PM
nebulous:

https://stackoverflow.com/questions/70541068/instead-change-the-require-of-index-js-to-a-dynamic-import-which-is-available

6/17/2022, 9:44:50 PM
poppyrock2:

all three answers don’t work, wasteof-client doesn’t have a debug thing to put type=module or whatever above

6/17/2022, 9:52:14 PM
poppyrock2:

I THINK IT WAS A VERSION ISSUE WHYYY

6/17/2022, 9:54:51 PM
poppyrock2:

nope

@ee what is happening what am i doing wrong as always

6/17/2022, 9:57:30 PM
oren:

Can i see your code

6/17/2022, 10:26:10 PM
poppyrock2:
const WasteOfSession = require('wasteof-client');
const io = require('socket.io-client');

let wasteof = new WasteOfSession("notawkward", "tastethemusk"); // might wanna use your env :p
let msgcount = 0; // default message count. It will listen to new messages
wasteof.login()
   .then(data => {
const socket = io("https://api.wasteof.money", {
  auth: {
    token: data,
  },
});
  socket.on('updateMessageCount', (newCount) => {
    if (newCount > msgcount) {
      msgcount = newCount;
        wasteof.getWallComments("notawkward", 0)
          .then(data => replyToComment(data.comments[0])); // gets data of latest comment. Now check if it was already replied to and respond to it
      } 
})
})
6/17/2022, 10:45:28 PM
poppyrock2:

Getting error:

Hint: hit control+c anytime to enter REPL.
Hint: hit control+c anytime to enter REPL.
/home/runner/notawkward-bot/index.js:3
const WasteOfSession = require('wasteof-client');
                       ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/notawkward-bot/node_modules/wasteof-client/index.js from /home/runner/notawkward-bot/index.js not supported.
Instead change the require of /home/runner/notawkward-bot/node_modules/wasteof-client/index.js in /home/runner/notawkward-bot/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/notawkward-bot/index.js:3:24)
    at async Promise.all (index 0) {
  code: 'ERR_REQUIRE_ESM'
}
repl process died unexpectedly: exit status 1
6/17/2022, 10:46:11 PM
wynd:

Change

const WasteOfSession = require('wasteof-client');
const io = require('socket.io-client');

to

import WasteofClient from 'wasteof-client'
import { io } from 'socket.io-client'
6/17/2022, 10:58:52 PM
wynd:

nevermind, ill test stuff

6/17/2022, 11:06:33 PM
poppyrock2:

Let me know

6/17/2022, 11:19:00 PM
wynd:

I dunno wasteof-client well. All I know is that you have to import it and socket.io-client as modules, and destructure io and Wasteof2Auth out of the libraries respectively.

6/17/2022, 11:21:02 PM
poppyrock2:

maybe the update broke a bunch of code so ima clone the original wasteofreplit (still has old wasteofclient) and add the rest of the code to it

6/17/2022, 11:22:57 PM
wynd:

maybe ask ee if there is documentation

6/17/2022, 11:24:07 PM
poppyrock2:

i asked ee for help and they wanted the code so i gave it to them and i got no reply so far

6/17/2022, 11:26:12 PM
wynd:

alright

6/17/2022, 11:27:22 PM
oren:

The new code is a breaking change and there's no docs yet, but just run "npm uninstall wasteof-client && npm i [email protected]" and your current code should work. The new version of wasteof-client could make your code a lot simpler though, when the docs are out

6/18/2022, 2:22:14 AM
oren:

Cc @wynd

6/18/2022, 2:23:18 AM
poppyrock2:

Ok thanks

6/18/2022, 2:27:03 AM
poppyrock2:

How would I use wasteof.postComment(id, content, parent) to reply to a wall comment (no post Id?????)

6/18/2022, 2:34:28 AM
oren:

You use a different one, but i forgot what it is 💀 maybe postWallComment(username, content, parent)

6/18/2022, 2:37:52 AM
poppyrock2:

I hope…

6/18/2022, 2:38:25 AM
poppyrock2:

Question: what variable or list does it store the id and contents of the wall comment?

6/18/2022, 12:27:47 PM
nebulous:

You can experiment — log the comment Object

6/18/2022, 5:00:32 PM
poppyrock2:

i have no idea how to log an object (js noobie)

6/18/2022, 5:01:07 PM
poppyrock2:

oh it’s just console.log im so dumb

6/18/2022, 5:01:45 PM
poppyrock2:

but like what would be the name of the object or how would i type it so it registers as an object?

6/18/2022, 5:02:21 PM
nebulous:

console.log(jsonobject)

it already registers as an object

6/18/2022, 8:03:16 PM