BilliAlpha / discord-transfer

A discord bot for copying messages between guilds
26 stars 0 forks source link

how to add the discord token #12

Closed AnnaFromPoland closed 1 year ago

AnnaFromPoland commented 1 year ago

g'evening!

"Copy the bot token and pass it to the application via the DISCORD_TOKEN environment variable"

the question is - HOW?

when trying to run this program in the console, there is no prompt asking to input the value that would be ascribed to that "token" variable. inside the code, that variable does not have a setter in the code. inputting the token's value as a hard coded variable value also does not work because token is a string, and assigning a long set of numbers that is the discord token directly to it leads to a parsing error "java.lang.NumberFormatException: For input string: "?N8?N??^x?v??"". you have previously mentioned to use $env:DISCORD_TOKEN="MY_BOT_TOKEN_HERE" prior to writing the terminal command java -jar [...] but this $env: line is not a valid terminal command, see below:

image

i tried running the jar - doesnt work, says unsupported binary file. i tried opening in JDK, also no success. tweaking the java file by hardcoding the token value there and exporting to jar does not work either.

when the app did not work, it said to type "help" for help, but that's also wrong because help is not a correct terminal command, and when this program runs in the JDK console, it is "read only" so you can't type anything (i.e. "help") to get any help.

what was the design idea, how is this supposed to work with this variable value insertion? how could i make it work? or is it perhaps designed to only work on linux and that's it?

AnnaFromPoland commented 1 year ago

and yep, i did try both options you have mentioned there, with the $env and without:

image

these are not correct terminal commands and do not work.

BilliAlpha commented 1 year ago

There are 2 problems with what you are trying to do.

1) First, you are not using powershell, you are using cmd. Search for powershell in your windows search bar. 2) The token you are providing doesn't look valid to me. Please make sure you are using the token taken here : Screenshot

PS: Do not share your token on the internet, anyone can use it to connect as your bot.

AnnaFromPoland commented 1 year ago

yeah, i'm using terminal, you mentioned to use terminal. ("linux-like terminal" to be exact. terminal is linux like... and the first command was supposed to work in it).

amazing, it did work in powershell. 1st time EVER something worked in powershell that was not working in terminal. i always used terminal instead of powershell and never had a single problem. i still don't understand the difference between "terminal" "JDK console" "cmd.exe" "bash" and "powershell" as until now every single command worked just the same in all of those. so there IS some miniscule difference between them after all... amazing.

so the discord client/application id is not the "discord token"? oh man... 🤦

"Do not share your token on the internet, anyone can use it to connect as your bot" yes, if only i wouldnt reset it after every use >.> solid advice tho.

the script's running fine, thank you. i underestimated the fact i do not have a masters in computer science and thought i could do this t_t sorry for the trouble and thank you for the help.

BilliAlpha commented 1 year ago

Glad you got it working in the end.

AnnaFromPoland commented 1 year ago

so this bot fetches only the metadata, not the messages? i was hoping it can copy the messages, but it only got the timestamps and other meta:

image

is this supposed to happen or is that not the intended design?

BilliAlpha commented 1 year ago

Sorry, this is has changed in the last release, you now have to add the MESSAGE CONTENT intent.

To do so enable this option in the bot settings: Screenshot