naeruru / starboard

starboard / smugboard discord bot for moonmoon discord server
MIT License
42 stars 17 forks source link

Error occurs when the threshold is above 1 while removing a star from the message. #4

Closed HeavenCrafter closed 4 years ago

HeavenCrafter commented 4 years ago

One known issue with the latest master build which generates an error.

If the message threshold is anything higher than 1 (by default 3), removing a star from a starred message will generate an error since it is constantly executing message.delete() on each reaction remove even when there is no starboard message that was sent. But works completely fine whenever the threshold value is just simply 1 since each time you react with a star, starboard will be sent.

image

Not sure if there is any possible way around this, I did try to fork it and looked for solutions but couldn't think of any.

naeruru commented 4 years ago

This one is my bad, I forgot to access the property p (checks if posted) in the deletePost() function. It was trying to delete messages that did not exist. I also changed when it checks if it should delete due to async issues.

HeavenCrafter commented 4 years ago

One known issue with the latest build of Starboard after the fix, a property error showed up. At first I thought it was something to do with my code on my fork, turns out it was straight from the latest build. image

naeruru commented 4 years ago

Is this error happening with no edits to the code? I am not seeing this on my end, even on a fresh pull/install.

HeavenCrafter commented 4 years ago

Weird, maybe I did something wrongly. I'll try again.

HeavenCrafter commented 4 years ago

Yeah I'm not sure whats wrong at this point. I downloaded the latest master zip from Github, also tried using Github Desktop to clone this specific repository. Did everything that needed to be done which is simply just to install node d.js and changed all the settings, issue still occurs for some reason.

image

.(node:6152) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of null
    at loadIntoMemory (C:\Users\USER\Documents\GitHub\starboard\src\index
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
wing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6152) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with 
a non-zero exit code.

Not a single thing has been changed besides the settings including the bot token, serverid and channelid, that's it.

HeavenCrafter commented 4 years ago

Is it possible that I'm missing a dependency of some sort?

naeruru commented 4 years ago

I think it is just me doing a bad job at redoing the message loader. I made the assumption that all embeds in the starboard channel would only be from the starboard and didnt check all edge cases, which may be the cause here. But it's strange the error didn't happen when I loaded 18k messages on the server I run this on.. it shouldve failed on legacy posts. I guess it's the difference in node versions. Oh well, sorry about that. let me know if the next change fixes it

HeavenCrafter commented 4 years ago

I think it is just me doing a bad job at redoing the message loader. I made the assumption that all embeds in the starboard channel would only be from the starboard and didnt check all edge cases, which may be the cause here. But it's strange the error didn't happen when I loaded 18k messages on the server I run this on.. it shouldve failed on legacy posts. I guess it's the difference in node versions. Oh well, sorry about that. let me know if the next change fixes it

No problem, its a small issue anyways, not worth apologizing for. Plus I should be thanking you for making a starboard bot open source.

HeavenCrafter commented 4 years ago

Yep, this build works perfectly. No more issues, no more errors. Everything is running the way it should and expected. Genuinely thank you for the quick support too.