Homebrew [Release] Discord 3DS Client

VMHoss

Well-Known Member
Member
Joined
Nov 7, 2019
Messages
128
Trophies
0
XP
591
Country
United Kingdom
There's been recently a lot of demand for this all of a sudden. I'll be honest and say that I haven't been working on this. I still make Discord related stuff but the 3DS client has been pretty challenging for me. I'm not used to writing software for really low spec systems. Discord server data can get pretty big with lots of data like nicknames, role colors, avatars pics, etc for every user. And Discord keeps growing with more and more users and features that will mean we will need more ram to store all that info. A rewrite might be needed to move this server data out of the 3DS's ram and into the SD card. A big shift to how the client works right now.
Here's an error from this app: Error 5001: Unexpected or unknown event occurred
Help is on the way soon.
 

Gamesequence242

New Member
Newbie
Joined
Mar 27, 2020
Messages
2
Trophies
0
Age
19
XP
33
Country
United States
How do I get a token file for it to work?

--------------------- MERGED ---------------------------

I noticed there was a token file that is needed, how do I get it?
 

Sleepy Flower Girl

Active Member
OP
Newcomer
Joined
Feb 26, 2016
Messages
35
Trophies
0
Age
33
XP
287
Country
United States
This client is going to stop working later this year. I understand that some of you guys want a Discord client on the 3DS but it's a lot of effort required to make one work with stability on the 3DS because of lack of memory and slowness of SD cards. Discord also changed it's TOS and guidelines recently and the old states
You agree not to (and not to attempt to) (i) use the Service for any use or purpose other than as expressly permitted by these Terms;(ii) copy, adapt, modify, prepare derivative works based upon, distribute, license, sell, transfer, publicly display, publicly perform, transmit, stream, broadcast, attempt to discover any source code, reverse engineer, decompile, disassemble, or otherwise exploit the Service or any portion of the Service, except as expressly permitted in these Terms; or (iii) use data mining, robots, spiders, or similar data gathering and extraction tools on the Service.
https://discord.com/new/terms and
You may not use self-bots or user-bots to access Discord
https://discord.com/new/guidelines Discord is going to make big changes to it's API sometime in November, anything that doesn't update to make sure it keeps working with the changes will stop working. I'm calling this change the Discord.com change and also the v7 change. The Discord.com isn't a big change but v7 is pretty big. I've been also having a hard time keeping the client not use up too much memory and moving stuff to be stored on the SD card.

There's also now an verification process for bots that want to get server member data from the web sockets API when on a lot of servers. Since this client counts as a custom client because it's not official and uses the API and many are using it on a user account instead of a bot account, I'm not sure if someone will get in trouble for using this while on a lot of servers as the client will not be approved by Discord. Then again you'll likely run out of memory anyways but that's not the issue. Discord wants to be more careful about what people are using the data from Discord's API for now for security reasons, and I don't blame them.

It was a pretty good run I guess, but I think it's time to say good bye to Discord on 3DS. You'll be missed. I also want to thanks everyone that helped with the details of doing networking with tcp and tls on the 3DS to help kickstart this project and those that helped me cram the Discord client into the 3DS's memory on the first version and the one that helped me get font rendering working. I also want to thank the people that used my client.

I'm not going to stop doing stuff with Discord, I'm still working on the Sleepy Discord library that this client uses. There are people using my library to build stuff on the switch as well, and I hope they'll continue to work. As for this client, I don't think Discord, the company, will want it or any custom client to continue. I don't want to shamelessly plug my newer work, but in case you want to know, I'm currently working on a Discord bot and my own online multiplayer video game now.

I think this video is relevant. Skip to 5:33, if you want the relevant info.

thanks tom scott.
 
Last edited by Sleepy Flower Girl,

Sleepy Flower Girl

Active Member
OP
Newcomer
Joined
Feb 26, 2016
Messages
35
Trophies
0
Age
33
XP
287
Country
United States
Hate you too, Discord!
:D
Well, the changes aren't made to break clients. However, the changes Discord is making make sense and will make Discord a better chat platform. However, I am aware that many bots and stuff that rely on Discord will be breaking if the authors don't start making changes now or they'll not hit Discord's deadline. I don't think I'll be able fix the issues such as moving the cache to the SD card while also updating the client to work better with Discord's upcoming changes. I chose that I would instead focus on making my lib work for those that have bots that rely on my lib that this client is also relying. At least, v7 will give nice performance improvements to bots and other very exciting features.
 
  • Like
Reactions: Julie_Pilgrim

Sleepy Flower Girl

Active Member
OP
Newcomer
Joined
Feb 26, 2016
Messages
35
Trophies
0
Age
33
XP
287
Country
United States
I've been getting messages asking how to make a Discord Client. For the sake of not repeating myself. I'll go over the many steps. Firstly, I need to say that doing so is against the TOS if you are using a user account. I generally only use the client with a bot account. Anyway, you'll need to understand the Discord API and it's protocols. The main protocols being WebSockets, HTTPS, and JSON. These protocols also use other protocols, such as TLS and TCP. I've made a Discord library for bots, not clients, so I used what I made. Unless, you are very familiar with the APIs, I recommend using a Discord library. You'll need to modify them as they generally don't support custom clients. Discord updates their API sometimes to add features that can break your client, so you'll need update the library and client when that happens.

My library was made to be modular, so I used this as a test to see if modules can add support for strange platforms. We'll need a module for the 2 protocols that work differently on different platforms. Those being the ones that rely on the internet protocol or sockets, so WebSockets, and HTTPS. At first, I used the HTTP library that was part of the homebrew SDK but Discord would reject it a lot. I used my own, as libcurl isn't available though the homebrew SDK. Wslay is a WebSockets library that uses callbacks, this is where you give functions for wslay to use to access things like TLS and HTTPS. We write the needed functions for wslay which use the homebrew SDK's TLS, and our HTTPS library. The HTTPS library is where the TLS connection is first created, however unlike most HTTPS request, which end after getting a response, we keep it open and must poll it and wslay. This should let you connect to Discord's WebSockets server, gateways as Discord likes to call it.

Now, we need to keep the connection open. There's a number of task that need to be done to do this, the library will handle most of them without help but some (reconnects, connection health check, etc.) require a timer running in the background. So you'll need to implement a timer system that does the task at the time given. The current version does a "temporary" solution. A list of task to do and when to do them is stored. When as task needs to be done, we add them to the list. 3DS programs have, what the SDK calls, the main loop, where code runs over and over again until the user press close on the system UI. In there we check if it's time to do a task and then do that task. This was going to be temporary, as this isn't that great of a solution as it doesn't make use of threads or async. The connection should stay open after all this.

After that, you'll need the client to listen for Discord events. This is where you'll get your data, and a lot of data. Most of the data, you don't need right away but Discord isn't going to give you the same data more then once. So, you'll need to store it somewhere. As a "temporary" solution, I used the memory. At first I used hash maps because accessing data from one is quick even for lots of data. However, it would quickly ran out of ram, so I used linked lists, which is slower when accessing data when dealing with lots of data but it used less memory. Again, "temporary solution". I also did some optimizations on everything above and the data needed to be stored but it'll always run out of memory at some point. It'll happen faster if you are on more servers, big servers, very active, or worse, all the above. A more permanent solution would be some cache system that stored this data off the memory if it's not needed just yet. However, remember we are working with SD cards, which aren't known for fast random read and write speeds or much storage space. Looking back, working on getting async working would have really helped here.

Of course, finally, what good is a client where you can't see messages. I'm sure there are frontend frameworks or libraries that does this for you but I made my own and I don't feel like getting into that stuff. It drew triangles, making a rectangle, with textures and positioned them using the C3D library.

Hopefully now, you understand the amount of effort and knowledge getting a Discord client on the 3DS requires. Thanks for reading this long and technical write up.
 
Last edited by Sleepy Flower Girl,

678bluered

New Member
Newbie
Joined
Mar 2, 2023
Messages
1
Trophies
0
Age
23
XP
15
Country
United States
yo i just got it and i need token.txt file it said
Post automatically merged:

i just need token.txt file to boot it up
 

Sleepy Flower Girl

Active Member
OP
Newcomer
Joined
Feb 26, 2016
Messages
35
Trophies
0
Age
33
XP
287
Country
United States
If you really want to relieve this. You're going to need to use TLS 1.2. I used SSLC, which is TLS 1.1 from what I remember and now gives a "this is not a SSL connection error". Both the Discord library and the TLS library is going to need to be replaced. New TLS is also more CPU intensive, so it would also make the client slower.
rip it says ssl connection failed
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: Plus a lot of the times they just seemed half hearted attempts