❔ Need help Integrating Discord Rich Presence into a project (Visual Studio)
I'm hosting an empty program for now
is all the stuff I wanna show, but looking at my errors it seems as though either I've installed it wrong, or there's things I need to define and haven't
112 Replies
let me share my set up real quick
Is that a NuGet package or something?
Just FYI and for future reference, the fact you're using Visual Studio doesn't really matter
it's the discordGameSDK, I've moved everything from the C sharp folder to it's correct folder, and put the lib folders into plugins
doesn't unity have certain functions that don't work in other programs and stuff?
I don't see a class for
DiscordRichPresence
in that list of files. Is that defined somewhere?You can use Unity with Rider, VS Code, or even Notepad++
The IDE doesn't matter in the slightest
oh I presumed that was defined with the plugin or something
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this is what I'm trying to follow
Could be. I know the plugins sub folders are collapsed, so it mightbe in there. That would just be the first thing I'd check. Is it actually defined anywhere
I'll take a look at that link
You probably want to use this: https://discord.com/developers/docs/game-sdk/activities#updateactivity
oh, I'll try this, thanks
oh hang on for the non-unity I just want the DLL in my solution
just checking, does solution just refer to the entire project in it's decompiled form?
"Solution" in your case is anything within "ALPHA TEST C"
oops sorry, that's your project, not solution
It would be the level above that would be your solution
Which is not shown in your screenshot
Solution is a collection of projects
man the learning curve is steep aye? hold on I'll do a couple google searches real quick and see if I can figure this out
oh wait so when it says put the dll next to the solution it's like this?
I think I did it right
now there's only one error
and this one doesn't seem like an issue with the plugin, this seems like an issue with my code
I don't generally see SDKs set up like that. I usually see them in a separate project, but it looks like doing it that way worked 🙂
😄
and I found a tutorial that will hopefully iron out the error I got, and help me define my application ID, you can tell I'm gonna struggle to link my database to this when the time comes, let alone fetch and send data to it 😓
Do you know a any SQL?
not really, basically everything I've done except for html and css has been third party stuff
No need for SQL
EF Core FTW
Connecting to a database isn't very complicated
oh
Someone else recommended not to use EF Core for a beginner. I'd agree more if the person already knew SQL, but if not, I could see the argument to be made either way
I'll trust you on this one, as you guys seem very helpful
It might also be a pain to set up EF Core since you aren't using dependency injection
Why would it be a pain?
using var ctx = new DbContext()
and let it ripNot that DI makes it easier per se
Or... start using DI
I just figured if OP finds a tutorial that's using DI, but she isn't, could be confusing
In any case, no matter the route you take, basic database transactions aren't anything scary
I hope so ahaha
UI design seems easy, I know graphic design, I have a site, I have my servers, I have my databases
so really the only thing I need is
-discord integration (right around the corner)
-database access (seems scary but you guys seem sure)
-self updating ability (plenty of guides on that)
-key injection (probably impossible; wouldn't worry about it)
so things are moving smoothly
key injectionwhat exactly is this?
okay so basically one of the things on my database is called 'sessionkey'
I don't know the ins and outs, all I know is that it is generated for security as a faster and more secure login
the idea is that you can either enter your username and password, OR, the program can inject the sessionkey, and if it's valid then it skips the login
the reason I say it's most likely impossible is because I don't know where it slots into with my executable
So... a remember-me cookie?
yeah I guess so
but session based
it's for world of warcraft
the problem is that I have my own database and servers and everything, but as far as I'm concerned it's a blizzard secret how the key actually goes in
it'd be funny if it's just a launch perameter but I don't think it's that simple, I think I'd need to decypt the wow exe to actually know where it goes, and I don't have the talent or expertise to know how to do that
because as of now, I can't even figure out why my programs closing itself
The program '[27500] ALPHA TEST C.exe' has exited with code 0 (0x0).
as far as I know that means the process has finished and closed with no problems, but I don't want it to finish, I want it to stay openoh, this is for a wow private server?
with your own launcher?
Stay open and do what?
yeah, I'm working on a launcher for my wow server
just stay open long enough for me to check if the discord rich presence is working
So there's some sort of listener I'm assuming?
I'm not 100%, but this might be violating discord TOS and thus our server rules.
oh no don't worry about that, the version I'm running is abandonware
a program ends when it reaches the end, you'll need to keep it alive somehow. I'd suggest using a .NET hosting instance for now, if this is a console app
Im not sure blizzard sees it that way 😛
Is the idea to be listening for some command in discord?
nah hahaha don't worry bout that, I emailed them about it and everything, the version I run is like an alpha version of wow, which according to blizzard is a copy of the game they never intend to sell or host
nah its just DiscordRichPresence, aka the "is playing... game name" thing under a persons name
ah okay
But the application wouldn't need to keep running for that, right? It could just issue the update then end?
that's what I was thinking too
but the status isn't there
You could add a
Console.ReadKey()
at the end of your code to keep the console open. Or set a breakpoint at the beginning of the update method and F10 through to make sure not errors occurredonce your program ends, discord removes the game thingy
it needs to keep going for DRP to work
what's the play if it's a non-console program?
then you dont have this issue, as a GUI app will stay alive
weird....
What kind of app did you create it as when you created the project in VS?
just a form
That's not a project type
WinForms application?
ye
the one that doesn't say (.net ) in it's name
that one wouldn't let me use C# 8
you mean doesnt say ".NET framework"?
That one?
yeah, framework is old and bad
do not use.
well it says it in the description, just not the name
the one Relevant showed is good
that one :)
Yeah, that should be set up for you to run and open whatever the default form is set to
it only started closing after I put in the discordcontroller
hey what's the loop command thingo again?
I don't think a loop is going to solve your problem
I want it to reset before it hits the end of the file incase that's it
Where is your method being called?
Like are you creating an instance of your class in Program.cs then calling the method?
honestly I don't even know anymore @_@ it's 6 am now and I still haven't gotten drpc working for my lich king mod
take a look at this and tell me if it's what you're refering to
I never remember all the coding words like method and string and parameter and stuff, all I ever remember is syntax
All that's happening here is you're creating a variable named
activity
that doesn't appear to do anythingthey're in the swirly brackets D:
And if this is your program.cs file and you removed the code that was there by default, then that's why your forms app isn't running 🙂
nah nah nah the program.cs is basically untouched
That's just setting the property values for the object
hm I'm trying to get it working, can't seem to
dont do Console.ReadKey() in a winforms apps :d
Yeah, that shouldn't be needed. I assumed it was a console app earlier
I forgor I put it in there he
That
Application.Run
should keep it running
Where is this code?discord controller
I think I have an idea
Where is DiscordController being used?
honestly idk it's always trouble when I have to use someone elses library
Well this seems unrelated to the library. Code won't execute until you tell it to. If you have nothing that is using DiscordController, it won't do anything
got it working
Maybe what you're wanting is to put a button or something in MainForm, then on button click, create an instance of the class, then call whatever method you want
oh what the heck, nice
did you add something that actually uses the variable
I tried two different things with the official SDK, couldnt get it to work
but there is an up to date alternative
DiscordRichPresence 1.1.3.18
A .NET implementation of Discord's Rich Presence functionality. This library supports all features of the Rich Presence that the official C++ library supports, plus a few extra.
"Players love to show off what they are playing with Discord’s status feature. With Rich Presence you can add beautiful art and detailed information to show off your ga...
this is for a console app btw
and Im using a host to stay alive
so skip those parts if you want this for a winforms app
but the center part, aka the stuff that deals with
client
works finewish me luck hahaha, my brain is mush rn, it's 6:30 am no sleep and I'll be amazed if I can get it installed right
this code is way tider though :o
thanks
just be aware, this might not be trivial to set up working nicely in a winforms app.
I wouldn't want this in a form, but rather in the app itself.. but a form event (logging in) will be what triggers some of the
SetPrecense
calls
I suppose you could expose the client instance via a static wrappercan't I manually trigger a SetPresence call elsewhere?
thats fine for something like this.
I plan to set presence after every relevant database change
I haven't test this, but playing around putting that code into a form
this thing is an RPC client, it needs to stay alive, and you'll need to invoke updates and stuff
there is a message pump involved.
I would strongly refrain from doing exactly as above - a form instance owning the client
imho a static wrapper will be better
you could expose a helper method that provides easy access to the SetPresence call.
oh that seems easy enough :)
I say as I can't figure out how to install the damn thing, and all words blur together into an incohent mess
so to summarize, I'd create my own non-static class that wraps this, then expose a single instance of that using a static singleton
go sleep then
no point coding when exhausted, it just turns out bad and no learning is done 😄
yeah, but I don't feel productive enough 😢
you wont get more productive as your sanity dwindles :p
sleep, come back at it well rested
and you'll get much further
okay 😔
Okay update, i've copied what other people have done down to the very letter, still not working, I'm starting to wonder if it's something wrong with my discord developer portal
@Pobiega can I see your Oauth for the discord application you were testing? I worry I got something wrong
I did no OAuth, I posted literally all the code
Except my discord ID
yeah no matter what I do it tells me there's stuff that doesn't exist in this context
I've tried the nuget plugins
DiscordRPC
DiscordGameSDK
and discord rich presence
I think I'm just cursed or something, there's been way too many instances of things other people do fine that completely explode when I do the exact same thing
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.