AtoraSuunva / BooruBot

Search Boorus on Discord!
MIT License
21 stars 10 forks source link

Help: self-hosting #17

Closed Kovaelin closed 6 years ago

Kovaelin commented 6 years ago

Any chance you could make a guide for self-hosting?

When I try to run the module, it tells me that "request-promise-native" is missing.

Thanks!

AtoraSuunva commented 6 years ago

I could write up a guide on how to self-host, but while it was designed to be easy to configure and setup there's a few hiccups here and there.

Anyways, have you installed the dependencies already? (run npm install inside the directory where you put it)

If you have, you'll need to install request-promise-native manually (npm install request-promise-native).

Kovaelin commented 6 years ago

Ah, that worked. Thank you. However, I'm now getting an "unexpected token" error.

SyntaxError: Unexpected token ( at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/link.js:12:16)

I've already managed to get my bot into the channel, and have copy/pasted the token into the example configuration file, and renamed it.

Thank you, once again.

AtoraSuunva commented 6 years ago

Odd, you shouldn't be getting SyntaxErrors

How are you running it, and have you edited anything else?

Kovaelin commented 6 years ago

After I installed the dependencies, I just run node modules.js. I haven't made any other changes, other than inserting the token into the configuration file. I'm probably just not very good at reading instructions.

However, now that I think about it, would it be okay if I change the invokers (i.e. from b! to !b)?

AtoraSuunva commented 6 years ago

Hmm, usually you get the file the error occurs in but you didn't post it

/home/gduck/test-b/syntax-error.js:3
});
^

SyntaxError: Unexpected token }
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:607:28)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

The full error looks like above, mind posting the full one?

Also changing the invokers should not break it at all, in fact there's an owner-only command called invoker that allows you to add/remove invokers without restarting the bot

[Owner] b!invokers add !b
[Bot] `!b` added!
[Owner] !binvokers rm b!
[Bot] `b!` removed!
[Owner] !binvokers save
[Bot] Invokers saved!

(Output cut a bit, but the commands should be right) (Don't forget to save if you change the invokers via the command though, and if you want to use spaces then run b!invokers add '!b ' instead)

Kovaelin commented 6 years ago

Sorry about that. Here's the full one.

/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/search.js:153 return new Promise(async (resolve, reject) => { ^

SyntaxError: Unexpected token ( at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/link.js:12:16)

Also, thanks for the info about the involkers.

AtoraSuunva commented 6 years ago

That's an odd error, version of node?

Kovaelin commented 6 years ago

v6.11.2

AtoraSuunva commented 6 years ago

Oh, that'd be why The bot uses async/await, which requires either Node v8 or Node v7 (but with the --harmony-async-await flag)

You're going to need to update node, if you can

Kovaelin commented 6 years ago

Ah. I see. Thanks. Darn, I was using Cloud9 for convenience, but it doesn't let you update node. I guess I'll have to find another host. Thanks again!

Kovaelin commented 6 years ago

Scratch that. Weird, sudo n stable didn't work, but nvm install stable did. I'm now on v9.5.0. However, I'm now getting a new error.

/home/ubuntu/workspace/Booru-Discord-master/modules/misc/test.js:30 invisible: true, ^^^^^^^^^

SyntaxError: Unexpected identifier at new Script (vm.js:51:7) at createScript (vm.js:138:10) at Object.runInThisContext (vm.js:199:10) at Module._compile (module.js:624:28) at Object.Module._extensions..js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Module.require (module.js:604:17) at require (internal/module.js:11:18)

AtoraSuunva commented 6 years ago

Yeah this one is a mistake on my part I forgot a , on the line before that, which i just fixed like an hour ago you can delete that file since it's useless

Kovaelin commented 6 years ago

It works! Excellent. Thank you for the help and for the guidance.

P.S. I was also going to see if I could help you with writing the guide, but I see that you're already on top of that too!

Kovaelin commented 6 years ago

Hmm... It works, but it keeps PM-ing me error/stack trace logs every time someone enters something in chat, whether it's a command or not. It's difficult to tell when one event happens and when the next begins, because how quickly the chat was moving.

Error: Logger Caught ID: eb215 { Error: ENOENT: no such file or directory, open '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' at Object.fs.openSync (fs.js:663:18) at Object.fs.writeFileSync (fs.js:1322:33) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:111:12) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) errno: -2, code: 'ENOENT', syscall: 'open', path: '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' } 'Save Settings (Create)'

Stack Trace: Error at Logger.reportError [as _reportError] (/home/ubuntu/workspace/Booru-Discord-master/modules.js:483:52) at Logger.error (/home/ubuntu/workspace/Booru-Discord-master/logger.js:80:10) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:115:21) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) Error: Logger Caught ID: 1d2f6 Error: ENOENT: no such file or directory, open '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' at Object.fs.openSync (fs.js:663:18) at Object.fs.writeFileSync (fs.js:1322:33) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:111:12) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) { "guild": "################", "type": "text", "channel": "################", "messageId": "################", "messageContent": "test" }

Stack Trace: Error at Logger.reportError [as _reportError] (/home/ubuntu/workspace/Booru-Discord-master/modules.js:483:52) at Logger.error (/home/ubuntu/workspace/Booru-Discord-master/logger.js:80:10) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:80:18) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) Error: Logger Caught ID: eec3d { Error: ENOENT: no such file or directory, open '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' at Object.fs.openSync (fs.js:663:18) at Object.fs.writeFileSync (fs.js:1322:33) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:111:12) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) errno: -2, code: 'ENOENT', syscall: 'open', path: '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' } 'Save Settings (Create)'

Stack Trace: Error at Logger.reportError [as _reportError] (/home/ubuntu/workspace/Booru-Discord-master/modules.js:483:52) at Logger.error (/home/ubuntu/workspace/Booru-Discord-master/logger.js:80:10) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:115:21) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) Error: Logger Caught ID: ab93d Error: ENOENT: no such file or directory, open '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' at Object.fs.openSync (fs.js:663:18) at Object.fs.writeFileSync (fs.js:1322:33) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:111:12) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) { "guild": null, "type": "dm", "channel": "################", "messageId": "################", at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) Error: Logger Caught ID: 50a9f { Error: ENOENT: no such file or directory, open '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' at Object.fs.openSync (fs.js:663:18) at Object.fs.writeFileSync (fs.js:1322:33) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:111:12) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) errno: -2, code: 'ENOENT', syscall: 'open', path: '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' } 'Save Settings (Create)'

Stack Trace: Error at Logger.reportError [as _reportError] (/home/ubuntu/workspace/Booru-Discord-master/modules.js:483:52) at Logger.error (/home/ubuntu/workspace/Booru-Discord-master/logger.js:80:10) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:115:21) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) Error: Logger Caught ID: 82fcd Error: ENOENT: no such file or directory, open '/home/ubuntu/workspace/Booru-Discord-master/settings/################.json' at Object.fs.openSync (fs.js:663:18) at Object.fs.writeFileSync (fs.js:1322:33) at Settings.verifyCacheFor (/home/ubuntu/workspace/Booru-Discord-master/settings.js:111:12) at Settings.get (/home/ubuntu/workspace/Booru-Discord-master/settings.js:35:10) at Object.module.exports.events.everyMessage (/home/ubuntu/workspace/Booru-Discord-master/modules/boorubot/deprecation.js:30:41) at Client.processMessage (/home/ubuntu/workspace/Booru-Discord-master/modules.js:71:34) at Client.emit (events.js:160:13) at MessageCreateHandler.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) { "guild": null, "type": "dm", "channel": "################", "messageId": "################", at WebSocketPacketManager.handle (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35) at WebSocketConnection.onMessage (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:293:17) at WebSocket.onMessage (/home/ubuntu/workspace/Booru-Discord-master/node_modules/ws/lib/event-target.js:120:16) at WebSocket.emit (events.js:160:13)

AtoraSuunva commented 6 years ago

Does a settings folder exist at /home/ubuntu/workspace/Booru-Discord-master/settings/ ?

Kovaelin commented 6 years ago

Ah, I don't know why I didn't have one before. It seems to work now. Thanks again!

AtoraSuunva commented 6 years ago

👍 I forgot to add in the settings folder on git and added it in last release

Kovaelin commented 6 years ago

It was working for a while, but then I received a new error. This was while it was idling.

In the console:

[ERR!] 'Uncaught Promise Error: \nDiscordAPIError: Unknown Message\nStack:\nDiscordAPIError: Unknown Message\n at item.request.gen.end (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)\n at then (/home/ubuntu/workspace/Booru-Discord-master/node_modules/snekfetch/src/index.js:215:21)\n at \n at process._tickCallback (internal/process/next_tick.js:160:7)\nPromise:\nPromise {\n { DiscordAPIError: Unknown Message\n at item.request.gen.end (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)\n at then (/home/ubuntu/workspace/Booru-Discord-master/node_modules/snekfetch/src/index.js:215:21)\n at \n at process._tickCallback (internal/process/next_tick.js:160:7)\n name: \'DiscordAPIError\',\n message: \'Unknown Message\',\n path: \'/api/v7/channels/#################/messages/#################/reactions/%E2%96%B6/@me\',\n code: 10008 } }' (node:3764) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.

In Discord PM: Error: Logger Caught ID: 80ecf

Uncaught Promise Error: DiscordAPIError: Unknown Message Stack: DiscordAPIError: Unknown Message at item.request.gen.end (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65) at then (/home/ubuntu/workspace/Booru-Discord-master/node_modules/snekfetch/src/index.js:215:21) at at process._tickCallback (internal/process/next_tick.js:160:7) Promise: Promise {

{ DiscordAPIError: Unknown Message at item.request.gen.end (/home/ubuntu/workspace/Booru-Discord-master/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65) at then (/home/ubuntu/workspace/Booru-Discord-master/node_modules/snekfetch/src/index.js:215:21) at at process._tickCallback (internal/process/next_tick.js:160:7) name: 'DiscordAPIError', message: 'Unknown Message', path: '/api/v7/channels/#################/messages/#################/reactions/%E2%96%B6/@me', code: 10008 } }

Stack Trace:

Error at Logger.reportError [as _reportError] (/home/ubuntu/workspace/Booru-Discord-master/modules.js:483:52) at Logger.error (/home/ubuntu/workspace/Booru-Discord-master/logger.js:80:10) at process.on (/home/ubuntu/workspace/Booru-Discord-master/modules.js:551:10) at process.emit (events.js:160:13) at emitPendingUnhandledRejections (internal/process/promises.js:108:22) at process._tickCallback (internal/process/next_tick.js:161:7)

AtoraSuunva commented 6 years ago

I thought i got it to shut up about that
It's related to the bot trying to remove a reaction on a message that doesn't exist

Not much I can say besides make sure your version is up-to-date

Kovaelin commented 6 years ago

Yeah, I did a new install of everything to make sure it was using the most recent version. Oh well, at least it still works. Thanks for the update.