ive tried to add packages or (library) to my c# project and it says done but when i try to use like
using Discord;
it says error
ive tried to add packages or (library) to my c# project and it says done but when i try to use like
using Discord;
it says error
Hello @herofille and welcome to the community!
First of all, we need access to your code, so, share your repl link.
Second: we need the full error message too.
Unless you give us this it will be hard to help you with your problem.
hey sorry for late ,
First here is the link https://replit.com/@herofille/AutomaticDimgreySign
and thats the output :
dotnet run
/home/runner/AutomaticDimgreySign/main.csproj : warning NU1701: Package ‘Anarchy-wrapper 0.8.0’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1’ instead of the project target framework ‘net6.0’. This package may not be fully compatible with your project.
/home/runner/AutomaticDimgreySign/main.csproj : warning NU1701: Package ‘better-websocket-sharp 1.0.2.1’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1’ instead of the project target framework ‘net6.0’. This package may not be fully compatible with your project.
/home/runner/AutomaticDimgreySign/main.csproj : warning NU1701: Package ‘Anarchy-wrapper 0.8.0’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1’ instead of the project target framework ‘net6.0’. This package may not be fully compatible with your project.
/home/runner/AutomaticDimgreySign/main.csproj : warning NU1701: Package ‘better-websocket-sharp 1.0.2.1’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1’ instead of the project target framework ‘net6.0’. This package may not be fully compatible with your project.
Hello World
Unhandled exception. Discord.InvalidTokenException: Exception of type ‘Discord.InvalidTokenException’ was thrown.
at Discord.DiscordClient.set_Token(String value)
at Discord.DiscordClient…ctor(String token, DiscordConfig config)
at Program.Main(String args) in /home/runner/AutomaticDimgreySign/main.cs:line 6
exit status 134
It seems the problem is with your token, I would suggest create a new token in Discord App Developer website and use it on your project.
Also, don’t let your token in public view, use the Secrets function to hide it.
https://docs.replit.com/programming-ide/workspace-features/secrets
Also I’ve never heard about a Discord library for C, so that’s new. I’m reading the docs here and the problem seems to be with the Token (since it’s compatible with .NET 6.0).
Oh, but try to check what .NET version you are using in replit, use this command in shell:
dotnet --version
thank you al ot now its working fine but there something off , its working but it always says :
The type or namespace name ‘DiscordClient’ could not be found (are you missing a using directive or an assembly reference?)
.NET VERSION IS : 6.0.403
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.