Jisagi / Discord-guild-copy

A script to copy a discord guild/server
GNU General Public License v3.0
202 stars 106 forks source link

Token Error? #5

Closed rampd2 closed 6 years ago

rampd2 commented 6 years ago

MySettings.json:

{
    "originalGuildId": "4****************3",
    "newGuildId": "43297************8",
    "newGuildAdminRoleId": "",
    "copyEmojis": false,
    "copyBans": false,
    "debug": false,
    "token": "NDMyOTk2NDgyNjQ4NjM3NDQw.Da1cww.QMaVX8Lea6u6IVT7w8kXqO8cG_M"
}

I made on the New Guild a Role with the Name: "guildcopy" I renewed my ^ Token ^!

MyOutput:

server@server1:~/discord_guild_copy/Discord-guild-copy$ node copy.js
/home/server/discord_guild_copy/Discord-guild-copy/copy.js:11
client.on('ready', async () => {
                         ^

SyntaxError: Unexpected token (
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3
server@server1:~/discord_guild_copy/Discord-guild-copy$
Jisagi commented 6 years ago

You might want to update you nodejs version, you can check the version with node -v in the console.

rampd2 commented 6 years ago

Thanks for your VERYY fast answer. I try it...

rampd2 commented 6 years ago

v4.2.6

Jisagi commented 6 years ago

well, there we have the problem, update nodejs to anything >=8

rampd2 commented 6 years ago

I did install this on a "new" Ubuntu Server.

rampd2 commented 6 years ago
sudo apt-get update
sudo apt-get upgrade

???

Jisagi commented 6 years ago

just follow their update/install routine: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

rampd2 commented 6 years ago

Thx.

rampd2 commented 6 years ago

Ou, No:

server@server1:~/Discord-guild-copy$ sudo npm install
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/hydrabolt/discord.js.git /home/server/.npm/_cacache/tmp/git-clone-b74ec7f6
npm ERR! /home/server/.npm/_cacache/tmp/git-clone-b74ec7f6/.git: Keine Berechtigung
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/server/.npm/_logs/2018-04-09T20_38_37_002Z-debug.log
server@server1:~/Discord-guild-copy$ node copy.js
module.js:549
    throw err;
    ^

Error: Cannot find module 'discord.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/server/Discord-guild-copy/copy.js:2:17)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
server@server1:~/Discord-guild-copy$
rampd2 commented 6 years ago

It seems Discord.js is missing??

Jisagi commented 6 years ago

check if node and npm are updated already with node -v and npm -v and delete the existing node_modules folder before (sudo) npm install

rampd2 commented 6 years ago

Node: v8.11.1 npm: 5.6.0

rampd2 commented 6 years ago

Yes, i deleted the whole git clone folder an cloned again and setted up again(settings.json).

Jisagi commented 6 years ago

should work just fine with those versions

rampd2 commented 6 years ago

It wont work after retry:

server@server1:~$ git clone https://github.com/Jisagi/Discord-guild-copy.git
Klone nach 'Discord-guild-copy' ...
remote: Counting objects: 65, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 65 (delta 1), reused 6 (delta 0), pack-reused 52
Entpacke Objekte: 100% (65/65), Fertig.
Prüfe Konnektivität ... Fertig.
server@server1:~$ cd Discord-guild-copy/
server@server1:~/Discord-guild-copy$ ls
copy.js  LICENSE  objects  package.json  README.md  settings.json
server@server1:~/Discord-guild-copy$ sudo nano settings.json
server@server1:~/Discord-guild-copy$ sudo npm install
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/hydrabolt/discord.js.git /home/server/.npm/_cacache/tmp/git-clone-84d92bc5
npm ERR! /home/server/.npm/_cacache/tmp/git-clone-84d92bc5/.git: Keine Berechtigung
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/server/.npm/_logs/2018-04-09T20_46_48_846Z-debug.log
server@server1:~/Discord-guild-copy$ sudo node copy.js
module.js:549
    throw err;
    ^

Error: Cannot find module 'discord.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/server/Discord-guild-copy/copy.js:2:17)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
server@server1:~/Discord-guild-copy$

but i will try tomorrow. thx

Jisagi commented 6 years ago

judging from your console output you are german. there are a few isps there which have DNS problems right now, might be related since it cant find the dependencies and therefore says it cant find the modules

rampd2 commented 6 years ago

äähm, ich könnte schon die ganze Zeit mir dir Deutsch sprechen. DNS Probleme? Kann gut sein.

Jisagi commented 6 years ago

Also, hats jetzt geklappt, oder macht npm immer noch Probleme? Ansonsten kann man das Issue schließen.

rampd2 commented 6 years ago

Ich bin gerade am alles von vorne neu installieren.

rampd2 commented 6 years ago

Ich habe mit sudo apt-get purge nodejs npm die beiden deinstalliert. After this i removed with sudo rm -r Discord-guild-copy the Project Folder. I downloaded it again with git clone https://github.com/Jisagi/Discord-guild-copy.git. I adjusted the settings.json. Ich führte den Befehl npm install im Discord-guild-copy Verzeichniss aus, mit folgender Ausgabe:

server@server1:~/Discord-guild-copy$ sudo npm install
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/hydrabolt/discord.js.git /home/server/.npm/_cacache/tmp/git-clone-3ea43d47
npm ERR! /home/server/.npm/_cacache/tmp/git-clone-3ea43d47/.git: Keine Berechtigung
npm ERR!

   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.6.0 → 5.8.0    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/server/.npm/_logs/2018-04-11T17_46_46_010Z-debug.log

This seems like an Error!? And i proceedet with node copy.js and the followed result:

server@server1:~/Discord-guild-copy$ node copy.js
module.js:549
    throw err;
    ^

Error: Cannot find module 'discord.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/server/Discord-guild-copy/copy.js:2:17)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

Thanks for deine Antwort.

Jisagi commented 6 years ago
server@server1:~/Discord-guild-copy$ sudo npm install
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/hydrabolt/discord.js.git /home/server/.npm/_cacache/tmp/git-clone-3ea43d47
npm ERR! /home/server/.npm/_cacache/tmp/git-clone-3ea43d47/.git: Keine Berechtigung
npm ERR!

This explains it, just read what it says. You dont have enouhg permissions in that folder to use npm. That's a problem on your side.

rampd2 commented 6 years ago

But i sudoed it?! Should i do chmod 777 /home/server/.npm/_cacache/tmp/git-clone-3ea43d47/ ?

rampd2 commented 6 years ago

Ups, now it worked, to install (npm install) the Project.

rampd2 commented 6 years ago

But, now it says:

Successfully logged in as Ctrl+C#2286. Starting script.
Error: Original guild to copy does not exist. Please check if the id in the settings is correct and if the bot is also member of this guild.

What did i wrong, i did it like here: image

Jisagi commented 6 years ago

i cant really help you with this, that something you have to fix yourself.

rampd2 commented 6 years ago

I forgot to invite my copy Bot to the OriginalGuild.

It worked VERY NICE.

rampd2 commented 6 years ago

Thank You Very Much. 👍 DANKE VIEL MAL!! 👍 🥇