First of all, you should make sure that you have entered your token correctly. If there is still a problem, close your server ports or activate the appropriate port. If there is still a problem, check the codes used to run your bot. There may be a typo (compare it with the shared sample codes). If the problem still persists, check a working one. If you have a bot project, try its token.
The same project is running on my own computer. But it does not work on the virtual server. The error log is like this... 21.11.2023 09:36:57 -> DiscordBot Connection failed. unauthorized
21.11.2023 09:40:02 -> DiscordBot Connection failed. unauthorized
21.11.2023 09:43:33 -> DiscordBot Connection failed. unauthorized