kartonrad / activityrole-bot

A bot for discord that will assign Roles based on the Games that the Servers Members currently play.
9 stars 4 forks source link

Is it possible to add a separate gamelist with approved games? #6

Open TheGiantSwede opened 1 year ago

TheGiantSwede commented 1 year ago

Hi. i want to show more games with this bot. but they are not verifeid .

kartonrad commented 1 year ago

Edit config.json Set "ignoreUnverifiedActivities": false

Then the bot will add a role for every discord activity, even if the user typed it in his settings I would advise you to set "createRoles": false As well, so user can't create infinite roles

The bot will then only assign existing roles, whose name matches that of the game exactly (So you need to add one for that)

Make sure the name is exactly the same as the one displayed on discord when someone plays the game

That should work, assuming that the script still runs

TheGiantSwede commented 1 year ago

Yes that worked fine. Now i have another problem. After one day of running, the bot crashes and leaves all the roles on the players

kartonrad commented 1 year ago

Would you kindly provide me with the logs at the time of the crash?

kartonrad commented 1 year ago

Cus yeah

When the bot restarts it doesnt check the player roles to fix them

I could add that too ig

TheGiantSwede commented 1 year ago

what logs do you wont? windows logs?

kartonrad commented 1 year ago

Idk how you're running the bot

But if you are using node . (As described in the Readme) In a terminal

The bot will continously spit out log lines in that same terminal

If you are using docker, there is probably some sort of command to get a containers logs

Anyway, if the bot crashes, there should be an error and a stack trace I kinda need that to understand whats going on

The bot could use an update too though, maybe that's part of the reason

TheGiantSwede commented 1 year ago

Cant find any logs anywhere. running as node . the thing is i cant see when it happens, just bad luck beeing in bed or at work. is it alot of work to do an update on the bot? btw looking in Windows Event Logs

kartonrad commented 1 year ago

If you're running as node . And have opened the terminal normally

So windows menu and started the console app, cd into the directory Then run node .

The terminal should stay open after a crash Stop scrolling So it will be left exactly at the error

I don't think it's going to show up in event logs

TheGiantSwede commented 1 year ago

will try it! thx

TheGiantSwede commented 1 year ago

Since i launched the bot in terminal it havent crashed once.... did it 2 days ago. will have it open as long as it goes :)

kartonrad commented 1 year ago

huh how strange it seems like it's a wierd edge case that causes it to break

TheGiantSwede commented 1 year ago

oe_dema#0 is now playing Squad (1) [Svenska Gamers]

Response: Bad Gateway at RequestHandler.execute (C:\BOTS\Activityrole-bot-master\node_modules\discord.js\src\rest\RequestHandler.js:356:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (C:\BOTS\Activityrole-bot-master\node_modules\discord.js\src\rest\RequestHandler.js:50:14) at async RoleManager.fetch (C:\BOTS\Activityrole-bot-master\node_modules\discord.js\src\managers\RoleManager.js:68:18) at async pickRole (C:\BOTS\Activityrole-bot-master\index.js:139:5) at async Client. (C:\BOTS\Activityrole-bot-master\index.js:81:24) { code: 502, method: 'get', path: '/guilds/646003214323417144/roles', requestData: { json: undefined, files: [] } }

Node.js v20.1.0 PS C:\BOTS\Activityrole-bot-master> <

TheGiantSwede commented 1 year ago

seems to be my dns server that i was going thru. since 502 is bad gateway error. will try again!

kartonrad commented 1 year ago

Hm i think this might be an error handling issue in my code - 502 generlly means the server was reached, but it was unavailable (disconmect/error on discords side) My code shouldnt crash in that situation

It'll take me a while to get around to it Because i wpuld update the library while i'm at it etc

In the meantime you might wanna run your command as a 'windows service' - This means it starts in the background at boot and restarts on crash

I would have to look up how exactly you do that, but there is a Services manager in windows, that you use for that purpose