jonathonor / syncBot

A bot that syncs roles between multiple discord servers.
https://www.jonsbots.com/syncBot
29 stars 16 forks source link

[Reverse Sync] It keeps on crushing for some reason and I don't know how to recreate it #20

Closed Re4LDeaL closed 1 year ago

Re4LDeaL commented 1 year ago

Last login: Mon Jan 30 12:02:10 2023 from 77.170.110.167 tmroot@somethingcp-11003:~# tmux a -t DLSync 1 true true 1 true true 1 true true 1 true true TypeError [InvalidType]: Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes. at GuildMemberRoleManager.add (/root/DLSync/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:124:15) at file:///root/DLSync/runReverse.js:262:14 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 'InvalidType' } 1 true true 1 true true 1 true true 1 true true 1 true false 1 true false node:events:491 throw er; // Unhandled 'error' event ^

DiscordAPIError[10007]: Unknown Member at SequentialHandler.runRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:667:15) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:464:14) at async REST.request (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:910:22) at async GuildMemberManager._fetchSingle (/root/DLSync/node_modules/discord.js/src/managers/GuildMemberManager.js:489:18) at async Client. (file:///root/DLSync/runReverse.js:420:26) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:394:10) at processTicksAndRejections (node:internal/process/task_queues:85:21) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Unknown Member', code: 10007 }, code: 10007, status: 404, method: 'GET', url: 'https://discord.com/api/v10/guilds/929969469558751262/members/1069428375422251009' } root@somethingcp-11003:~/DLSync# node:events:491 node:events:491: command not found root@somethingcp-11003:~/DLSync# throw er; // Unhandled 'error' event throw: command not found -bash: //: Is a directory root@somethingcp-11003:~/DLSync# ^ ^: command not found root@somethingcp-11003:~/DLSync# root@somethingcp-11003:~/DLSync# TypeError: Cannot read properties of undefined (reading 'remove') -bash: syntax error near unexpected token (' root@somethingcp-11003:~/DLSync# at Client.<anonymous> (file:///root/DLSync/runReverse.js:471:12) -bash: syntax error near unexpected token(' root@somethingcp-11003:~/DLSync# at processTicksAndRejections (node:internal/process/task_queues:96:5) -bash: syntax error near unexpected token (' root@somethingcp-11003:~/DLSync# Emitted 'error' event on Client instance at: Emitted: command not found root@somethingcp-11003:~/DLSync# at emitUnhandledRejectionOrErr (node:events:394:10) -bash: syntax error near unexpected token(' root@somethingcp-11003:~/DLSync# at processTicksAndRejections (node:internal/process/task_queues:85:21) -bash: syntax error near unexpected token `(' root@somethingcp-11003:~/DLSync# root@somethingcp-11003:~/DLSync# node r

jonathonor commented 1 year ago

I see the problem, let me get it fixed for you.

The issue is that the bot is looking for a member in the main server that does not exist.

i.e. If Bill joins a synced server, the bot tries to sync roles for him in main server, but since Bill is not in the main server, the bot fails.

This will be an easy fix.

jonathonor commented 1 year ago

@Re4LDeaL Hi, I have pushed the fix. Please verify and let me know if it is working as you like!

Re4LDeaL commented 1 year ago

Hello, I updated it and tested it for 8-12 hours. Then it stopped and gave this error.

root@somethingcp-11003:~# tmux a -t DLSync
    at processTicksAndRejections (node:internal/process/task_queues:85:21) {
  requestBody: { files: undefined, json: undefined },
  rawError: { message: 'Unknown Member', code: 10007 },
  code: 10007,
  status: 404,
  method: 'GET',
  url: 'https://discord.com/api/v10/guilds/929969152356155435/members/491769129318088714'
}
root@somethingcp-11003:~/DLSync# node registerGlobal.js
Started refreshing application (/) commands.
Successfully reloaded application (/) commands.
root@somethingcp-11003:~/DLSync# node runReverse.js
syncbot ready!
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member
node:events:491
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'remove')
    at Client.<anonymous> (file:///root/DLSync/runReverse.js:486:12)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:394:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)
jonathonor commented 1 year ago

@Re4LDeaL Fix pushed. I missed a case.... This failed because a member left a synced server and that member had a role name in that synced server that did not exist in the main server.

For example.

Bill was in the main server and a synced server. Bill had a role named "Cool Role" in synced server, and he then left the synced server. The bot tried to look up a role with name "Cool Role" in the main server, but didn't find one, and failed.

I have fixed the issue.

Re4LDeaL commented 1 year ago

Updated it and used for 5-6 hours when I got this

GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member GUILDMEMBERADD_MEMBER_FETCH Error: DiscordAPIError[10007]: Unknown Member DiscordAPIError[10011]: Unknown Role at SequentialHandler.runRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:667:15) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:464:14) at async REST.request (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:910:22) at async GuildMemberRoleManager.remove (/root/DLSync/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:168:7) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Unknown Role', code: 10011 }, code: 10011, status: 404, method: 'DELETE', url: 'https://discord.com/api/v10/guilds/929969002963423252/members/410138706490425344/roles/932259096332218390' } file:///root/DLSync/runReverse.js:292 Unable to add ${serverCommandWasInRoleToAdd.name} to ${member.user.username} in ${mainServer.name} since the user is not in that server.` ^

TypeError: Cannot read properties of null (reading 'name') at file:///root/DLSync/runReverse.js:292:54 at processTicksAndRejections (node:internal/process/task_queues:96:5) root@somethingcp-11003:~/DLSync# `

Re4LDeaL commented 1 year ago

Does it have something to do with special characters or it doesn't matter?

jonathonor commented 1 year ago

@Re4LDeaL let me take a look, I'll report back.

Re4LDeaL commented 1 year ago

Hello, thank you! It happens when I add a bot in the synced server. I think?

Re4LDeaL commented 1 year ago

`root@somethingcp-11003:~# tmux a -t DLSync at async SequentialHandler.queueRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:464:14) at async REST.request (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:910:22) at async GuildMemberRoleManager.remove (/root/DLSync/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:168:7) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Unknown Role', code: 10011 }, code: 10011, status: 404, method: 'DELETE', url: 'https://discord.com/api/v10/guilds/929969761402626048/members/834229949418045451/roles/934775053055311873' } DiscordAPIError[10011]: Unknown Role at SequentialHandler.runRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:667:15) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:464:14) at async REST.request (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:910:22) at async GuildMemberRoleManager.remove (/root/DLSync/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:168:7) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Unknown Role', code: 10011 }, code: 10011, status: 404, method: 'DELETE', url: 'https://discord.com/api/v10/guilds/929969761402626048/members/410138706490425344/roles/932259106423722007' } DiscordAPIError[10011]: Unknown Role at SequentialHandler.runRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:667:15) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:464:14) at async REST.request (/root/DLSync/node_modules/@discordjs/rest/dist/index.js:910:22) at async GuildMemberRoleManager.remove (/root/DLSync/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:168:7) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Unknown Role', code: 10011 }, code: 10011, status: 404, method: 'DELETE', url: 'https://discord.com/api/v10/guilds/929969761402626048/members/550035183269838848/roles/934498666264268881' } node:events:491 throw er; // Unhandled 'error' event ^

TypeError: Cannot read properties of undefined (reading 'remove') at Client. (file:///root/DLSync/runReverse.js:497:12) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:394:10) at processTicksAndRejections (node:internal/process/task_queues:85:21) `

jonathonor commented 1 year ago

@Re4LDeaL just pushed a fix that I believe fixes both of the issues you have noted.

jonathonor commented 1 year ago

Closing due to inactivity, please reopen a new issue if any of the errors occur again! 🙂